Class AttributeSet
- java.lang.Object
-
- org.infinispan.commons.configuration.attributes.AttributeSet
-
- All Implemented Interfaces:
AttributeListener<java.lang.Object>,Matchable<AttributeSet>
public class AttributeSet extends java.lang.Object implements AttributeListener<java.lang.Object>, Matchable<AttributeSet>
AttributeSet is a container forAttributes. It is constructed by passing in a list ofAttributeDefinitions. AttributeSets are initially unprotected, which means that the contained attributes can be modified. If theprotect()method is invoked then only attributes which are notAttributeDefinition.isImmutable()can be modified from then on.- Since:
- 7.2
- Author:
- Tristan Tarrant
-
-
Constructor Summary
Constructors Constructor Description AttributeSet(java.lang.Class<?> klass, AttributeDefinition<?>... attributeDefinitions)AttributeSet(java.lang.Class<?> klass, AttributeSet attributeSet, AttributeDefinition<?>... attributeDefinitions)AttributeSet(java.lang.String name, AttributeDefinition<?>... attributeDefinitions)AttributeSet(java.lang.String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Attribute<T>attribute(java.lang.String name)Returns the named attribute<T> Attribute<T>attribute(AttributeDefinition<T> def)Returns the attribute identified by the suppliedAttributeDefinitionvoidattributeChanged(Attribute<java.lang.Object> attribute, java.lang.Object oldValue)java.util.Collection<Attribute<?>>attributes()AttributeSetcheckProtection()booleancontains(java.lang.String name)Returns whether this attribute set contains the specified named attribute<T> booleancontains(AttributeDefinition<T> def)Returns whether this set contains the specified attribute definitionbooleanequals(java.lang.Object obj)java.lang.Class<?>getKlass()java.lang.StringgetName()inthashCode()booleanisEmpty()booleanisModified()Returns whether any attributes in this set have been modifiedbooleanisProtected()Returns whether this attribute set is protectedbooleanmatches(AttributeSet other)AttributeSetprotect()Returns a new ValueSet where immutableAttributes are write-protectedvoidread(AttributeSet other)Copies all attribute from another AttributeSetvoidreset()java.lang.StringtoString()java.lang.StringtoString(java.lang.String name)voidwrite(javax.xml.stream.XMLStreamWriter writer)Writes the attributes of this attributeset as part of the current elementvoidwrite(javax.xml.stream.XMLStreamWriter writer, java.lang.String xmlElementName)Writes this attributeset to the specified XMLStreamWriter as an elementvoidwrite(javax.xml.stream.XMLStreamWriter writer, java.lang.String xmlElementName, AttributeDefinition<?>... defs)Writes the specified attributes in this attributeset to the specified XMLStreamWriter as an elementvoidwrite(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def)Writer a single attribute to the specifiedXMLStreamWriterusing the attribute's xmlNamevoidwrite(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def, java.lang.Enum<?> name)Writer a single attribute to the specifiedXMLStreamWriterusing the supplied namevoidwrite(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def, java.lang.String name)Writer a single attribute to the specifiedXMLStreamWriterusing the supplied name
-
-
-
Constructor Detail
-
AttributeSet
public AttributeSet(java.lang.Class<?> klass, AttributeDefinition<?>... attributeDefinitions)
-
AttributeSet
public AttributeSet(java.lang.String name, AttributeDefinition<?>... attributeDefinitions)
-
AttributeSet
public AttributeSet(java.lang.Class<?> klass, AttributeSet attributeSet, AttributeDefinition<?>... attributeDefinitions)
-
AttributeSet
public AttributeSet(java.lang.String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions)
-
-
Method Detail
-
getKlass
public java.lang.Class<?> getKlass()
-
getName
public java.lang.String getName()
-
contains
public boolean contains(java.lang.String name)
Returns whether this attribute set contains the specified named attribute- Parameters:
name- the name of the attribute
-
contains
public <T> boolean contains(AttributeDefinition<T> def)
Returns whether this set contains the specified attribute definition- Parameters:
def- theAttributeDefinition
-
attribute
public <T> Attribute<T> attribute(java.lang.String name)
Returns the named attribute- Parameters:
name- the name of the attribute to return- Returns:
- the attribute
-
attribute
public <T> Attribute<T> attribute(AttributeDefinition<T> def)
Returns the attribute identified by the suppliedAttributeDefinition- Parameters:
def- the attribute definition- Returns:
- the attribute
-
read
public void read(AttributeSet other)
Copies all attribute from another AttributeSet- Parameters:
other- the source AttributeSet
-
protect
public AttributeSet 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
public void write(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def) throws javax.xml.stream.XMLStreamExceptionWriter a single attribute to the specifiedXMLStreamWriterusing the attribute's xmlName- Parameters:
writer- the writerdef- the Attribute definition- Throws:
javax.xml.stream.XMLStreamException
-
write
public void write(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def, java.lang.Enum<?> name) throws javax.xml.stream.XMLStreamExceptionWriter a single attribute to the specifiedXMLStreamWriterusing the supplied name- Parameters:
writer- the writerdef- the Attribute definitionname- the XML tag name for the attribute- Throws:
javax.xml.stream.XMLStreamException
-
write
public void write(javax.xml.stream.XMLStreamWriter writer, AttributeDefinition<?> def, java.lang.String name) throws javax.xml.stream.XMLStreamExceptionWriter a single attribute to the specifiedXMLStreamWriterusing the supplied name- Parameters:
writer- the writerdef- the Attribute definitionname- the XML tag name for the attribute- Throws:
javax.xml.stream.XMLStreamException
-
write
public void write(javax.xml.stream.XMLStreamWriter writer, java.lang.String xmlElementName) throws javax.xml.stream.XMLStreamExceptionWrites this attributeset to the specified XMLStreamWriter as an element- Parameters:
writer-- Throws:
javax.xml.stream.XMLStreamException
-
write
public void write(javax.xml.stream.XMLStreamWriter writer, java.lang.String xmlElementName, AttributeDefinition<?>... defs) throws javax.xml.stream.XMLStreamExceptionWrites the specified attributes in this attributeset to the specified XMLStreamWriter as an element- Parameters:
writer-- Throws:
javax.xml.stream.XMLStreamException
-
write
public void write(javax.xml.stream.XMLStreamWriter writer) throws javax.xml.stream.XMLStreamExceptionWrites the attributes of this attributeset as part of the current element- Parameters:
writer-- Throws:
javax.xml.stream.XMLStreamException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
matches
public boolean matches(AttributeSet other)
- Specified by:
matchesin interfaceMatchable<AttributeSet>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String name)
-
checkProtection
public AttributeSet checkProtection()
-
reset
public void reset()
-
attributeChanged
public void attributeChanged(Attribute<java.lang.Object> attribute, java.lang.Object oldValue)
- Specified by:
attributeChangedin interfaceAttributeListener<java.lang.Object>
-
attributes
public java.util.Collection<Attribute<?>> attributes()
-
isEmpty
public boolean isEmpty()
-
-