public interface Attributes extends Cloneable
Modifier and Type | Method and Description |
---|---|
boolean |
castAndPut(Element e,
String k,
String v)
Put a value but try to cast into to a supported primitive if possible.
|
void |
clear()
Remove all the attributes.
|
void |
clear(Element e)
Remove all the attributes of a given element.
|
Attributes |
clone()
Clone the attributes.
|
Object |
get(Element e,
String k)
Get an attribute value as a simple Object.
|
Boolean |
getBoolean(Element e,
String k)
Get an attribute value as a boolean.
|
Set<Element> |
getDefined()
Get the elements having attributes defined.
|
Double |
getDouble(Element e,
String k)
Get an attribute value as a double.
|
Integer |
getInteger(Element e,
String k)
Get an attribute value as an integer.
|
Set<String> |
getKeys(Element e)
Get all the attributes keys that are registered.
|
String |
getString(Element e,
String k)
Get an attribute value as a string.
|
boolean |
isSet(Element e,
String k)
Check if an attribute is set for a given element.
|
boolean |
put(Element e,
String k,
boolean b)
Put a boolean value.
|
boolean |
put(Element e,
String k,
double d)
Put a double value.
|
boolean |
put(Element e,
String k,
int d)
Put an integer value.
|
boolean |
put(Element e,
String k,
String s)
Put a String value.
|
boolean |
unset(Element e,
String k)
Unset an attribute for a given element.
|
boolean put(Element e, String k, boolean b)
e
- the elementk
- the attribute identifierb
- the value to settrue
if a previous value was overriddenboolean put(Element e, String k, String s)
e
- the elementk
- the attribute identifiers
- the value to settrue
if a previous value was overriddenboolean put(Element e, String k, double d)
e
- the elementk
- the attribute identifierd
- the value to settrue
if a previous value was overriddenboolean put(Element e, String k, int d)
e
- the elementk
- the attribute identifierd
- the value to settrue
if a previous value was overriddenObject get(Element e, String k)
e
- the elementk
- the attribute valuenull
otherwiseBoolean getBoolean(Element e, String k)
e
- the elementk
- the attribute valuenull
otherwiseString getString(Element e, String k)
e
- the elementk
- the attribute valuenull
otherwiseDouble getDouble(Element e, String k)
e
- the elementk
- the attribute valuenull
otherwiseInteger getInteger(Element e, String k)
e
- the elementk
- the attribute valuenull
otherwiseboolean isSet(Element e, String k)
e
- the elementk
- the attribute identifiertrue
iff the attribute is setboolean unset(Element e, String k)
e
- the elementk
- the attribute identifiertrue
iff a value was removedAttributes clone()
Set<Element> getDefined()
Set<String> getKeys(Element e)
e
- the elementboolean castAndPut(Element e, String k, String v)
v
first to a boolean, then to a integer value,
finally to a double value. If none of the cast succeeded, the value is let
as a string.e
- the elementk
- the attribute identifierv
- the value to settrue
if a previous value was overriddenvoid clear()
void clear(Element e)
e
- the elementCopyright © 2015 University of Nice-Sophia Antipolis. All Rights Reserved.