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.
|
Attribute |
findAttribute(String name)
Find an Attribute by 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 try doing an exact match, then try ignoring case.
|
int |
findAttributeInteger(String attName,
int defaultValue)
Find a Numeric Attribute by name (ignore case), return the integer value of the Attribute.
|
String |
findAttValueIgnoreCase(String attName,
String defaultValue)
Find a String-valued 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 |
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 |
setImmutable()
Deprecated.
|
void |
setName(String name) |
AttributeContainer |
toImmutable()
Turn into an immutable AttributeContainer
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
hasAttribute, iterator
forEach, spliterator
public AttributeContainerMutable(String name)
public void setName(String name)
@Nullable public String getName()
AttributeContainer
getName
in interface AttributeContainer
@Deprecated public void setImmutable()
public List<Attribute> getAttributes()
AttributeContainer
getAttributes
in interface AttributeContainer
public Attribute addAttribute(Attribute att)
AttributeContainer
addAttribute
in interface AttributeContainer
att
- add this Attributepublic Attribute addAttribute(String name, String value)
public Attribute addAttribute(String name, Number value)
public void addAll(Iterable<Attribute> atts)
addAll
in interface AttributeContainer
public String findAttValueIgnoreCase(String attName, String defaultValue)
AttributeContainer
findAttValueIgnoreCase
in interface AttributeContainer
public Attribute findAttribute(String name)
AttributeContainer
findAttribute
in interface AttributeContainer
public Attribute findAttributeIgnoreCase(String name)
AttributeContainer
findAttributeIgnoreCase
in interface AttributeContainer
public double findAttributeDouble(String attName, double defaultValue)
AttributeContainer
findAttributeDouble
in interface AttributeContainer
public int findAttributeInteger(String attName, int defaultValue)
AttributeContainer
findAttributeInteger
in interface AttributeContainer
public boolean remove(Attribute a)
remove
in interface AttributeContainer
a
- remove this attributepublic void replace(Attribute a, String newName)
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 AttributeContainer toImmutable()