Class Attributes

java.lang.Object
com.vaadin.flow.server.Attributes
All Implemented Interfaces:
Serializable

public class Attributes extends Object implements Serializable
The Attributes class represents a set of attributes.
Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • Attributes

      public Attributes()
  • Method Details

    • 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 be null
      value - the value to associate with the name, or null to remove a previous association.
      See Also:
    • setAttribute

      public <T> void setAttribute(Class<T> type, T value)
      Stores a value in this set. Setting the value to null 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 null
      value - the value to associate with the type, or null to remove a previous association.
      See Also:
    • getAttribute

      public Object getAttribute(String name)
      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 be null.
      Returns:
      the value, or null if no value has been stored or if it has been set to null.
      See Also:
    • getAttribute

      public <T> T getAttribute(Class<T> type)
      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 be null.
      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()
      Returns true if there are no attributes.
      Returns:
      true if there are no attributes