| Modifier and Type | Class and Description |
|---|---|
static class |
OneAttributeElement.AttributeChangeEvent |
| Constructor and Description |
|---|
OneAttributeElement(java.lang.String id)
New element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(java.lang.String attribute,
java.lang.Object value) |
void |
changeAttribute(java.lang.String attribute,
java.lang.Object value) |
void |
clearAttributes()
Remove all registered attributes.
|
java.lang.Object |
getAttribute(java.lang.String key)
Get the attribute object bound to the given key.
|
<T> T |
getAttribute(java.lang.String key,
java.lang.Class<T> clazz)
Get the attribute object bound to the given key if it is an instance of the
given class.
|
java.util.Iterator<java.lang.String> |
getAttributeKeyIterator() |
java.util.Map<java.lang.String,java.lang.Object> |
getAttributeMap() |
<T> T |
getFirstAttributeOf(java.lang.Class<T> clazz,
java.lang.String... keys)
Like
Element.getAttribute(String, Class), but returns the first existing
attribute in a list of keys, instead of only one key. |
java.lang.Object |
getFirstAttributeOf(java.lang.String... keys)
Like
Element.getAttribute(String), but returns the first existing attribute
in a list of keys, instead of only one key. |
java.lang.String |
getId()
Unique identifier of this element.
|
java.lang.CharSequence |
getLabel(java.lang.String key)
Get the label string bound to the given key key.
|
double |
getNumber(java.lang.String key)
Get the number bound to key.
|
java.util.ArrayList<? extends java.lang.Number> |
getVector(java.lang.String key)
Get the vector of number bound to key.
|
boolean |
hasAttribute(java.lang.String key)
Does this element store a value for the given attribute key?
|
boolean |
hasAttribute(java.lang.String key,
java.lang.Class<?> clazz)
Does this element store a value for the given attribute key and this value is
an instance of the given class?
|
boolean |
hasLabel(java.lang.String key)
Does this element store a label value for the given key?
|
boolean |
hasNumber(java.lang.String key)
Does this element store a number for the given key?
|
boolean |
hasVector(java.lang.String key)
Does this element store a vector value for the given key?
|
void |
removeAttribute(java.lang.String attribute)
Remove an attribute.
|
void |
setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Add or replace each attribute found in attributes.
|
java.lang.String |
toString()
Override the Object method
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitattributeKeys, getArray, getAttributeCount, getIndex, getMap, hasArray, hasMap, setAttributepublic OneAttributeElement(java.lang.String id)
id - The unique identifier of this element.public java.lang.String getId()
Elementpublic java.lang.Object getAttribute(java.lang.String key)
ElementgetAttribute in interface Elementkey - Name of the attribute to search.public java.lang.Object getFirstAttributeOf(java.lang.String... keys)
ElementElement.getAttribute(String), but returns the first existing attribute
in a list of keys, instead of only one key. The key list order matters.getFirstAttributeOf in interface Elementkeys - Several strings naming attributes.public <T> T getAttribute(java.lang.String key,
java.lang.Class<T> clazz)
ElementgetAttribute in interface Elementkey - The attribute name to search.clazz - The expected attribute class.public <T> T getFirstAttributeOf(java.lang.Class<T> clazz,
java.lang.String... keys)
ElementElement.getAttribute(String, Class), but returns the first existing
attribute in a list of keys, instead of only one key. The key list order
matters.getFirstAttributeOf in interface Elementclazz - The class the attribute must be instance of.keys - Several string naming attributes.public java.lang.CharSequence getLabel(java.lang.String key)
Elementpublic double getNumber(java.lang.String key)
Elementpublic java.util.ArrayList<? extends java.lang.Number> getVector(java.lang.String key)
ElementList of Number
objects.public boolean hasAttribute(java.lang.String key)
ElementhasAttribute in interface Elementkey - The name of the attribute to search.public boolean hasAttribute(java.lang.String key,
java.lang.Class<?> clazz)
ElementhasAttribute in interface Elementkey - The name of the attribute to search.clazz - The expected class of the attribute value.public boolean hasLabel(java.lang.String key)
Elementpublic boolean hasNumber(java.lang.String key)
Elementpublic boolean hasVector(java.lang.String key)
Elementpublic java.util.Iterator<java.lang.String> getAttributeKeyIterator()
public java.util.Map<java.lang.String,java.lang.Object> getAttributeMap()
public java.lang.String toString()
toString in class java.lang.Objectpublic void clearAttributes()
ElementclearAttributes in interface Elementpublic void addAttribute(java.lang.String attribute,
java.lang.Object value)
public void changeAttribute(java.lang.String attribute,
java.lang.Object value)
public void setAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
ElementsetAttributes in interface Elementattributes - A set of (key,value) pairs.public void removeAttribute(java.lang.String attribute)
ElementremoveAttribute in interface Elementattribute - Name of the attribute to remove.