java.lang.Object
org.infinispan.commons.configuration.attributes.Attribute<T>
All Implemented Interfaces:
Cloneable, Matchable<Attribute<?>>, Updatable<Attribute<T>>

public final class Attribute<T> extends Object implements Cloneable, Matchable<Attribute<?>>, Updatable<Attribute<T>>
Attribute. This class implements a configuration attribute value holder. A configuration attribute is defined by an AttributeDefinition. An attribute contains an optional value (or defers to its AttributeDefinition for the default value). It is possible to determine whether a value has been changed with respect to its initial value. An Attribute remains modifiable until it is protected. At which point it can only be modified if its AttributeDefinition allows it to be mutable. Additionally it is possible to register listeners when values change so that code can react to these changes.
Since:
7.2
Author:
Tristan Tarrant
  • Method Details Link icon

    • name Link icon

      public String name()
    • get Link icon

      public T get()
    • orElse Link icon

      public T orElse(T other)
    • getInitialValue Link icon

      public T getInitialValue()
    • validate Link icon

      public void validate()
    • protect Link icon

      public Attribute<T> protect()
    • set Link icon

      public Attribute<T> set(T value)
    • setImplied Link icon

      public Attribute<T> setImplied(T value)
    • fromString Link icon

      public Attribute<T> fromString(String value)
    • computeIfAbsent Link icon

      public T computeIfAbsent(Supplier<T> supplier)
    • isImmutable Link icon

      public boolean isImmutable()
    • isPersistent Link icon

      public boolean isPersistent()
    • isModified Link icon

      public boolean isModified()
    • isRepeated Link icon

      public boolean isRepeated()
    • addListener Link icon

      public Attribute<T> addListener(AttributeListener<T> listener)
    • removeListener Link icon

      public Attribute<T> removeListener(AttributeListener<T> listener)
    • removeListener Link icon

      public Attribute<T> removeListener(Predicate<AttributeListener<T>> filter)
    • isNull Link icon

      public boolean isNull()
    • getAttributeDefinition Link icon

      public AttributeDefinition<T> getAttributeDefinition()
    • clone Link icon

      protected Attribute<T> clone()
      Overrides:
      clone in class Object
    • read Link icon

      public Attribute<T> read(Attribute<T> other)
    • merge Link icon

      public Attribute<T> merge(Attribute<T> other)
    • hashCode Link icon

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

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

      public boolean matches(Attribute<?> other)
      Compares this attribute to another attribute taking into account the AttributeDefinition.isGlobal() flag. If the attribute is global, then this method will return true only if the values are identical. If the attribute is local, then this method will return true even if the values don't match. Essentially, this method only ensures that the attribute definitions are equals.
      Specified by:
      matches in interface Matchable<T>
      Parameters:
      other -
      Returns:
    • update Link icon

      public void update(String elementName, Attribute<T> other)
      Updates this attribute with the value of the other attribute only if the attribute is mutable and the other has been modified from its default value
      Specified by:
      update in interface Updatable<T>
      Parameters:
      other -
    • validateUpdate Link icon

      public void validateUpdate(String parentName, Attribute<T> 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<T>
      Parameters:
      other -
    • apply Link icon

      public void apply(Consumer<T> consumer)
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • reset Link icon

      public Attribute<T> reset()