java.lang.Object
org.infinispan.commons.configuration.attributes.AttributeSet
All Implemented Interfaces:
AttributeListener<Object>, Matchable<AttributeSet>, Updatable<AttributeSet>

public class AttributeSet extends Object implements AttributeListener<Object>, Matchable<AttributeSet>, Updatable<AttributeSet>
AttributeSet is a container for Attributes. It is constructed by passing in a list of AttributeDefinitions. AttributeSets are initially unprotected, which means that the contained attributes can be modified. If the protect() method is invoked then only attributes which are not AttributeDefinition.isImmutable() can be modified from then on.
Since:
7.2
Author:
Tristan Tarrant
  • Field Details

  • Constructor Details

  • Method Details

    • getKlass

      public Class<?> getKlass()
    • getName

      public String getName()
    • contains

      public boolean contains(String name)
      Returns whether this attribute set contains the specified named attribute
      Parameters:
      name - the name of the attribute
    • contains

      public <T> boolean contains(AttributeDefinition<T> def)
      Returns whether this set contains the specified attribute definition
      Parameters:
      def - the AttributeDefinition
    • attribute

      public <T> Attribute<T> attribute(String name)
      Returns the named attribute
      Parameters:
      name - the name of the attribute to return
      Returns:
      the attribute
    • attribute

      public <T> Attribute<T> attribute(Enum<?> name)
      Returns the named attribute
      Parameters:
      name - the name of the attribute to return
      Returns:
      the attribute
    • attribute

      public <T> Attribute<T> attribute(AttributeDefinition<T> def)
      Returns the attribute identified by the supplied AttributeDefinition
      Parameters:
      def - the attribute definition
      Returns:
      the attribute
    • read

      public void read(AttributeSet other, Combine combine)
      Copies all attribute from another AttributeSet using the supplied Combine.Attributes strategy.
      Parameters:
      other - the source AttributeSet
      combine - the attribute combine strategy
    • protect

      public AttributeSet protect()
      Returns a new ValueSet where immutable Attributes are write-protected
      Returns:
    • isModified

      public boolean isModified()
      Returns whether any attributes in this set have been modified
    • isProtected

      public boolean isProtected()
      Returns whether this attribute set is protected
    • write

      public void write(ConfigurationWriter writer, AttributeDefinition<?> def)
      Writer a single attribute to the specified ConfigurationWriter using the attribute's xmlName
      Parameters:
      writer - the writer
      def - the Attribute definition
    • write

      public void write(ConfigurationWriter writer, AttributeDefinition<?> def, Enum<?> name)
      Writer a single attribute to the specified ConfigurationWriter using the supplied name
      Parameters:
      writer - the writer
      def - the Attribute definition
      name - the XML tag name for the attribute
    • write

      public void write(ConfigurationWriter writer, AttributeDefinition<?> def, String name)
      Writer a single attribute to the specified ConfigurationWriter using the supplied name
      Parameters:
      writer - the writer
      def - the Attribute definition
      name - the XML tag name for the attribute
    • write

      public void write(ConfigurationWriter writer, String name)
      Writes this attributeset to the specified ConfigurationWriter as an element
      Parameters:
      writer -
    • write

      public void write(ConfigurationWriter writer, Enum<?> name)
      Writes this attributeset to the specified ConfigurationWriter as an element
      Parameters:
      writer -
    • write

      public void write(ConfigurationWriter writer, String persistentName, AttributeDefinition<?>... defs)
      Writes the specified attributes in this attributeset to the specified ConfigurationWriter as an element
      Parameters:
      writer - the ConfigurationWriter
      persistentName - the name the attribute should have in its persistent form
      defs - the attributes that should be written
    • write

      public void write(ConfigurationWriter writer)
      Writes the attributes of this attributeset as part of the current element
      Parameters:
      writer -
    • validate

      public void validate()
      Validates the Attribute values.
    • hashCode

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • matches

      public boolean matches(AttributeSet other)
      Specified by:
      matches in interface Matchable<AttributeSet>
    • update

      public void update(String parentName, AttributeSet other)
      Description copied from interface: Updatable
      Updates the mutable part of this instance with the values of the other instance
      Specified by:
      update in interface Updatable<AttributeSet>
      Parameters:
      other -
    • validateUpdate

      public void validateUpdate(String parentName, AttributeSet other)
      Description copied from interface: Updatable
      Verifies that updating the mutable part of this instance with the values of the other instance is possible
      Specified by:
      validateUpdate in interface Updatable<AttributeSet>
      Parameters:
      other -
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(String name)
    • checkProtection

      public AttributeSet checkProtection()
    • reset

      public void reset()
    • attributeChanged

      public void attributeChanged(Attribute<Object> attribute, Object oldValue)
      Specified by:
      attributeChanged in interface AttributeListener<Object>
    • attributes

      public Collection<Attribute<?>> attributes()
    • isEmpty

      public boolean isEmpty()
    • fromProperties

      public TypedProperties fromProperties(TypedProperties properties, String prefix)
    • isRemoved

      public boolean isRemoved(String name, int major, int minor)
    • touch

      public void touch()
    • isTouched

      public boolean isTouched()