|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.webflow.core.collection.LocalAttributeMap
public class LocalAttributeMap
A generic, mutable attribute map with string keys.
Constructor Summary | |
---|---|
LocalAttributeMap()
Creates a new attribute map, initially empty. |
|
LocalAttributeMap(int size,
int loadFactor)
Creates a new attribute map, initially empty. |
|
LocalAttributeMap(Map map)
Creates a new attribute map wrapping the specified map. |
|
LocalAttributeMap(String attributeName,
Object attributeValue)
Creates a new attribute map with a single entry. |
Method Summary | |
---|---|
Map |
asMap()
Returns this object's contents as a Map . |
MutableAttributeMap |
clear()
Remove all attributes in this map. |
boolean |
contains(String attributeName)
Does the attribute with the provided name exist in this map? |
boolean |
contains(String attributeName,
Class requiredType)
Does the attribute with the provided name exist in this map and is its value of the specified required type? |
boolean |
equals(Object o)
|
Object |
extract(String attributeName)
Extract an attribute from this map, getting it and removing it in a single operation. |
Object |
get(String attributeName)
Get an attribute value out of this map, returning null if not found. |
Object |
get(String attributeName,
Class requiredType)
Get an attribute value, asserting the value is of the required type. |
Object |
get(String attributeName,
Class requiredType,
Object defaultValue)
Get an attribute value, asserting the value is of the required type and returning the default value if not found. |
Object |
get(String attributeName,
Object defaultValue)
Get an attribute value, returning the default value if no value is found. |
Object[] |
getArray(String attributeName,
Class requiredType)
Returns an array attribute value in the map and makes sure it is of the required type. |
Boolean |
getBoolean(String attributeName)
Returns a boolean attribute value in the map, returning null if no value was found. |
Boolean |
getBoolean(String attributeName,
Boolean defaultValue)
Returns a boolean attribute value in the map, returning the default value if no value was found. |
Collection |
getCollection(String attributeName)
Returns a collection attribute value in the map. |
Collection |
getCollection(String attributeName,
Class requiredType)
Returns a collection attribute value in the map and make sure it is of the required type. |
Integer |
getInteger(String attributeName)
Returns an integer attribute value in the map, returning null if no value was found. |
Integer |
getInteger(String attributeName,
Integer defaultValue)
Returns an integer attribute value in the map, returning the default value if no value was found. |
Long |
getLong(String attributeName)
Returns a long attribute value in the map, returning null if no value was found. |
Long |
getLong(String attributeName,
Long defaultValue)
Returns a long attribute value in the map, returning the default value if no value was found. |
Number |
getNumber(String attributeName,
Class requiredType)
Returns a number attribute value in the map that is of the specified type, returning null if no
value was found. |
Number |
getNumber(String attributeName,
Class requiredType,
Number defaultValue)
Returns a number attribute value in the map of the specified type, returning the default value if no value was found. |
Object |
getRequired(String attributeName)
Get the value of a required attribute, throwing an exception of no attribute is found. |
Object |
getRequired(String attributeName,
Class requiredType)
Get the value of a required attribute and make sure it is of the required type. |
Object[] |
getRequiredArray(String attributeName,
Class requiredType)
Returns an array attribute value in the map, throwing an exception if the attribute is not present or not an array of the required type. |
Boolean |
getRequiredBoolean(String attributeName)
Returns a boolean attribute value in the map, throwing an exception if the attribute is not present and of the correct type. |
Collection |
getRequiredCollection(String attributeName)
Returns a collection attribute value in the map, throwing an exception if the attribute is not present or not a collection. |
Collection |
getRequiredCollection(String attributeName,
Class requiredType)
Returns a collection attribute value in the map, throwing an exception if the attribute is not present or not a collection of the required type. |
Integer |
getRequiredInteger(String attributeName)
Returns an integer attribute value in the map, throwing an exception if the attribute is not present and of the correct type. |
Long |
getRequiredLong(String attributeName)
Returns a long attribute value in the map, throwing an exception if the attribute is not present and of the correct type. |
Number |
getRequiredNumber(String attributeName,
Class requiredType)
Returns a number attribute value in the map, throwing an exception if the attribute is not present and of the correct type. |
String |
getRequiredString(String attributeName)
Returns a string attribute value in the map, throwing an exception if the attribute is not present and of the correct type. |
String |
getString(String attributeName)
Returns a string attribute value in the map, returning null if no value was found. |
String |
getString(String attributeName,
String defaultValue)
Returns a string attribute value in the map, returning the default value if no value was found. |
int |
hashCode()
|
boolean |
isEmpty()
Is this attribute map empty with a size of 0? |
Object |
put(String attributeName,
Object attributeValue)
Put the attribute into this map. |
MutableAttributeMap |
putAll(AttributeMap attributes)
Put all the attributes into this map. |
Object |
remove(String attributeName)
Remove an attribute from this map. |
MutableAttributeMap |
removeAll(MutableAttributeMap attributes)
Remove all attributes in the map provided from this map. |
MutableAttributeMap |
replaceWith(AttributeMap attributes)
Replace the contents of this attribute map with the contents of the provided collection. |
int |
size()
Returns the size of this map. |
String |
toString()
|
AttributeMap |
union(AttributeMap attributes)
Returns a new attribute map containing the union of this map with the provided map. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LocalAttributeMap()
public LocalAttributeMap(int size, int loadFactor)
size
- the initial sizeloadFactor
- the load factorpublic LocalAttributeMap(String attributeName, Object attributeValue)
public LocalAttributeMap(Map map)
Method Detail |
---|
public Map asMap()
MapAdaptable
Map
. The returned map may or may not be modifiable depending on this
implementation.
Warning: this operation may be called frequently; if so care should be taken so that the map contents (if calculated) be cached as appropriate.
asMap
in interface MapAdaptable
public int size()
AttributeMap
size
in interface AttributeMap
public Object get(String attributeName)
AttributeMap
null
if not found.
get
in interface AttributeMap
attributeName
- the attribute name
public boolean isEmpty()
AttributeMap
isEmpty
in interface AttributeMap
public boolean contains(String attributeName)
AttributeMap
contains
in interface AttributeMap
attributeName
- the attribute name
public boolean contains(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
contains
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required class of the attribute value
IllegalArgumentException
- when the value is not of the required typepublic Object get(String attributeName, Object defaultValue)
AttributeMap
get
in interface AttributeMap
attributeName
- the name of the attributedefaultValue
- the default value
public Object get(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
get
in interface AttributeMap
attributeName
- the name of the attributerequiredType
- the required type of the attribute value
IllegalArgumentException
- when the value is not of the required typepublic Object get(String attributeName, Class requiredType, Object defaultValue) throws IllegalStateException
AttributeMap
get
in interface AttributeMap
attributeName
- the name of the attributerequiredType
- the value required typedefaultValue
- the default value
IllegalStateException
public Object getRequired(String attributeName) throws IllegalArgumentException
AttributeMap
getRequired
in interface AttributeMap
attributeName
- the name of the attribute
IllegalArgumentException
- when the attribute is not foundpublic Object getRequired(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getRequired
in interface AttributeMap
attributeName
- name of the attribute to getrequiredType
- the required type of the attribute value
IllegalArgumentException
- when the attribute is not found or not of the required typepublic String getString(String attributeName) throws IllegalArgumentException
AttributeMap
null
if no value was found.
getString
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is present but not a stringpublic String getString(String attributeName, String defaultValue) throws IllegalArgumentException
AttributeMap
getString
in interface AttributeMap
attributeName
- the attribute namedefaultValue
- the default
IllegalArgumentException
- if the attribute is present but not a stringpublic String getRequiredString(String attributeName) throws IllegalArgumentException
AttributeMap
getRequiredString
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or present but not a stringpublic Collection getCollection(String attributeName) throws IllegalArgumentException
AttributeMap
getCollection
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is present but not a collectionpublic Collection getCollection(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getCollection
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required type of the attribute value
IllegalArgumentException
- if the attribute is present but not a collection of the required typepublic Collection getRequiredCollection(String attributeName) throws IllegalArgumentException
AttributeMap
getRequiredCollection
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or is present but not a collectionpublic Collection getRequiredCollection(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getRequiredCollection
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required collection type
IllegalArgumentException
- if the attribute is not present or is present but not a collection of the
required typepublic Object[] getArray(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getArray
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required type of the attribute value
IllegalArgumentException
- if the attribute is present but not an array of the required typepublic Object[] getRequiredArray(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getRequiredArray
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required array type
IllegalArgumentException
- if the attribute is not present or is present but not a array of the required
typepublic Number getNumber(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
null
if no
value was found.
getNumber
in interface AttributeMap
attributeName
- the attribute namerequiredType
- the required number type
IllegalArgumentException
- if the attribute is present but not a number of the required typepublic Number getNumber(String attributeName, Class requiredType, Number defaultValue) throws IllegalArgumentException
AttributeMap
getNumber
in interface AttributeMap
attributeName
- the attribute namedefaultValue
- the default
IllegalArgumentException
- if the attribute is present but not a number of the required typepublic Number getRequiredNumber(String attributeName, Class requiredType) throws IllegalArgumentException
AttributeMap
getRequiredNumber
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or present but not a number of the required typepublic Integer getInteger(String attributeName) throws IllegalArgumentException
AttributeMap
null
if no value was found.
getInteger
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is present but not an integerpublic Integer getInteger(String attributeName, Integer defaultValue) throws IllegalArgumentException
AttributeMap
getInteger
in interface AttributeMap
attributeName
- the attribute namedefaultValue
- the default
IllegalArgumentException
- if the attribute is present but not an integerpublic Integer getRequiredInteger(String attributeName) throws IllegalArgumentException
AttributeMap
getRequiredInteger
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or present but not an integerpublic Long getLong(String attributeName) throws IllegalArgumentException
AttributeMap
null
if no value was found.
getLong
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is present but not a longpublic Long getLong(String attributeName, Long defaultValue) throws IllegalArgumentException
AttributeMap
getLong
in interface AttributeMap
attributeName
- the attribute namedefaultValue
- the default
IllegalArgumentException
- if the attribute is present but not a longpublic Long getRequiredLong(String attributeName) throws IllegalArgumentException
AttributeMap
getRequiredLong
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or present but not a longpublic Boolean getBoolean(String attributeName) throws IllegalArgumentException
AttributeMap
null
if no value was found.
getBoolean
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is present but not a booleanpublic Boolean getBoolean(String attributeName, Boolean defaultValue) throws IllegalArgumentException
AttributeMap
getBoolean
in interface AttributeMap
attributeName
- the attribute namedefaultValue
- the default
IllegalArgumentException
- if the attribute is present but not a booleanpublic Boolean getRequiredBoolean(String attributeName) throws IllegalArgumentException
AttributeMap
getRequiredBoolean
in interface AttributeMap
attributeName
- the attribute name
IllegalArgumentException
- if the attribute is not present or present but is not a booleanpublic AttributeMap union(AttributeMap attributes)
AttributeMap
union
in interface AttributeMap
attributes
- the map to combine with this map
public Object put(String attributeName, Object attributeValue)
MutableAttributeMap
If the attribute value is an AttributeMapBindingListener
this map will publish
binding events
such as on "bind" and "unbind" if supported.
Note: not all MutableAttributeMap
implementations support this.
put
in interface MutableAttributeMap
attributeName
- the attribute nameattributeValue
- the attribute value
null
of there was no previous valuepublic MutableAttributeMap putAll(AttributeMap attributes)
MutableAttributeMap
putAll
in interface MutableAttributeMap
attributes
- the attributes to put into this map
public MutableAttributeMap removeAll(MutableAttributeMap attributes)
MutableAttributeMap
removeAll
in interface MutableAttributeMap
attributes
- the attributes to remove from this map
public Object remove(String attributeName)
MutableAttributeMap
remove
in interface MutableAttributeMap
attributeName
- the name of the attribute to remove
public Object extract(String attributeName)
MutableAttributeMap
extract
in interface MutableAttributeMap
attributeName
- the attribute name
null
of there was no valuepublic MutableAttributeMap clear() throws UnsupportedOperationException
MutableAttributeMap
clear
in interface MutableAttributeMap
UnsupportedOperationException
public MutableAttributeMap replaceWith(AttributeMap attributes) throws UnsupportedOperationException
MutableAttributeMap
replaceWith
in interface MutableAttributeMap
attributes
- the attribute collection
UnsupportedOperationException
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |