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 Jakarta Server Pages and Facelets, support
model binding via Named
in which case the use of Models is
optional.
- Since:
- 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionasMap()
Returns a unmodifiable view of the models map.Retrieve a model by name.<T> T
Retrieve a model by name in a type-safe way.Stores a new model in the map.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
put
Stores a new model in the map.- Parameters:
name
- name of the modelmodel
- model to store in the map- Returns:
- the current instance to allow method chaining
-
get
Retrieve a model by name.- Parameters:
name
- name of the model- Returns:
- the model or
null
-
get
Retrieve a model by name in a type-safe way.- Type Parameters:
T
- type of the model- Parameters:
name
- name of the modelclazz
- type of the model- Returns:
- The model or
null
-
asMap
Returns a unmodifiable view of the models map.- Returns:
- unmodifiable map
-