Package com.vaadin.flow.server
Class Attributes
- java.lang.Object
-
- com.vaadin.flow.server.Attributes
-
- All Implemented Interfaces:
Serializable
public class Attributes extends Object implements Serializable
TheAttributesclass represents a set of attributes.- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Attributes()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetAttribute(Class<T> type)Gets a stored attribute value.ObjectgetAttribute(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.
-
-
-
Method Detail
-
setAttribute
public void setAttribute(String name, Object value)
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:
getAttribute(String)
-
setAttribute
public <T> void setAttribute(Class<T> type, T value)
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(Class),setAttribute(String, Object)
-
getAttribute
public Object getAttribute(String name)
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:
setAttribute(String, Object)
-
getAttribute
public <T> T getAttribute(Class<T> type)
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:
setAttribute(Class, Object),getAttribute(String)
-
isEmpty
public boolean isEmpty()
Returnstrueif there are no attributes.- Returns:
trueif there are no attributes
-
-