Package org.springframework.ui
Class ExtendedModelMap
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<String,Object>
org.springframework.ui.ModelMap
org.springframework.ui.ExtendedModelMap
- Direct Known Subclasses:
BindingAwareModelMap
Subclass of
ModelMap that implements the Model interface.
This is an implementation class exposed to handler methods by Spring MVC, typically via
a declaration of the Model interface. There is no need to
build it within user code; a plain ModelMap or even a just
a regular Map with String keys will be good enough to return a user model.
- Since:
- 2.5.1
- Author:
- Juergen Hoeller
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAllAttributes(Collection<?> attributeValues) Copy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.addAllAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto thisMap.addAttribute(Object attributeValue) Add the supplied attribute to thisMapusing agenerated name.addAttribute(String attributeName, Object attributeValue) Add the supplied attribute under the supplied name.asMap()Return the current set of model attributes as a Map.mergeAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e.Methods inherited from class org.springframework.ui.ModelMap
containsAttribute, getAttributeMethods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface org.springframework.ui.Model
containsAttribute, getAttribute
-
Constructor Details
-
ExtendedModelMap
public ExtendedModelMap()
-
-
Method Details
-
addAttribute
Description copied from class:ModelMapAdd the supplied attribute under the supplied name.- Specified by:
addAttributein interfaceModel- Overrides:
addAttributein classModelMap- Parameters:
attributeName- the name of the model attribute (nevernull)attributeValue- the model attribute value (can benull)
-
addAttribute
Description copied from class:ModelMapAdd the supplied attribute to thisMapusing agenerated name.Note: Empty
Collectionsare not added to the model when using this method because we cannot correctly determine the true convention name. View code should check fornullrather than for empty collections as is already done by JSTL tags.- Specified by:
addAttributein interfaceModel- Overrides:
addAttributein classModelMap- Parameters:
attributeValue- the model attribute value (nevernull)
-
addAllAttributes
Description copied from class:ModelMapCopy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.- Specified by:
addAllAttributesin interfaceModel- Overrides:
addAllAttributesin classModelMap- See Also:
-
addAllAttributes
Description copied from class:ModelMapCopy all attributes in the suppliedMapinto thisMap.- Specified by:
addAllAttributesin interfaceModel- Overrides:
addAllAttributesin classModelMap- See Also:
-
mergeAttributes
Description copied from class:ModelMapCopy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e. not getting replaced).- Specified by:
mergeAttributesin interfaceModel- Overrides:
mergeAttributesin classModelMap
-
asMap
Description copied from interface:ModelReturn the current set of model attributes as a Map.
-