Package com.vaadin.flow.dom.impl
Class CustomAttribute
java.lang.Object
com.vaadin.flow.dom.impl.CustomAttribute
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClassAttributeHandler,StyleAttributeHandler
Callback for handling attributes with special semantics. This is used for
e.g.
class which is assembled from a separate list of tokens
instead of being stored as a regular attribute string.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<CustomAttribute> Gets the custom attribute with the provided name, if present.abstract StringgetAttribute(Element element) Gets the value that should be returned byElement.getAttribute(String)for this attribute.getNames()Gets an unmodifiable set of custom attribute names.abstract booleanhasAttribute(Element element) Checks whatElement.hasAttribute(String)should return for this attribute.abstract voidremoveAttribute(Element element) Removes the attribute whenElement.removeAttribute(String)is called for this attribute.abstract voidsetAttribute(Element element, String value) Sets the value whenElement.setAttribute(String, String)is called for this attribute.
-
Constructor Details
-
CustomAttribute
public CustomAttribute()
-
-
Method Details
-
get
Gets the custom attribute with the provided name, if present.- Parameters:
name- the name of the attribute- Returns:
- and optional custom attribute, or an empty optional if there is no attribute with the given name
-
getNames
Gets an unmodifiable set of custom attribute names.- Returns:
- a set of attribute names
-
hasAttribute
Checks whatElement.hasAttribute(String)should return for this attribute.- Parameters:
element- the element to check, notnull- Returns:
trueif the element has a value for this attribute, otherwisefalse
-
getAttribute
Gets the value that should be returned byElement.getAttribute(String)for this attribute.- Parameters:
element- the element to check, notnull- Returns:
- the attribute value
-
setAttribute
Sets the value whenElement.setAttribute(String, String)is called for this attribute.- Parameters:
element- the element for which to set the value, notnullvalue- the new attribute value, notnull
-
removeAttribute
Removes the attribute whenElement.removeAttribute(String)is called for this attribute.- Parameters:
element- the element for which to remove the attribute, notnull
-