public class ExtendedModelMap extends ModelMap implements Model
ModelMap that implements the Model interface.
Java 5 specific like the Model interface itself.
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.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| 构造器和说明 |
|---|
ExtendedModelMap() |
| 限定符和类型 | 方法和说明 |
|---|---|
ExtendedModelMap |
addAllAttributes(Collection<?> attributeValues)
Copy all attributes in the supplied
Collection into this
Map, using attribute name generation for each element. |
ExtendedModelMap |
addAllAttributes(Map<String,?> attributes)
Copy all attributes in the supplied
Map into this Map. |
ExtendedModelMap |
addAttribute(Object attributeValue)
Add the supplied attribute to this
Map using a
generated name. |
ExtendedModelMap |
addAttribute(String attributeName,
Object attributeValue)
Add the supplied attribute under the supplied name.
|
Map<String,Object> |
asMap()
Return the current set of model attributes as a Map.
|
ExtendedModelMap |
mergeAttributes(Map<String,?> attributes)
Copy all attributes in the supplied
Map into this Map,
with existing objects of the same name taking precedence (i.e. not getting
replaced). |
containsAttributeclear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringcontainsAttributecompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic ExtendedModelMap addAttribute(String attributeName, @Nullable Object attributeValue)
ModelMapaddAttribute 在接口中 ModeladdAttribute 在类中 ModelMapattributeName - the name of the model attribute (never null)attributeValue - the model attribute value (can be null)public ExtendedModelMap addAttribute(Object attributeValue)
ModelMapMap 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.
addAttribute 在接口中 ModeladdAttribute 在类中 ModelMapattributeValue - the model attribute value (never null)public ExtendedModelMap addAllAttributes(@Nullable Collection<?> attributeValues)
ModelMapCollection into this
Map, using attribute name generation for each element.addAllAttributes 在接口中 ModeladdAllAttributes 在类中 ModelMapModelMap.addAttribute(Object)public ExtendedModelMap addAllAttributes(@Nullable Map<String,?> attributes)
ModelMapMap into this Map.addAllAttributes 在接口中 ModeladdAllAttributes 在类中 ModelMapModelMap.addAttribute(String, Object)public ExtendedModelMap mergeAttributes(@Nullable Map<String,?> attributes)
ModelMapMap into this Map,
with existing objects of the same name taking precedence (i.e. not getting
replaced).mergeAttributes 在接口中 ModelmergeAttributes 在类中 ModelMap