public interface Model
java.util.Map
.Modifier and Type | Method and Description |
---|---|
Model |
addAllAttributes(java.util.Collection<?> attributeValues)
Copy all attributes in the supplied
Collection into this
Map , using attribute name generation for each element. |
Model |
addAllAttributes(java.util.Map<java.lang.String,?> attributes)
Copy all attributes in the supplied
Map into this Map . |
Model |
addAttribute(java.lang.Object attributeValue)
Add the supplied attribute to this
Map using a
generated name . |
Model |
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.
|
boolean |
containsAttribute(java.lang.String attributeName)
Does this model contain an attribute of the given name?
|
Model |
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. |
Model addAttribute(java.lang.String attributeName, @Nullable java.lang.Object attributeValue)
attributeName
- the name of the model attribute (never null
)attributeValue
- the model attribute value (can be null
)Model addAttribute(java.lang.Object attributeValue)
Map
using 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.
attributeValue
- the model attribute value (never null
)Model addAllAttributes(java.util.Collection<?> attributeValues)
Collection
into this
Map
, using attribute name generation for each element.addAttribute(Object)
Model addAllAttributes(java.util.Map<java.lang.String,?> attributes)
Map
into this Map
.addAttribute(String, Object)
Model mergeAttributes(java.util.Map<java.lang.String,?> attributes)
Map
into this Map
,
with existing objects of the same name taking precedence (i.e. not getting
replaced).boolean containsAttribute(java.lang.String attributeName)
attributeName
- the name of the model attribute (never null
)java.util.Map<java.lang.String,java.lang.Object> asMap()