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
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
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAttributeSet(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 suppliedAttributeDefinitionvoidattributeChanged(Attribute<Object> attribute, Object oldValue) Collection<Attribute<?>>booleanReturns whether this attribute set contains the specified named attribute<T> booleancontains(AttributeDefinition<T> def) Returns whether this set contains the specified attribute definitionbooleanfromProperties(TypedProperties properties, String prefix) Class<?>getKlass()getName()inthashCode()booleanisEmpty()booleanReturns whether any attributes in this set have been modifiedbooleanReturns whether this attribute set is protectedbooleanbooleanbooleanmatches(AttributeSet other) protect()Returns a new ValueSet where immutableAttributes are write-protectedvoidread(AttributeSet other, Combine combine) Copies all attribute from another AttributeSet using the suppliedCombine.Attributesstrategy.voidreset()toString()voidtouch()voidupdate(String parentName, AttributeSet other) Updates the mutable part of this instance with the values of the other instancevoidvalidate()Validates theAttributevalues.voidvalidateUpdate(String parentName, AttributeSet other) Verifies that updating the mutable part of this instance with the values of the other instance is possiblevoidwrite(ConfigurationWriter writer) Writes the attributes of this attributeset as part of the current elementvoidwrite(ConfigurationWriter writer, Enum<?> name) Writes this attributeset to the specified ConfigurationWriter as an elementvoidwrite(ConfigurationWriter writer, String name) Writes this attributeset to the specified ConfigurationWriter as an elementvoidwrite(ConfigurationWriter writer, String persistentName, AttributeDefinition<?>... defs) Writes the specified attributes in this attributeset to the specified ConfigurationWriter as an elementvoidwrite(ConfigurationWriter writer, AttributeDefinition<?> def) Writer a single attribute to the specifiedConfigurationWriterusing the attribute's xmlNamevoidwrite(ConfigurationWriter writer, AttributeDefinition<?> def, Enum<?> name) Writer a single attribute to the specifiedConfigurationWriterusing the supplied namevoidwrite(ConfigurationWriter writer, AttributeDefinition<?> def, String name) Writer a single attribute to the specifiedConfigurationWriterusing 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.Attributesstrategy.- Parameters:
other- the source AttributeSetcombine- the attribute combine strategy
-
protect
Returns a new ValueSet where immutableAttributes 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 specifiedConfigurationWriterusing the attribute's xmlName- Parameters:
writer- the writerdef- the Attribute definition
-
write
Writer a single attribute to the specifiedConfigurationWriterusing the supplied name- Parameters:
writer- the writerdef- the Attribute definitionname- the XML tag name for the attribute
-
write
Writer a single attribute to the specifiedConfigurationWriterusing 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-
-
write
Writes the attributes of this attributeset as part of the current element- Parameters:
writer-
-
validate
public void validate()Validates theAttributevalues. -
hashCode
public int hashCode() -
equals
-
matches
- Specified by:
matchesin interfaceMatchable<AttributeSet>
-
update
Description copied from interface:UpdatableUpdates the mutable part of this instance with the values of the other instance- Specified by:
updatein interfaceUpdatable<AttributeSet>
-
validateUpdate
Description copied from interface:UpdatableVerifies that updating the mutable part of this instance with the values of the other instance is possible- Specified by:
validateUpdatein interfaceUpdatable<AttributeSet>
-
toString
-
toString
-
checkProtection
-
reset
public void reset() -
attributeChanged
- Specified by:
attributeChangedin interfaceAttributeListener<Object>
-
attributes
-
isEmpty
public boolean isEmpty() -
fromProperties
-
isRemoved
-
touch
public void touch() -
isTouched
public boolean isTouched()
-