|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.model.Model<T>
T
- The type of the Model Objectpublic class Model<T extends Serializable>
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 Summary | |
---|---|
Model()
Construct the model without providing an object. |
|
Model(T object)
Construct the model, setting the given object as the wrapped object. |
Method Summary | ||
---|---|---|
void |
detach()
Detaches model after use. |
|
boolean |
equals(Object obj)
|
|
T |
getObject()
Gets the model object. |
|
int |
hashCode()
|
|
static
|
of()
Factory methods for Model which uses type inference to make code shorter. |
|
static
|
of(Collection<? extends C> set)
Factory method for models that contain collections. |
|
static
|
of(IModel<?> model)
Supresses generics warning when converting model types |
|
static
|
of(T object)
Factory methods for Model which uses type inference to make code shorter. |
|
static
|
ofList(List<? extends C> list)
Factory method for models that contain lists. |
|
static
|
ofMap(Map<K,V> map)
Factory method for models that contain maps. |
|
static
|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Model()
public Model(T object)
object
- The model object properMethod Detail |
---|
public 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 Serializable
public 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 Serializable
public 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 Serializable
public static <C> IModel<Collection<? extends C>> of(Collection<? extends C> set)
collection
into a serializable ArrayList
.
C
- model typeset
- The Collection, which may or may not be Serializable
public static <T extends Serializable> Model<T> of(T object)
new Model(object)
.
T
- object
-
object
public static <T extends Serializable> Model<T> of()
new Model()
.
T
-
object
public T getObject()
IModel
getObject
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()
IDetachable
detach
in interface IDetachable
IDetachable.detach()
public String toString()
toString
in class Object
Object.toString()
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public static <T> IModel<T> of(IModel<?> model)
T
- model
-
model
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |