org.springframework.ui
Class ExtendedModelMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<java.lang.String,java.lang.Object>
org.springframework.ui.ModelMap
org.springframework.ui.ExtendedModelMap
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object>, Model
- Direct Known Subclasses:
- BindingAwareModelMap
public class ExtendedModelMap
- extends ModelMap
- implements Model
Subclass of ModelMap
that implements the Model
interface.
Java 5 specific like the Model
interface itself.
- Since:
- 2.5.1
- Author:
- Juergen Hoeller
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class java.util.AbstractMap |
java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V> |
Method Summary |
ExtendedModelMap |
addAllAttributes(java.util.Collection<?> attributeValues)
Copy all attributes in the supplied Collection into this
Map , using attribute name generation for each element. |
ExtendedModelMap |
addAllAttributes(java.util.Map<java.lang.String,?> attributes)
Copy all attributes in the supplied Map into this Map . |
ExtendedModelMap |
addAttribute(java.lang.Object attributeValue)
Add the supplied attribute to this Map using a
generated name . |
ExtendedModelMap |
addAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
Add the supplied attribute under the supplied name. |
java.util.Map<java.lang.String,java.lang.Object> |
asMap()
Return the current set of model attributes as a Map. |
ExtendedModelMap |
mergeAttributes(java.util.Map<java.lang.String,?> attributes)
Copy all attributes in the supplied Map into this Map ,
with existing objects of the same name taking precedence (i.e. |
Methods inherited from class java.util.LinkedHashMap |
clear, containsValue, get, removeEldestEntry |
Methods inherited from class java.util.HashMap |
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from class java.util.AbstractMap |
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
containsKey, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
ExtendedModelMap
public ExtendedModelMap()
addAttribute
public ExtendedModelMap addAttribute(java.lang.String attributeName,
java.lang.Object attributeValue)
- Description copied from class:
ModelMap
- Add the supplied attribute under the supplied name.
- Specified by:
addAttribute
in interface Model
- Overrides:
addAttribute
in class ModelMap
- Parameters:
attributeName
- the name of the model attribute (never null
)attributeValue
- the model attribute value (can be null
)
addAttribute
public ExtendedModelMap addAttribute(java.lang.Object attributeValue)
- Description copied from class:
ModelMap
- Add the supplied attribute to this
Map
using a
generated name
.
Note: Empty Collections
are not added to
the model when using this method because we cannot correctly determine
the true convention name. View code should check for null
rather
than for empty collections as is already done by JSTL tags.
- Specified by:
addAttribute
in interface Model
- Overrides:
addAttribute
in class ModelMap
- Parameters:
attributeValue
- the model attribute value (never null
)
addAllAttributes
public ExtendedModelMap addAllAttributes(java.util.Collection<?> attributeValues)
- Description copied from class:
ModelMap
- Copy all attributes in the supplied
Collection
into this
Map
, using attribute name generation for each element.
- Specified by:
addAllAttributes
in interface Model
- Overrides:
addAllAttributes
in class ModelMap
- See Also:
ModelMap.addAttribute(Object)
addAllAttributes
public ExtendedModelMap addAllAttributes(java.util.Map<java.lang.String,?> attributes)
- Description copied from class:
ModelMap
- Copy all attributes in the supplied
Map
into this Map
.
- Specified by:
addAllAttributes
in interface Model
- Overrides:
addAllAttributes
in class ModelMap
- See Also:
ModelMap.addAttribute(String, Object)
mergeAttributes
public ExtendedModelMap mergeAttributes(java.util.Map<java.lang.String,?> attributes)
- Description copied from class:
ModelMap
- Copy all attributes in the supplied
Map
into this Map
,
with existing objects of the same name taking precedence (i.e. not getting
replaced).
- Specified by:
mergeAttributes
in interface Model
- Overrides:
mergeAttributes
in class ModelMap
asMap
public java.util.Map<java.lang.String,java.lang.Object> asMap()
- Description copied from interface:
Model
- Return the current set of model attributes as a Map.
- Specified by:
asMap
in interface Model