Interface Attributes

All Known Subinterfaces:
ConnectionMetaData, Context, Environment, Request, Request.ServeAs, ServerUpgradeRequest, ServerUpgradeRequest, Session
All Known Implementing Classes:
AbstractMetaDataConnection, AttributeContainerMap, Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper, AttributesMap, ConnectionMetaData.Wrapper, ContextHandler, ContextHandler.ScopedContext, ContextRequest, Environment.Named, ErrorHandler.ErrorRequest, GzipRequest, HeaderWrappingRequest, HTTP2ServerConnection, HttpChannelState.ChannelRequest, HttpConnection, HttpConversation, HttpSpiContextHandler, ManagedSession, MovedContextHandler, Request.AttributesWrapper, Request.Wrapper, ResourceHandler.ResourceContext, Rule.Handler, Rule.HttpURIHandler, SecureRequestCustomizer.SecureRequest, SecureRequestCustomizer.SecureRequestWithSslSessionData, Server, ServerFCGIConnection, ServerUpgradeRequestDelegate, ServerUpgradeRequestImpl, ServletContextHandler, ServletContextHandler.ServletScopedContext, ServletContextRequest, ServletCoreRequest, ServletCoreRequest.ServletAttributes, StatisticsHandler.MinimumDataRateHandler.MinimumDataRateRequest, WebAppContext

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, or null if no such attribute exists
    • getAttributeNameSet

      Set<String> getAttributeNameSet()
      Get the immutable set of attribute names.
      Returns:
      Set of attribute names, or an empty set if there are no attributes.
    • asAttributeMap

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

      default void clearAttributes()
      Clear all attribute names
    • hashCode

      int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      boolean equals(Object o)
      Overrides:
      equals in class Object
    • 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
    • hashCode

      static int hashCode(Attributes attributes)
    • equals

      static boolean equals(Attributes attributes, Object o)
    • 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.