Interface Model
- All Known Subinterfaces:
RedirectAttributes
- All Known Implementing Classes:
BindingAwareConcurrentModel, BindingAwareModelMap, ConcurrentModel, ExtendedModelMap, RedirectAttributesModelMap
public interface Model
Interface that defines a holder for model attributes.
Primarily designed for adding attributes to the model.
Allows for accessing the overall model as a java.util.Map.
- Since:
- 2.5.1
- Author:
- Juergen Hoeller
-
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, @Nullable Object attributeValue) Add the supplied attribute under the supplied name.asMap()Return the current set of model attributes as a Map.booleancontainsAttribute(String attributeName) Does this model contain an attribute of the given name?getAttribute(String attributeName) Return the attribute value for the given name, if any.mergeAttributes(Map<String, ?> attributes) Copy all attributes in the suppliedMapinto thisMap, with existing objects of the same name taking precedence (i.e.
-
Method Details
-
addAttribute
-
addAttribute
Add 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.- Parameters:
attributeValue- the model attribute value (nevernull)
-
addAllAttributes
Copy all attributes in the suppliedCollectioninto thisMap, using attribute name generation for each element.- See Also:
-
addAllAttributes
-
mergeAttributes
-
containsAttribute
Does this model contain an attribute of the given name?- Parameters:
attributeName- the name of the model attribute (nevernull)- Returns:
- whether this model contains a corresponding attribute
-
getAttribute
-
asMap
-