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
-
Method Summary
Modifier and TypeMethodDescription<T> T
getAttribute
(Class<T> type) Gets a stored attribute value.getAttribute
(String name) Gets a stored attribute value.boolean
isEmpty()
Returnstrue
if there are no attributes.<T> void
setAttribute
(Class<T> type, T value) Stores a value in this set.void
setAttribute
(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 benull
value
- the value to associate with the name, ornull
to remove a previous association.- See Also:
-
setAttribute
Stores a value in this set. Setting the value tonull
clears 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, ornull
to remove a previous association.- See Also:
-
getAttribute
Gets a stored attribute value. If no value is stored for the name,null
is returned.- Parameters:
name
- the name of the value to get, can not benull
.- Returns:
- the value, or
null
if 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,null
is 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
null
if no value has been stored or if it has been set to null. - See Also:
-
isEmpty
public boolean isEmpty()Returnstrue
if there are no attributes.- Returns:
true
if there are no attributes
-