public class AttributeContainerMutable extends Object implements AttributeContainer
| Constructor and Description |
|---|
AttributeContainerMutable(String name)
Constructor with container name.
|
AttributeContainerMutable(String name,
Iterable<Attribute> from)
Constructor with container name and list of Attributes to copy in.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Iterable<Attribute> atts)
Add all; replace old if has same name.
|
Attribute |
addAttribute(Attribute att)
Add an attribute to the container.
|
Attribute |
addAttribute(String name,
Number value)
Add Attribute; name and value must not be null.
|
Attribute |
addAttribute(String name,
String value)
Add Attribute; name and value must not be null.
|
AttributeContainerMutable |
clear() |
static AttributeContainerMutable |
copyFrom(AttributeContainer from)
Create mutable from immutable container.
|
Attribute |
findAttribute(String name)
Find an Attribute by exact match on name.
|
double |
findAttributeDouble(String attName,
double defaultValue)
Find a Numeric Attribute by name (ignore case), return the double value of the Attribute.
|
Attribute |
findAttributeIgnoreCase(String name)
Find an Attribute by name, first doing an exact match, then ignoring case.
|
int |
findAttributeInteger(String attName,
int defaultValue)
Find a Numeric Attribute by name (ignore case), return the integer value of the Attribute.
|
String |
findAttributeString(String attName,
String defaultValue)
Find a String Attribute by name (ignore case), return the String value of the Attribute.
|
String |
getName()
Get the (optional) name of the AttributeContainer.
|
boolean |
isEmpty()
True if there are no attributes in the container.
|
Iterator<Attribute> |
iterator()
An unordered iterator over the contained attributes.
|
boolean |
remove(Attribute a)
Remove an Attribute : uses the attribute hashCode to find it.
|
boolean |
removeAttribute(String attName)
Remove an Attribute by name.
|
boolean |
removeAttributeIgnoreCase(String attName)
Remove an Attribute by name, ignoring case
|
boolean |
replace(Attribute a,
String newName)
Replace an Attribute with a different name, same value.
|
AttributeContainerMutable |
setName(String name) |
AttributeContainer |
toImmutable()
Turn into an immutable AttributeContainer
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfilter, hasAttribute, hasAttributeIgnoreCaseforEach, spliteratorpublic AttributeContainerMutable(@Nullable String name)
public static AttributeContainerMutable copyFrom(@Nullable AttributeContainer from)
public AttributeContainerMutable setName(@Nullable String name)
@Nullable public String getName()
AttributeContainergetName in interface AttributeContainerpublic Iterator<Attribute> iterator()
AttributeContaineriterator in interface Iterable<Attribute>iterator in interface AttributeContainerpublic Attribute addAttribute(Attribute att)
public Attribute addAttribute(String name, String value)
public Attribute addAttribute(String name, Number value)
public String findAttributeString(String attName, String defaultValue)
AttributeContainerfindAttributeString in interface AttributeContainerpublic Attribute findAttribute(String name)
AttributeContainerfindAttribute in interface AttributeContainerpublic Attribute findAttributeIgnoreCase(String name)
AttributeContainerfindAttributeIgnoreCase in interface AttributeContainerpublic double findAttributeDouble(String attName, double defaultValue)
AttributeContainerfindAttributeDouble in interface AttributeContainerpublic int findAttributeInteger(String attName, int defaultValue)
AttributeContainerfindAttributeInteger in interface AttributeContainerpublic boolean remove(Attribute a)
a - remove this attributepublic boolean replace(Attribute a, String newName)
a - remove this attributepublic AttributeContainerMutable clear()
public boolean removeAttribute(String attName)
attName - if exists, remove this attributepublic boolean removeAttributeIgnoreCase(String attName)
attName - if exists, remove this attributepublic AttributeContainer toImmutable()
public boolean isEmpty()
AttributeContainerisEmpty in interface AttributeContainer