Top Description Methods
javax.mvc

public Interface Models

extends Iterable<String>
Imports
java.util.Map

A map of name to model instances used by a javax.mvc.engine.ViewEngine to process a view. Instances implementing this interface must be injectable using javax.inject.Inject and are javax.enterprise.context.RequestScoped.

Note that certain view engines, such as engines for JSPs and Facelets, support model binding via javax.inject.Named in which case the use of Models is optional.

Authors
Santiago Pericas-Geertsen, Christian Kaltepoth
Since
1.0
See Also
javax.inject.Named, javax.enterprise.context.RequestScoped

Method Summary

Modifier and TypeMethod and Description
public Map<String, Object>

Returns:

unmodifiable map
asMap
()

Returns a unmodifiable view of the models map.

public Object

Returns:

the model or null
get
(String
name of the model
name
)

Retrieve a model by name.

public <
type of the model
T
>
T

Returns:

The model or null
get
(String
name of the model
name
,
Class<T>
type of the model
clazz
)

Retrieve a model by name in a type-safe way.

public Models

Returns:

the current instance to allow method chaining
put
(String
name of the model
name
,
Object
model to store in the map
model
)

Stores a new model in the map.

Inherited from java.lang.Iterable:
forEachiteratorspliterator

Method Detail

asMapback to summary
public Map<String, Object> asMap()

Returns a unmodifiable view of the models map.

Returns:Map<String, Object>

unmodifiable map

getback to summary
public Object get(String name)

Retrieve a model by name.

Parameters
name:String

name of the model

Returns:Object

the model or null

getback to summary
public <T> T get(String name, Class<T> clazz)

Retrieve a model by name in a type-safe way.

Parameters
<T>
type of the model
name:String

name of the model

clazz:Class<T>

type of the model

Returns:T

The model or null

putback to summary
public Models put(String name, Object model)

Stores a new model in the map.

Parameters
name:String

name of the model

model:Object

model to store in the map

Returns:Models

the current instance to allow method chaining