java.lang.Object
com.aoapps.html.any.Attributes
See HTML Attributes.
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic @interfaceMarks a method as being an attribute funnel to aid in implementation.static final classstatic final classNon-streamable text attributes (expected to be short, relatively fixed values).static final classStreamable text attributes.static final classURL attributes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSpecial value used in-place of return values that should result in an empty attribute (expected onSerialization.SGMLonly).static final Resources -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationResultinvalidGlobalAttributeForDoctype(Element<?, ?, ?> element, Doctype requiredDoctype, String attrName) Enforces that the document type is correct for the given global attribute.static voidonlySupportedInHtml5(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 ValidationResultvalidateInHtml5(AnyDocument<?> document, String attrName) Validates that the document type is HTML 5 for the given attribute.static ValidationResultvalidateInHtml5(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.SGMLonly). 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, supportingLocalizedIllegalArgumentExceptionwhen validationResult is anInvalidResultEx
-
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, supportingLocalizedIllegalArgumentExceptionwhen validationResult is anInvalidResultEx
-
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.
-
