public interface ModelContributable
Modifier and Type | Method and Description |
---|---|
<T> T |
getModel(String name)
Returns the model object associated with the given
name ,
or null if no model object of the given name exists. |
Iterable<String> |
getModelNames()
Returns an unmodifiable
Iterable containing the
names of the model objects available to this. |
Map<String,Object> |
getModelsMap()
Returns an unmodifiable map of model objects contributed by
setModel(String, Object) . |
void |
removeModel(String name)
Removes a model object from this.
|
Object |
setModel(String name,
Object model)
Stores a model object in this.
|
<T> T getModel(String name)
name
,
or null
if no model object of the given name
exists.name
- the name of the model objectname
, or
null if the model object does not exist.Iterable<String> getModelNames()
Iterable
containing the
names of the model objects available to this.
This method returns an empty Iterable
if this has no model object available to it.Iterable
of strings containing the names
of model objects of this.Map<String,Object> getModelsMap()
setModel(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 as HstRequest
and HstRequestContext
) provides a
combined view for both models
and other attributes
through #getAttribute(String)
,
#getAttributeNames()
or #getAttributeMap
.
setModel(String, Object)
Object setModel(String name, Object model)
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)
.
name
- the name of the model objectmodel
- the model object to be storedvoid removeModel(String name)
name
- a String
specifying
the name of the model object to removeCopyright © 2008–2020 Hippo B.V. (http://www.onehippo.com). All rights reserved.