| Modifier and Type | Class and Description |
|---|---|
static class |
OneAttributeElement.AttributeChangeEvent |
| Constructor and Description |
|---|
OneAttributeElement(String id)
New element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String attribute,
Object value) |
void |
addAttributes(Map<String,Object> attributes)
Add or replace each attribute found in attributes.
|
void |
changeAttribute(String attribute,
Object value) |
void |
clearAttributes()
Remove all registered attributes.
|
<T> T |
getAttribute(String key)
Get the attribute object bound to the given key.
|
<T> T |
getAttribute(String key,
Class<T> clazz)
Get the attribute object bound to the given key if it is an instance of
the given class.
|
Iterator<String> |
getAttributeKeyIterator()
Iterator on all attributes keys.
|
Map<String,Object> |
getAttributeMap() |
<T> T |
getFirstAttributeOf(Class<T> clazz,
String... keys)
Like
Element.getAttribute(String, Class), but returns the first existing
attribute in a list of keys, instead of only one key. |
<T> T |
getFirstAttributeOf(String... keys)
Like
Element.getAttribute(String), but returns the first existing
attribute in a list of keys, instead of only one key. |
String |
getId()
Unique identifier of this element.
|
CharSequence |
getLabel(String key)
Get the label string bound to the given key key.
|
double |
getNumber(String key)
Get the number bound to key.
|
ArrayList<? extends Number> |
getVector(String key)
Get the vector of number bound to key.
|
boolean |
hasAttribute(String key)
Does this element store a value for the given attribute key?
|
boolean |
hasAttribute(String key,
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(String key)
Does this element store a label value for the given key?
|
boolean |
hasNumber(String key)
Does this element store a number for the given key?
|
boolean |
hasVector(String key)
Does this element store a vector value for the given key?
|
void |
removeAttribute(String attribute)
Remove an attribute.
|
String |
toString()
Override the Object method
|
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddAttribute, changeAttribute, getArray, getAttributeCount, getAttributeKeySet, getEachAttributeKey, getHash, getIndex, hasArray, hasHash, setAttributepublic OneAttributeElement(String id)
id - The unique identifier of this element.public String getId()
Elementpublic <T> T getAttribute(String key)
ElementgetAttribute in interface Elementkey - Name of the attribute to search.public <T> T getFirstAttributeOf(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(String key, Class<T> clazz)
ElementgetAttribute in interface Elementkey - The attribute name to search.clazz - The expected attribute class.public <T> T getFirstAttributeOf(Class<T> clazz, 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 CharSequence getLabel(String key)
Elementpublic double getNumber(String key)
Elementpublic ArrayList<? extends Number> getVector(String key)
Elementpublic boolean hasAttribute(String key)
ElementhasAttribute in interface Elementkey - The name of the attribute to search.public boolean hasAttribute(String key, Class<?> clazz)
ElementhasAttribute in interface Elementkey - The name of the attribute to search.clazz - The expected class of the attribute value.public boolean hasLabel(String key)
Elementpublic boolean hasNumber(String key)
Elementpublic boolean hasVector(String key)
Elementpublic Iterator<String> getAttributeKeyIterator()
ElementgetAttributeKeyIterator in interface Elementpublic void clearAttributes()
ElementclearAttributes in interface Elementpublic void addAttributes(Map<String,Object> attributes)
ElementaddAttributes in interface Elementattributes - A set of (key,value) pairs.public void removeAttribute(String attribute)
ElementremoveAttribute in interface Elementattribute - Name of the attribute to remove.Copyright © 2015. All rights reserved.