Interface Attributes

All Known Subinterfaces:
Environment
All Known Implementing Classes:
AttributeContainerMap, Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Wrapper, AttributesMap, Environment.Named

public interface Attributes
Attributes. Interface commonly used for storing attributes.
  • Field Details

  • Method Details

    • removeAttribute

      Object removeAttribute(String name)
      Remove an attribute
      Parameters:
      name - the attribute to remove
      Returns:
      the value of the attribute if removed, else null
    • setAttribute

      Object setAttribute(String name, Object attribute)
      Set an attribute
      Parameters:
      name - the attribute to set
      attribute - the value to set. A null value is equivalent to removing the attribute.
      Returns:
      the previous value of the attribute if set, else null
    • getAttribute

      Object getAttribute(String name)
      Get an attribute
      Parameters:
      name - the attribute to get
      Returns:
      the value of the attribute
    • getAttributeNameSet

      Set<String> getAttributeNameSet()
      Get the immutable set of attribute names.
      Returns:
      Set of attribute names
    • asAttributeMap

      default Map<String,Object> asAttributeMap()
    • clearAttributes

      default void clearAttributes()
      Clear all attribute names
    • unwrap

      static Attributes unwrap(Attributes attributes)
      Unwrap all Attributes.Wrappers of the attributes
      Parameters:
      attributes - The attributes to unwrap, which may be a Attributes.Wrapper.
      Returns:
      The core attributes
    • unwrap

      static <T extends Attributes.Wrapper> T unwrap(Attributes attributes, Class<T> target)
      Unwrap attributes to a specific attribute Attributes.Wrapper.
      Type Parameters:
      T - The type of the target Attributes.Wrapper.
      Parameters:
      attributes - The attributes to unwrap, which may be a Attributes.Wrapper
      target - The target Attributes.Wrapper class.
      Returns:
      The outermost Attributes.Wrapper of the matching type of null if not found.