java.util.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 Servlet MVC but is not tied to it.
Check out the Model interface for an interface variant.
Conventions#getVariableName, org.springframework.web.servlet.ModelAndView
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ModelMap | addAllAttributes(Collection<?> attributeValues)
Copy all attributes in the supplied |
| public ModelMap | |
| public ModelMap | addAttribute(String
the name of the model attribute (never attributeName, Object null)the model attribute value (can be attributeValue)null)Add the supplied attribute under the supplied name. |
| public ModelMap | addAttribute(Object
the model attribute value (never attributeValue)null)Add the supplied attribute to this |
| public boolean | Returns: whether this model contains a corresponding attributethe name of the model attribute (never attributeName)null)Does this model contain an attribute of the given name? |
| public Object | Returns: the corresponding attribute value, ornull if nonethe name of the model attribute (never attributeName)null)Return the attribute value for the given name, if any. |
| public ModelMap | mergeAttributes(Map<String, ?> attributes)
Copy all attributes in the supplied |
| ModelMap | back to summary |
|---|---|
| public ModelMap() Construct a new, empty | |
| ModelMap | back to summary |
|---|---|
| public ModelMap(String attributeName, Object attributeValue) Construct a new
| |
| ModelMap | back to summary |
|---|---|
| public ModelMap(Object attributeValue) Construct a new
| |
| addAllAttributes | back to summary |
|---|---|
| public ModelMap addAllAttributes(Collection<?> attributeValues) Copy all attributes in the supplied
| |
| addAllAttributes | back to summary |
|---|---|
| public ModelMap addAllAttributes(Map<String, ?> attributes) Copy all attributes in the supplied
| |
| addAttribute | back to summary |
|---|---|
| public ModelMap addAttribute(String attributeName, Object attributeValue) Add the supplied attribute under the supplied name. | |
| addAttribute | back to summary |
|---|---|
| public ModelMap addAttribute(Object attributeValue) Add the supplied attribute to this Note Empty
| |
| containsAttribute | back to summary |
|---|---|
| public boolean containsAttribute(String attributeName) Does this model contain an attribute of the given name?
| |
| getAttribute | back to summary |
|---|---|
| public Object getAttribute(String attributeName) Return the attribute value for the given name, if any. | |
| mergeAttributes | back to summary |
|---|---|
| public ModelMap mergeAttributes(Map<String, ?> attributes) Copy all attributes in the supplied | |