public class Viewable extends Object
An abstraction that encapsulates information about a view as well as an instance
of Models
and a ViewEngine
class, in
which only the view information is mandatory. Instances of this class can be
returned by controller methods.
If no Models
is specified, the view engine is required to
inject it; if no ViewEngine
is specified, then
the default selection mechanism that associates views with view engines must
be used.
It follows that a controller method returning an instance of this class can override
the Models
in request scope as well as the default lookup
mechanism for view engines.
Models
,
Controller
,
ViewEngine
Constructor and Description |
---|
Viewable(String view)
Constructs an instance specifying only a view.
|
Viewable(String view,
Class<? extends ViewEngine> viewEngine)
Constructs an instance using a view and a view engine.
|
Viewable(String view,
Models models)
Constructs an instance using a view and a models instance.
|
Viewable(String view,
Models models,
Class<? extends ViewEngine> viewEngine)
Constructs an instance using a view, a models and a view engine instances.
|
Modifier and Type | Method and Description |
---|---|
Models |
getModels()
Get the models instance.
|
String |
getView()
Get the view.
|
Class<? extends ViewEngine> |
getViewEngine()
Get the view engine instance.
|
void |
setModels(Models models)
Set the models instance.
|
void |
setView(String view)
Set a new view.
|
void |
setViewEngine(Class<? extends ViewEngine> viewEngine)
Set the view engine instance.
|
public Viewable(String view)
view
- the view.public Viewable(String view, Class<? extends ViewEngine> viewEngine)
view
- the view.viewEngine
- the view engine class.public Viewable(String view, Models models)
view
- the view.models
- the models instance.public Viewable(String view, Models models, Class<? extends ViewEngine> viewEngine)
view
- the view.models
- the models instance.viewEngine
- the view engine class.public String getView()
public void setView(String view)
view
- the new view.public Models getModels()
null
.public void setModels(Models models)
models
- the new models instance.public Class<? extends ViewEngine> getViewEngine()
null
.public void setViewEngine(Class<? extends ViewEngine> viewEngine)
viewEngine
- the new view engine instance.Copyright © 2015 Oracle Corporation. All rights reserved.