public final class ModelFactory extends Object
IModel<String> stringModel = model(from(person).getProfile().getName());
where person can be an instance of Person class or an
IModel<Person>.| Modifier and Type | Method and Description |
|---|---|
static <T> T |
from(org.apache.wicket.model.IModel<? extends T> model,
Class<T> type)
In cases where you need to hint the Type of the model passed, ecause it
cannot be reflected, you can use this method and provide the model
objects expected type as parameter.
|
static <T> T |
from(org.apache.wicket.model.IModel<T> model)
Proxies the Model-Object's type in order to be able to call methods on it
to create the property path later-on used by model().
|
static <T> T |
from(T value)
Proxies the given object in order to be able to call methods on it to
create the property path later-on used by model().
|
static <T> T |
fromClass(Class<T> clazz)
starts recording from a class.
|
static boolean |
hasRootReference() |
static <T> org.apache.wicket.model.IModel<T> |
model(T path)
creates an actual PropertyModel from the path expressed by the given
object.
|
static String |
path(Object path) |
public static <T> T from(T value)
throws NullPointerException
T - the type of the parametervalue - the object to be proxiedNullPointerException - if the given object is nullpublic static <T> T from(org.apache.wicket.model.IModel<T> model)
throws NullPointerException
T - type of the model parametermodel - the model from which to create a proxyNullPointerException - if the model is nullpublic static <T> org.apache.wicket.model.IModel<T> model(T path)
T - client-defined typepath - the object initially created by a from-callpublic static String path(Object path)
path - the object initially created by a from-callpublic static <T> T fromClass(Class<T> clazz)
new PropertyModel(myModel, ModelFactory.path(x));T - client-defined typeclazz - the type of the proxy to createpublic static <T> T from(org.apache.wicket.model.IModel<? extends T> model,
Class<T> type)
throws NullPointerException
T - type of the model parametermodel - the model from which to create a proxytype - the type of the object backed by the modelNullPointerException - if the model or the type is nullpublic static boolean hasRootReference()
throws IllegalStateException
fromClass(Class).IllegalStateException - if not currently in recording thread (either from() has not
been called, of model() has already been calledCopyright © 2012-2014 wicketeer.org. All Rights Reserved.