com.vaadin.flow.dom.impl.
Class CustomAttribute
- java.lang.Object
-
- com.vaadin.flow.dom.impl.CustomAttribute
-
All Implemented Interfaces:
Direct Known Subclasses:
public abstract class CustomAttribute extends Object implements Serializable
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 Constructor Description CustomAttribute()
-
Method Summary
All Methods Modifier and Type Method Description static Optional<CustomAttribute>
get(String name)
Gets the custom attribute with the provided name, if present.
abstract String
getAttribute(Element element)
Gets the value that should be returned by
Element.getAttribute(String)
for this attribute.static Set<String>
getNames()
Gets an unmodifiable set of custom attribute names.
abstract boolean
hasAttribute(Element element)
Checks what
Element.hasAttribute(String)
should return for this attribute.abstract void
removeAttribute(Element element)
Removes the attribute when
Element.removeAttribute(String)
is called for this attribute.abstract void
setAttribute(Element element, String value)
Sets the value when
Element.setAttribute(String, String)
is called for this attribute.
-
-
-
Method Detail
-
get
public static Optional<CustomAttribute> get(String name)
Gets the custom attribute with the provided name, if present.
Parameters:
name
- the name of the attributeReturns:
and optional custom attribute, or an empty optional if there is no attribute with the given name
-
getNames
public static Set<String> getNames()
Gets an unmodifiable set of custom attribute names.
Returns:
a set of attribute names
-
hasAttribute
public abstract boolean hasAttribute(Element element)
Checks what
Element.hasAttribute(String)
should return for this attribute.Parameters:
element
- the element to check, notnull
Returns:
true
if the element has a value for this attribute, otherwisefalse
-
getAttribute
public abstract String getAttribute(Element element)
Gets the value that should be returned by
Element.getAttribute(String)
for this attribute.Parameters:
element
- the element to check, notnull
Returns:
the attribute value
-
setAttribute
public abstract void setAttribute(Element element, String value)
Sets the value when
Element.setAttribute(String, String)
is called for this attribute.Parameters:
element
- the element for which to set the value, notnull
value
- the new attribute value, notnull
-
removeAttribute
public abstract void removeAttribute(Element element)
Removes the attribute when
Element.removeAttribute(String)
is called for this attribute.Parameters:
element
- the element for which to remove the attribute, notnull
-
-