Class AttributeSet
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
Attribute
s. It is constructed by passing in a list of
AttributeDefinition
s. 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
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAttributeSet
(Class<?> klass, Enum<?> name, AttributeDefinition<?>... attributeDefinitions) AttributeSet
(Class<?> klass, String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) AttributeSet
(Class<?> klass, String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions, AttributeSet.RemovedAttribute[] removedAttributes) AttributeSet
(Class<?> klass, AttributeDefinition<?>... attributeDefinitions) AttributeSet
(Class<?> klass, AttributeSet attributeSet, AttributeDefinition<?>... attributeDefinitions) AttributeSet
(String name, AttributeDefinition<?>... attributeDefinitions) AttributeSet
(String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) -
Method Summary
Modifier and TypeMethodDescription<T> Attribute
<T> Returns the named attribute<T> Attribute
<T> Returns the named attribute<T> Attribute
<T> attribute
(AttributeDefinition<T> def) Returns the attribute identified by the suppliedAttributeDefinition
void
attributeChanged
(Attribute<Object> attribute, Object oldValue) Collection
<Attribute<?>> boolean
Returns whether this attribute set contains the specified named attribute<T> boolean
contains
(AttributeDefinition<T> def) Returns whether this set contains the specified attribute definitionboolean
fromProperties
(TypedProperties properties, String prefix) Class
<?> getKlass()
getName()
int
hashCode()
boolean
isEmpty()
boolean
Returns whether any attributes in this set have been modifiedboolean
Returns whether this attribute set is protectedboolean
boolean
boolean
matches
(AttributeSet other) protect()
Returns a new ValueSet where immutableAttribute
s are write-protectedvoid
read
(AttributeSet other, Combine combine) Copies all attribute from another AttributeSet using the suppliedCombine.Attributes
strategy.void
reset()
toString()
void
touch()
void
update
(String parentName, AttributeSet other) Updates the mutable part of this instance with the values of the other instancevoid
validate()
Validates theAttribute
values.void
validateUpdate
(String parentName, AttributeSet other) Verifies that updating the mutable part of this instance with the values of the other instance is possiblevoid
write
(ConfigurationWriter writer) Writes the attributes of this attributeset as part of the current elementvoid
write
(ConfigurationWriter writer, Enum<?> name) Writes this attributeset to the specified ConfigurationWriter as an elementvoid
write
(ConfigurationWriter writer, String name) Writes this attributeset to the specified ConfigurationWriter as an elementvoid
write
(ConfigurationWriter writer, String persistentName, AttributeDefinition<?>... defs) Writes the specified attributes in this attributeset to the specified ConfigurationWriter as an elementvoid
write
(ConfigurationWriter writer, AttributeDefinition<?> def) Writer a single attribute to the specifiedConfigurationWriter
using the attribute's xmlNamevoid
write
(ConfigurationWriter writer, AttributeDefinition<?> def, Enum<?> name) Writer a single attribute to the specifiedConfigurationWriter
using the supplied namevoid
write
(ConfigurationWriter writer, AttributeDefinition<?> def, String name) Writer a single attribute to the specifiedConfigurationWriter
using the supplied name
-
Field Details
-
EMPTY
-
-
Constructor Details
-
AttributeSet
-
AttributeSet
-
AttributeSet
public AttributeSet(Class<?> klass, AttributeSet attributeSet, AttributeDefinition<?>... attributeDefinitions) -
AttributeSet
public AttributeSet(String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) -
AttributeSet
-
AttributeSet
public AttributeSet(Class<?> klass, String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions) -
AttributeSet
public AttributeSet(Class<?> klass, String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions, AttributeSet.RemovedAttribute[] removedAttributes)
-
-
Method Details
-
getKlass
-
getName
-
contains
Returns whether this attribute set contains the specified named attribute- Parameters:
name
- the name of the attribute
-
contains
Returns whether this set contains the specified attribute definition- Parameters:
def
- theAttributeDefinition
-
attribute
Returns the named attribute- Parameters:
name
- the name of the attribute to return- Returns:
- the attribute
-
attribute
Returns the named attribute- Parameters:
name
- the name of the attribute to return- Returns:
- the attribute
-
attribute
Returns the attribute identified by the suppliedAttributeDefinition
- Parameters:
def
- the attribute definition- Returns:
- the attribute
-
read
Copies all attribute from another AttributeSet using the suppliedCombine.Attributes
strategy.- Parameters:
other
- the source AttributeSetcombine
- the attribute combine strategy
-
protect
Returns a new ValueSet where immutableAttribute
s 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
Writer a single attribute to the specifiedConfigurationWriter
using the attribute's xmlName- Parameters:
writer
- the writerdef
- the Attribute definition
-
write
Writer a single attribute to the specifiedConfigurationWriter
using the supplied name- Parameters:
writer
- the writerdef
- the Attribute definitionname
- the XML tag name for the attribute
-
write
Writer a single attribute to the specifiedConfigurationWriter
using the supplied name- Parameters:
writer
- the writerdef
- the Attribute definitionname
- the XML tag name for the attribute
-
write
Writes this attributeset to the specified ConfigurationWriter as an element- Parameters:
writer
-
-
write
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
- theConfigurationWriter
persistentName
- the name the attribute should have in its persistent formdefs
- the attributes that should be written
-
write
Writes the attributes of this attributeset as part of the current element- Parameters:
writer
-
-
validate
public void validate()Validates theAttribute
values. -
hashCode
public int hashCode() -
equals
-
matches
- Specified by:
matches
in interfaceMatchable<AttributeSet>
-
update
Description copied from interface:Updatable
Updates the mutable part of this instance with the values of the other instance- Specified by:
update
in interfaceUpdatable<AttributeSet>
- Parameters:
other
-
-
validateUpdate
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 interfaceUpdatable<AttributeSet>
- Parameters:
other
-
-
toString
-
toString
-
checkProtection
-
reset
public void reset() -
attributeChanged
- Specified by:
attributeChanged
in interfaceAttributeListener<Object>
-
attributes
-
isEmpty
public boolean isEmpty() -
fromProperties
-
isRemoved
-
touch
public void touch() -
isTouched
public boolean isTouched()
-