Package com.vaadin.flow.server
Class Attributes
java.lang.Object
com.vaadin.flow.server.Attributes
- All Implemented Interfaces:
Serializable
The
Attributes class represents a set of attributes.- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> TgetAttribute(Class<T> type) Gets a stored attribute value.getAttribute(String name) Gets a stored attribute value.booleanisEmpty()Returnstrueif there are no attributes.<T> voidsetAttribute(Class<T> type, T value) Stores a value in this set.voidsetAttribute(String name, Object value) Stores a value in this set.
-
Constructor Details
-
Attributes
public Attributes()
-
-
Method Details
-
setAttribute
Stores a value in this set.- Parameters:
name- the name to associate the value with, can not benullvalue- the value to associate with the name, ornullto remove a previous association.- See Also:
-
setAttribute
Stores a value in this set. Setting the value tonullclears the stored value.The fully qualified name of the type is used as the name when storing the value. The outcome of calling this method is thus the same as if calling
setAttribute(type.getName(), value);- Type Parameters:
T- the attribute type- Parameters:
type- the type that the stored value represents, can not be nullvalue- the value to associate with the type, ornullto remove a previous association.- See Also:
-
getAttribute
Gets a stored attribute value. If no value is stored for the name,nullis returned.- Parameters:
name- the name of the value to get, can not benull.- Returns:
- the value, or
nullif no value has been stored or if it has been set to null. - See Also:
-
getAttribute
Gets a stored attribute value. If no value is stored for the name,nullis returned.The fully qualified name of the type is used as the name when getting the value. The outcome of calling this method is thus the same as if calling
getAttribute(type.getName());- Type Parameters:
T- the attribute type- Parameters:
type- the type of the value to get, can not benull.- Returns:
- the value, or
nullif no value has been stored or if it has been set to null. - See Also:
-
isEmpty
public boolean isEmpty()Returnstrueif there are no attributes.- Returns:
trueif there are no attributes
-