public class AttributeContainerMutable extends java.lang.Object implements AttributeContainer
Constructor and Description |
---|
AttributeContainerMutable(java.lang.String name)
Constructor with container name.
|
AttributeContainerMutable(java.lang.String name,
java.lang.Iterable<Attribute> from)
Constructor with container name and list of Attributes to copy in.
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(java.lang.Iterable<Attribute> atts)
Add all; replace old if has same name.
|
Attribute |
addAttribute(Attribute att)
Add new or replace old if has same name
|
Attribute |
addAttribute(java.lang.String name,
java.lang.Number value)
Add Attribute; name and value must not be null.
|
Attribute |
addAttribute(java.lang.String name,
java.lang.String value)
Add Attribute; name and value must not be null.
|
static AttributeContainerMutable |
copyFrom(AttributeContainer from)
Create mutable from immutable container.
|
Attribute |
findAttribute(java.lang.String name)
Find an Attribute by exact match on name.
|
double |
findAttributeDouble(java.lang.String attName,
double defaultValue)
Find a Numeric Attribute by name (ignore case), return the double value of the Attribute.
|
Attribute |
findAttributeIgnoreCase(java.lang.String name)
Find an Attribute by name, first doing an exact match, then ignoring case.
|
int |
findAttributeInteger(java.lang.String attName,
int defaultValue)
Find a Numeric Attribute by name (ignore case), return the integer value of the Attribute.
|
java.lang.String |
findAttributeString(java.lang.String attName,
java.lang.String defaultValue)
Find a String Attribute by name (ignore case), return the String value of the Attribute.
|
java.util.List<Attribute> |
getAttributes()
Returns immutable list of attributes.
|
java.lang.String |
getName()
Get the (optional) name of the AttributeContainer.
|
boolean |
isEmpty()
True is there are no attributes in the container.
|
boolean |
remove(Attribute a)
Remove an Attribute : uses the attribute hashCode to find it.
|
boolean |
removeAttribute(java.lang.String attName)
Remove an Attribute by name.
|
boolean |
removeAttributeIgnoreCase(java.lang.String attName)
Remove an Attribute by name, ignoring case
|
void |
replace(Attribute a,
java.lang.String newName)
Replace an Attribute with a different name, same value.
|
void |
setName(java.lang.String name) |
AttributeContainer |
toImmutable()
Turn into an immutable AttributeContainer
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
filter, hasAttribute, hasAttributeIgnoreCase, iterator
public AttributeContainerMutable(@Nullable java.lang.String name)
public AttributeContainerMutable(@Nullable java.lang.String name, java.lang.Iterable<Attribute> from)
public void addAll(java.lang.Iterable<Attribute> atts)
addAll
in interface AttributeContainer
public Attribute addAttribute(Attribute att)
AttributeContainer
addAttribute
in interface AttributeContainer
att
- add this Attributepublic Attribute addAttribute(java.lang.String name, java.lang.Number value)
public Attribute addAttribute(java.lang.String name, java.lang.String value)
public static AttributeContainerMutable copyFrom(@Nullable AttributeContainer from)
public Attribute findAttribute(java.lang.String name)
AttributeContainer
findAttribute
in interface AttributeContainer
public double findAttributeDouble(java.lang.String attName, double defaultValue)
AttributeContainer
findAttributeDouble
in interface AttributeContainer
public Attribute findAttributeIgnoreCase(java.lang.String name)
AttributeContainer
findAttributeIgnoreCase
in interface AttributeContainer
public int findAttributeInteger(java.lang.String attName, int defaultValue)
AttributeContainer
findAttributeInteger
in interface AttributeContainer
public java.lang.String findAttributeString(java.lang.String attName, java.lang.String defaultValue)
AttributeContainer
findAttributeString
in interface AttributeContainer
public java.util.List<Attribute> getAttributes()
AttributeContainer
getAttributes
in interface AttributeContainer
@Nullable public java.lang.String getName()
AttributeContainer
getName
in interface AttributeContainer
public boolean isEmpty()
AttributeContainer
isEmpty
in interface AttributeContainer
public boolean remove(Attribute a)
remove
in interface AttributeContainer
a
- remove this attributepublic boolean removeAttribute(java.lang.String attName)
removeAttribute
in interface AttributeContainer
attName
- if exists, remove this attributepublic boolean removeAttributeIgnoreCase(java.lang.String attName)
removeAttributeIgnoreCase
in interface AttributeContainer
attName
- if exists, remove this attributepublic void replace(Attribute a, java.lang.String newName)
a
- remove this attributepublic void setName(@Nullable java.lang.String name)
public AttributeContainer toImmutable()