public class AttributeSet extends Object implements AttributeListener<Object>, Matchable<AttributeSet>
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.Constructor and Description |
---|
AttributeSet(Class<?> klass,
AttributeDefinition<?>... attributeDefinitions) |
AttributeSet(Class<?> klass,
AttributeSet attributeSet,
AttributeDefinition<?>... attributeDefinitions) |
AttributeSet(String name,
AttributeDefinition<?>... attributeDefinitions) |
AttributeSet(String name,
AttributeSet attributeSet,
AttributeDefinition<?>[] attributeDefinitions) |
Modifier and Type | Method and Description |
---|---|
<T> Attribute<T> |
attribute(AttributeDefinition<T> def)
Returns the attribute identified by the supplied
AttributeDefinition |
<T> Attribute<T> |
attribute(String name)
Returns the named attribute
|
void |
attributeChanged(Attribute<Object> attribute,
Object oldValue) |
Collection<Attribute<?>> |
attributes() |
AttributeSet |
checkProtection() |
<T> boolean |
contains(AttributeDefinition<T> def)
Returns whether this set contains the specified attribute definition
|
boolean |
contains(String name)
Returns whether this attribute set contains the specified named attribute
|
boolean |
equals(Object obj) |
Class<?> |
getKlass() |
String |
getName() |
int |
hashCode() |
boolean |
isEmpty() |
boolean |
isModified()
Returns whether any attributes in this set have been modified
|
boolean |
isProtected()
Returns whether this attribute set is protected
|
boolean |
matches(AttributeSet other) |
AttributeSet |
protect()
Returns a new ValueSet where immutable
Attribute s are write-protected |
void |
read(AttributeSet other)
Copies all attribute from another AttributeSet
|
void |
reset() |
String |
toString() |
String |
toString(String name) |
void |
write(XMLStreamWriter writer)
Writes the attributes of this attributeset as part of the current element
|
void |
write(XMLStreamWriter writer,
AttributeDefinition<?> def)
Writer a single attribute to the specified
XMLStreamWriter using the attribute's xmlName |
void |
write(XMLStreamWriter writer,
AttributeDefinition<?> def,
Enum<?> name)
Writer a single attribute to the specified
XMLStreamWriter using the supplied name |
void |
write(XMLStreamWriter writer,
AttributeDefinition<?> def,
String name)
Writer a single attribute to the specified
XMLStreamWriter using the supplied name |
void |
write(XMLStreamWriter writer,
String xmlElementName)
Writes this attributeset to the specified XMLStreamWriter as an element
|
void |
write(XMLStreamWriter writer,
String xmlElementName,
AttributeDefinition<?>... defs)
Writes the specified attributes in this attributeset to the specified XMLStreamWriter as an element
|
public AttributeSet(Class<?> klass, AttributeDefinition<?>... attributeDefinitions)
public AttributeSet(String name, AttributeDefinition<?>... attributeDefinitions)
public AttributeSet(Class<?> klass, AttributeSet attributeSet, AttributeDefinition<?>... attributeDefinitions)
public AttributeSet(String name, AttributeSet attributeSet, AttributeDefinition<?>[] attributeDefinitions)
public Class<?> getKlass()
public String getName()
public boolean contains(String name)
name
- the name of the attributepublic <T> boolean contains(AttributeDefinition<T> def)
def
- the AttributeDefinition
public <T> Attribute<T> attribute(String name)
name
- the name of the attribute to returnpublic <T> Attribute<T> attribute(AttributeDefinition<T> def)
AttributeDefinition
def
- the attribute definitionpublic void read(AttributeSet other)
other
- the source AttributeSetpublic AttributeSet protect()
Attribute
s are write-protectedpublic boolean isModified()
public boolean isProtected()
public void write(XMLStreamWriter writer, AttributeDefinition<?> def) throws XMLStreamException
XMLStreamWriter
using the attribute's xmlNamewriter
- the writerdef
- the Attribute definitionXMLStreamException
public void write(XMLStreamWriter writer, AttributeDefinition<?> def, Enum<?> name) throws XMLStreamException
XMLStreamWriter
using the supplied namewriter
- the writerdef
- the Attribute definitionname
- the XML tag name for the attributeXMLStreamException
public void write(XMLStreamWriter writer, AttributeDefinition<?> def, String name) throws XMLStreamException
XMLStreamWriter
using the supplied namewriter
- the writerdef
- the Attribute definitionname
- the XML tag name for the attributeXMLStreamException
public void write(XMLStreamWriter writer, String xmlElementName) throws XMLStreamException
writer
- XMLStreamException
public void write(XMLStreamWriter writer, String xmlElementName, AttributeDefinition<?>... defs) throws XMLStreamException
writer
- XMLStreamException
public void write(XMLStreamWriter writer) throws XMLStreamException
writer
- XMLStreamException
public boolean matches(AttributeSet other)
matches
in interface Matchable<AttributeSet>
public AttributeSet checkProtection()
public void reset()
public void attributeChanged(Attribute<Object> attribute, Object oldValue)
attributeChanged
in interface AttributeListener<Object>
public Collection<Attribute<?>> attributes()
public boolean isEmpty()
Copyright © 2021 JBoss by Red Hat. All rights reserved.