|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap
org.springframework.ui.ModelMap
public class ModelMap
Implementation of Map for use when building model data for use
with UI tools. Supports chained calls and generation of model attribute names.
This class serves as generic model holder for both Servlet and Portlet MVC, but is tied to neither of those.
Conventions.getVariableName(java.lang.Object),
ModelAndView,
ModelAndView,
Serialized Form| Constructor Summary | |
|---|---|
ModelMap()
Construct a new, empty ModelMap. |
|
ModelMap(Object modelObject)
Construct a new ModelMap containing the supplied model object. |
|
ModelMap(String modelName,
Object modelObject)
Construct a new ModelMap containing the supplied model object
under the supplied name. |
|
| Method Summary | |
|---|---|
ModelMap |
addAllObjects(Collection objects)
Copy all objects in the supplied Collection into this Map,
using attribute name generation for each element. |
ModelMap |
addAllObjects(Map objects)
Copy all objects in the supplied Map into this Map. |
ModelMap |
addObject(Object modelObject)
Add the supplied Object to this Map used a
generated name. |
ModelMap |
addObject(String modelName,
Object modelObject)
Add the supplied Object under the supplied name. |
| Methods inherited from class java.util.HashMap |
|---|
clear, clone, containsKey, containsValue, entrySet, get, 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 |
|---|
equals, hashCode |
| Constructor Detail |
|---|
public ModelMap()
ModelMap.
public ModelMap(String modelName, Object modelObject)
ModelMap containing the supplied model object
under the supplied name.
addObject(String, Object)public ModelMap(Object modelObject)
ModelMap containing the supplied model object.
Uses attribute name generation to generate the key for the supplied model
object.
addObject(Object)| Method Detail |
|---|
public ModelMap addObject(String modelName, Object modelObject)
Object under the supplied name.
modelName - the name of the model attribute (never null)modelObject - the model attribute object (can be null)public ModelMap addObject(Object modelObject)
Object to this Map used a
generated name.
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
modelObject - the model attribute object (never null)public ModelMap addAllObjects(Map objects)
Map into this Map.
public ModelMap addAllObjects(Collection objects)
Collection into this Map,
using attribute name generation for each element.
addObject(Object)
|
The Spring Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||