public interface Models extends Iterable<String>
A map of name to model instances used by a ViewEngine
to process a view. Instances implementing this interface must be injectable using
Inject and are RequestScoped.
Note that certain view engines, such as engines for JSPs and Facelets, support
model binding via Named in which case the use of Models is
optional.
Named,
RequestScoped| Modifier and Type | Method and Description |
|---|---|
Map<String,Object> |
asMap()
Returns a unmodifiable view of the models map.
|
Object |
get(String name)
Retrieve a model by name.
|
<T> T |
get(String name,
Class<T> clazz)
Retrieve a model by name in a type-safe way.
|
Models |
put(String name,
Object model)
Stores a new model in the map.
|
forEach, iterator, spliteratorModels put(String name, Object model)
name - name of the modelmodel - model to store in the mapObject get(String name)
name - name of the modelnull<T> T get(String name, Class<T> clazz)
T - type of the modelname - name of the modelclazz - type of the modelnullCopyright © 2018 Ivar Grimstad. All rights reserved.