类 AttributeAccessorSupport

java.lang.Object
cn.taketoday.core.AttributeAccessorSupport
所有已实现的接口:
AttributeAccessor, Serializable

public abstract class AttributeAccessorSupport extends Object implements AttributeAccessor, Serializable
Support class for AttributeAccessors, providing a base implementation of all methods. To be extended by subclasses.

Serializable if subclasses and all attribute values are Serializable.

从以下版本开始:
2.1.7
作者:
Rob Harrop, Juergen Hoeller, TODAY
2020-02-22 12:47
另请参阅:
  • 字段详细资料

    • serialVersionUID

      private static final long serialVersionUID
      另请参阅:
    • attributes

      @Nullable protected Map<String,Object> attributes
      Map with String keys and Object values.
  • 构造器详细资料

    • AttributeAccessorSupport

      public AttributeAccessorSupport()
  • 方法详细资料

    • setAttribute

      public void setAttribute(String name, @Nullable Object value)
      从接口复制的说明: AttributeAccessor
      Set the attribute defined by name to the supplied value. If value is null, the attribute is removed.

      In general, users should take care to prevent overlaps with other metadata attributes by using fully-qualified names, perhaps using class or package names as prefix.

      指定者:
      setAttribute 在接口中 AttributeAccessor
      参数:
      name - the unique attribute key
      value - the attribute value to be attached
    • getAttribute

      @Nullable public Object getAttribute(String name)
      从接口复制的说明: AttributeAccessor
      Get the value of the attribute identified by name. Return null if the attribute doesn't exist.
      指定者:
      getAttribute 在接口中 AttributeAccessor
      参数:
      name - the unique attribute key
      返回:
      the current value of the attribute, if any
    • computeAttribute

      public <T> T computeAttribute(String name, Function<String,T> computeFunction)
      从接口复制的说明: AttributeAccessor
      Compute a new value for the attribute identified by name if necessary and set the new value in this AttributeAccessor.

      If a value for the attribute identified by name already exists in this AttributeAccessor, the existing value will be returned without applying the supplied compute function.

      The default implementation of this method is not thread safe but can overridden by concrete implementations of this interface.

      指定者:
      computeAttribute 在接口中 AttributeAccessor
      类型参数:
      T - the type of the attribute value
      参数:
      name - the unique attribute key
      computeFunction - a function that computes a new value for the attribute name; the function must not return a null value
      返回:
      the existing value or newly computed value for the named attribute
      另请参阅:
    • removeAttribute

      public Object removeAttribute(String name)
      从接口复制的说明: AttributeAccessor
      Remove the attribute identified by name and return its value. Return null if no attribute under name is found.
      指定者:
      removeAttribute 在接口中 AttributeAccessor
      参数:
      name - the unique attribute key
      返回:
      the last value of the attribute, if any
    • hasAttribute

      public boolean hasAttribute(String name)
      从接口复制的说明: AttributeAccessor
      Return true if the attribute identified by name exists. Otherwise return false.
      指定者:
      hasAttribute 在接口中 AttributeAccessor
      参数:
      name - the unique attribute key
    • getAttributeNames

      public String[] getAttributeNames()
      从接口复制的说明: AttributeAccessor
      Return the names of all attributes.
      指定者:
      getAttributeNames 在接口中 AttributeAccessor
    • attributeNames

      public Iterator<String> attributeNames()
      从接口复制的说明: AttributeAccessor
      Return the names Iterator.
      指定者:
      attributeNames 在接口中 AttributeAccessor
    • copyAttributesFrom

      public void copyAttributesFrom(AttributeAccessor source)
      Copy the attributes from the supplied AttributeAccessor to this accessor.
      指定者:
      copyAttributesFrom 在接口中 AttributeAccessor
      参数:
      source - the AttributeAccessor to copy from
    • clearAttributes

      public void clearAttributes()
      指定者:
      clearAttributes 在接口中 AttributeAccessor
      从以下版本开始:
      3.0
    • hasAttributes

      public boolean hasAttributes()
      Returns true if this map contains no key-value mappings.
      指定者:
      hasAttributes 在接口中 AttributeAccessor
      返回:
      true if this map contains no key-value mappings
      从以下版本开始:
      4.0
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • equals

      public boolean equals(Object other)
      覆盖:
      equals 在类中 Object
    • getAttributes

      public Map<String,Object> getAttributes()
      从接口复制的说明: AttributeAccessor
      Return attributes map
      指定者:
      getAttributes 在接口中 AttributeAccessor
      返回:
      attributes map
    • createAttributes

      protected Map<String,Object> createAttributes()