Class Attributes.Synthetic

java.lang.Object
org.eclipse.jetty.util.Attributes.Wrapper
org.eclipse.jetty.util.Attributes.Synthetic
All Implemented Interfaces:
Attributes
Enclosing interface:
Attributes

public abstract static class Attributes.Synthetic extends Attributes.Wrapper
An abstract implementation of Attributes.Wrapper that provides a mechanism for synthetic attributes that can be modified or deleted. A synthetic attribute is one whose value is not stored in the normal map backing the Attributes instance, but is instead calculated as needed. Modifications to synthetic attributes are maintained in a separate layer and no modifications are made to the backing Attributes.

Non-synthetic attributes are handled normally by the backing Attributes

Uses of this class must provide implementations for getSyntheticNameSet() amd getSyntheticAttribute(String).

  • Field Details

    • REMOVED

      protected static final Object REMOVED
  • Constructor Details

    • Synthetic

      protected Synthetic(Attributes base)
  • Method Details

    • getSyntheticAttribute

      protected abstract Object getSyntheticAttribute(String name)
      Get the value of a specific synthetic attribute.
      Parameters:
      name - The name of the attribute
      Returns:
      The value for the attribute, which may be computed on request, or null
    • getSyntheticNameSet

      protected abstract Set<String> getSyntheticNameSet()
      Get the list of known synthetic attribute names, including those that currently have a null value.
      Returns:
      A Set of known synthetic attributes names.
    • getAttribute

      public Object getAttribute(String name)
      Description copied from interface: Attributes
      Get an attribute
      Specified by:
      getAttribute in interface Attributes
      Overrides:
      getAttribute in class Attributes.Wrapper
      Parameters:
      name - the attribute to get
      Returns:
      the value of the attribute, or null if no such attribute exists
    • setAttribute

      public Object setAttribute(String name, Object value)
      Description copied from interface: Attributes
      Set an attribute
      Specified by:
      setAttribute in interface Attributes
      Overrides:
      setAttribute in class Attributes.Wrapper
      Parameters:
      name - the attribute to set
      value - the value to set. A null value is equivalent to removing the attribute.
      Returns:
      the previous value of the attribute if set, else null
    • removeAttribute

      public Object removeAttribute(String name)
      Description copied from interface: Attributes
      Remove an attribute
      Specified by:
      removeAttribute in interface Attributes
      Overrides:
      removeAttribute in class Attributes.Wrapper
      Parameters:
      name - the attribute to remove
      Returns:
      the value of the attribute if removed, else null
    • getAttributeNameSet

      public Set<String> getAttributeNameSet()
      Description copied from interface: Attributes
      Get the immutable set of attribute names.
      Specified by:
      getAttributeNameSet in interface Attributes
      Overrides:
      getAttributeNameSet in class Attributes.Wrapper
      Returns:
      Set of attribute names, or an empty set if there are no attributes.
    • clearAttributes

      public void clearAttributes()
      Description copied from interface: Attributes
      Clear all attribute names
      Specified by:
      clearAttributes in interface Attributes
      Overrides:
      clearAttributes in class Attributes.Wrapper