T - The type of the Model Objectpublic class Model<T extends Serializable> extends Object implements IModel<T>
Model is the basic implementation of an IModel. It just wraps a simple
model object. The model object must be serializable, as it is stored in the session. If you have
large objects to store, consider using LoadableDetachableModel
instead of this class.| Constructor and Description |
|---|
Model()
Construct the model without providing an object.
|
Model(T object)
Construct the model, setting the given object as the wrapped object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
detach()
Detaches model after use.
|
boolean |
equals(Object obj) |
T |
getObject()
Gets the model object.
|
int |
hashCode() |
static <T extends Serializable> |
of()
Factory methods for Model which uses type inference to make code shorter.
|
static <C> IModel<Collection<? extends C>> |
of(Collection<? extends C> collection)
Factory method for models that contain collections.
|
static <T> IModel<T> |
of(IModel<?> model)
Supresses generics warning when converting model types
|
static <T extends Serializable> |
of(T object)
Factory methods for Model which uses type inference to make code shorter.
|
static <C> IModel<List<? extends C>> |
ofList(List<? extends C> list)
Factory method for models that contain lists.
|
static <K,V> IModel<Map<K,V>> |
ofMap(Map<K,V> map)
Factory method for models that contain maps.
|
static <C> IModel<Set<? extends C>> |
ofSet(Set<? extends C> set)
Factory method for models that contain sets.
|
void |
setObject(T object)
Set the model object; calls setObject(java.io.Serializable).
|
String |
toString() |
public Model()
public Model(T object)
object - The model object properpublic static <C> IModel<List<? extends C>> ofList(List<? extends C> list)
list into a serializable one.C - model typelist - The List, which may or may not be Serializablepublic static <K,V> IModel<Map<K,V>> ofMap(Map<K,V> map)
map into a serializable one.K - key type in mapV - value type in mapmap - The Map, which may or may not be Serializablepublic static <C> IModel<Set<? extends C>> ofSet(Set<? extends C> set)
set into a serializable one.C - model typeset - The Set, which may or may not be Serializablepublic static <C> IModel<Collection<? extends C>> of(Collection<? extends C> collection)
collection into a serializable ArrayList.C - model typecollection - The Collection, which may or may not be Serializablepublic static <T extends Serializable> Model<T> of(T object)
new Model(object) .T - object - objectpublic static <T> IModel<T> of(IModel<?> model)
T - model - modelpublic static <T extends Serializable> Model<T> of()
new Model() .T - objectpublic T getObject()
IModelgetObject in interface IModel<T extends Serializable>IModel.getObject()public void setObject(T object)
setObject in interface IModel<T extends Serializable>object - the model objectIModel.setObject(Object)public void detach()
IDetachabledetach in interface IDetachableIDetachable.detach()public String toString()
toString in class ObjectObject.toString()Copyright © 2006–2014 Apache Software Foundation. All rights reserved.