java.lang.Object
com.aoapps.html.any.Attributes
See HTML Attributes.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
static final class
static @interface
Marks a method as being an attribute funnel to aid in implementation.static final class
static final class
Non-streamable text attributes (expected to be short, relatively fixed values).static final class
Streamable text attributes.static final class
URL attributes. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Special value used in-place of return values that should result in an empty attribute (expected onSerialization.SGML
only).static final Resources
-
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationResult
invalidGlobalAttributeForDoctype
(Element<?, ?, ?> element, Doctype requiredDoctype, String attrName) Enforces that the document type is correct for the given global attribute.static void
onlySupportedInHtml5
(AnyDocument<?> document, String attrName) Enforces that the document type is HTML 5 for the given attribute.static <T,
Ex extends Throwable>
Tvalidate
(T value, FunctionE<? super T, ValidationResult, Ex> validator) Validates a value using the provided validator.static <T,
Ex extends Throwable>
Tvalidate
(T value, ValidationResult validationResult) Checks a validation result.static ValidationResult
validateInHtml5
(AnyDocument<?> document, String attrName) Validates that the document type is HTML 5 for the given attribute.static ValidationResult
validateInHtml5
(Element<?, ?, ?> element, String attrName) Validates that the document type is HTML 5 for the given attribute.
-
Field Details
-
RESOURCES
-
NO_VALUE
Special value used in-place of return values that should result in an empty attribute (expected onSerialization.SGML
only). This distinguishes from a return value ofnull
, which causes the attribute to not be added at all.In order to never conflict with an actual attribute value, this string is compared by identity, not by value.
-
-
Method Details
-
validate
public static <T,Ex extends Throwable> T validate(T value, ValidationResult validationResult) throws IllegalArgumentException, Ex Checks a validation result.- Returns:
- The value when valid
- Throws:
IllegalArgumentException
- When invalid, supportingLocalizedIllegalArgumentException
when validationResult is anInvalidResult
Ex
-
validate
public static <T,Ex extends Throwable> T validate(T value, FunctionE<? super T, ValidationResult, throws IllegalArgumentException, ExEx> validator) Validates a value using the provided validator.- Parameters:
validator
- Whennull
, no validation is performed.- Returns:
- The value when valid
- Throws:
IllegalArgumentException
- When invalid, supportingLocalizedIllegalArgumentException
when validationResult is anInvalidResult
Ex
-
validateInHtml5
Validates that the document type is HTML 5 for the given attribute. -
validateInHtml5
Validates that the document type is HTML 5 for the given attribute. -
onlySupportedInHtml5
public static void onlySupportedInHtml5(AnyDocument<?> document, String attrName) throws UnsupportedOperationException Enforces that the document type is HTML 5 for the given attribute.- Throws:
UnsupportedOperationException
- whenEncodingContext.getDoctype()
is notDoctype.HTML5
.
-
invalidGlobalAttributeForDoctype
public static ValidationResult invalidGlobalAttributeForDoctype(Element<?, ?, ?> element, Doctype requiredDoctype, String attrName) Enforces that the document type is correct for the given global attribute.- Throws:
UnsupportedOperationException
- whenEncodingContext.getDoctype()
is notDoctype.HTML5
.
-