Interface ModelContributable
- All Known Subinterfaces:
HstMutableRequestContext
,HstRequest
,HstRequestContext
-
Method Summary
Modifier and TypeMethodDescription<T> T
Returns the model object associated with the givenname
, ornull
if no model object of the givenname
exists.Returns an unmodifiableIterable
containing the names of the model objects available to this.Returns an unmodifiable map of model objects contributed bysetModel(String, Object)
.void
removeModel
(String name) Removes a model object from this.Stores a model object in this.
-
Method Details
-
getModel
Returns the model object associated with the givenname
, ornull
if no model object of the givenname
exists.- Parameters:
name
- the name of the model object- Returns:
- the model object associated with the
name
, or null if the model object does not exist.
-
getModelNames
Returns an unmodifiableIterable
containing the names of the model objects available to this. This method returns an emptyIterable
if this has no model object available to it.- Returns:
- an
Iterable
of strings containing the names of model objects of this.
-
getModelsMap
Returns an unmodifiable map of model objects contributed bysetModel(String, Object)
.Note that the returned map contains only the pairs of model name and value objects contributed by
setModel(String, Object)
, but it does not contain attributes set by#setAttribute(String,Object)
API calls, whereas most implementations of this interface (such asHstRequest
andHstRequestContext
) provides a combined view for bothmodels
and otherattributes
through#getAttribute(String)
,#getAttributeNames()
or#getAttributeMap
.- Returns:
- an unmodifiable map of model objects contributed by
setModel(String, Object)
-
setModel
Stores a model object in this.Model objects are contributed by a controller component to this, in general. And, the contributed model objects may be accessed in view rendering or special model aggregation / serialization request pipeline processing.
If the model object passed in is null, the effect is the same as calling
removeModel(java.lang.String)
.- Parameters:
name
- the name of the model objectmodel
- the model object to be stored- Returns:
- the previous model object associated with name, or null if there was no mapping for name.
-
removeModel
Removes a model object from this.- Parameters:
name
- aString
specifying the name of the model object to remove
-