Class Attribute<T>
- java.lang.Object
-
- org.infinispan.commons.configuration.attributes.Attribute<T>
-
public final class Attribute<T> extends Object implements Cloneable, Matchable<Attribute<?>>
Attribute. This class implements a configuration attribute value holder. A configuration attribute is defined by anAttributeDefinition
. 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(AttributeListener<T> listener)
<K> K
asObject()
protected Attribute<T>
clone()
boolean
equals(Object obj)
T
get()
AttributeDefinition<T>
getAttributeDefinition()
T
getInitialValue()
int
hashCode()
boolean
isImmutable()
boolean
isModified()
boolean
isNull()
boolean
isPersistent()
boolean
matches(Attribute<?> other)
Compares this attribute to another attribute taking into account theAttributeDefinition.isGlobal()
flag.String
name()
Attribute<T>
protect()
void
read(Attribute<T> other)
void
removeListener(AttributeListener<T> listener)
void
reset()
void
set(T value)
String
toString()
void
validate()
-
-
-
Field Detail
-
value
protected T value
-
-
Method Detail
-
name
public String name()
-
get
public T get()
-
getInitialValue
public T getInitialValue()
-
validate
public void validate()
-
set
public void set(T value)
-
isImmutable
public boolean isImmutable()
-
isPersistent
public boolean isPersistent()
-
isModified
public boolean isModified()
-
asObject
public <K> K asObject()
-
addListener
public void addListener(AttributeListener<T> listener)
-
removeListener
public void removeListener(AttributeListener<T> listener)
-
isNull
public boolean isNull()
-
getAttributeDefinition
public AttributeDefinition<T> getAttributeDefinition()
-
matches
public boolean matches(Attribute<?> other)
Compares this attribute to another attribute taking into account theAttributeDefinition.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.
-
reset
public void reset()
-
-