Class Attributes

    • Constructor Detail

      • Attributes

        public Attributes()
    • 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 be null
        value - the value to associate with the name, or null to 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 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(Class), setAttribute(String, Object)
      • 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:
        setAttribute(String, Object)
      • 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:
        setAttribute(Class, Object), getAttribute(String)
      • isEmpty

        public boolean isEmpty()
        Returns true if there are no attributes.
        Returns:
        true if there are no attributes