Class Attribute<T>

  • All Implemented Interfaces:
    java.lang.Cloneable, Matchable<Attribute<?>>

    public final class Attribute<T>
    extends java.lang.Object
    implements java.lang.Cloneable, Matchable<Attribute<?>>
    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.
    Tristan Tarrant
    • Field Detail

      • value

        protected T value
    • Method Detail

      • name

        public java.lang.String name()
      • get

        public T get()
      • getInitialValue

        public T getInitialValue()
      • validate

        public void validate()
      • set

        public void set​(T value)
      • computeIfAbsent

        public T computeIfAbsent​(java.util.function.Supplier<T> supplier)
      • isImmutable

        public boolean isImmutable()
      • isPersistent

        public boolean isPersistent()
      • isModified

        public boolean isModified()
      • asObject

        public <K> K asObject()
      • isNull

        public boolean isNull()
      • clone

        protected Attribute<T> clone()
        clone in class java.lang.Object
      • hashCode

        public int hashCode()
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        equals in class java.lang.Object
      • matches

        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>
        other -
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • reset

        public void reset()