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 new or replace old if has same name
|
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.
|
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.
|
List<Attribute> |
getAttributes()
Returns immutable list of attributes.
|
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(String attName)
Remove an Attribute by name.
|
boolean |
removeAttributeIgnoreCase(String attName)
Remove an Attribute by name, ignoring case
|
void |
replace(Attribute a,
String newName)
Replace an Attribute with a different name, same value.
|
void |
setName(String name) |
AttributeContainer |
toImmutable()
Turn into an immutable AttributeContainer
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
filter, hasAttribute, hasAttributeIgnoreCase, iterator
forEach, spliterator
public AttributeContainerMutable(@Nullable String name)
public void addAll(Iterable<Attribute> atts)
addAll
in interface AttributeContainer
public Attribute addAttribute(Attribute att)
AttributeContainer
addAttribute
in interface AttributeContainer
att
- add this Attributepublic Attribute addAttribute(String name, Number value)
public Attribute addAttribute(String name, String value)
public static AttributeContainerMutable copyFrom(@Nullable AttributeContainer from)
public Attribute findAttribute(String name)
AttributeContainer
findAttribute
in interface AttributeContainer
public double findAttributeDouble(String attName, double defaultValue)
AttributeContainer
findAttributeDouble
in interface AttributeContainer
public Attribute findAttributeIgnoreCase(String name)
AttributeContainer
findAttributeIgnoreCase
in interface AttributeContainer
public int findAttributeInteger(String attName, int defaultValue)
AttributeContainer
findAttributeInteger
in interface AttributeContainer
public String findAttributeString(String attName, String defaultValue)
AttributeContainer
findAttributeString
in interface AttributeContainer
public List<Attribute> getAttributes()
AttributeContainer
getAttributes
in interface AttributeContainer
@Nullable public 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(String attName)
removeAttribute
in interface AttributeContainer
attName
- if exists, remove this attributepublic boolean removeAttributeIgnoreCase(String attName)
removeAttributeIgnoreCase
in interface AttributeContainer
attName
- if exists, remove this attributepublic void replace(Attribute a, String newName)
a
- remove this attributepublic AttributeContainer toImmutable()