public class LazyModel<T> extends Object implements org.apache.wicket.model.IModel<T>, org.apache.wicket.model.IObjectClassAwareModel<T>, IObjectTypeAwareModel<T>, org.apache.wicket.model.IPropertyReflectionAwareModel<T>
IModel<String> model = model(from(a).getB().getStrings().get("key"));
model.setObject("value");
String string = model.getObject();
Evaluations can be nested too:
IModel<C> model = model(from(a).getB().getCs().get(from(d).getIndex()));
| Modifier and Type | Field and Description |
|---|---|
static IMethodResolver |
methodResolver
The resolver for
Methods. |
protected Object |
stack
Each invoked method's identifier followed by its arguments.
|
protected Object |
target
The target of the evaluation.
|
| Modifier and Type | Method and Description |
|---|---|
LazyModel<T> |
bind(Object target)
Bind this model to a new target.
|
void |
detach() |
static <T> T |
from(Class<T> targetType)
Start a lazy evaluation.
|
static <T> T |
from(org.apache.wicket.model.IModel<T> target)
Start a lazy evaluation.
|
static <T> T |
from(T target)
Start a lazy evaluation.
|
T |
getObject()
Get the evaluation result.
|
Class<T> |
getObjectClass()
Get the evaluation result's class.
|
Type |
getObjectType()
Get the evaluation result's type.
|
String |
getPath()
Get the invoked method path for the evaluation.
|
Field |
getPropertyField()
LazyModel does not support field access.
|
Method |
getPropertyGetter()
Get the final getter of the evaluation.
|
Method |
getPropertySetter()
Get the final setter of the evaluation.
|
Object |
getTarget()
Get the target of this evaluation.
|
org.apache.wicket.model.IModel<T> |
loadableDetachable()
Wrap this model in a
LoadableDetachableModel. |
static <R> LazyModel<R> |
model(R result)
Create a model for the given evaluation result.
|
static <R> String |
path(R result)
Get the method invocation path for an evaluation.
|
void |
setObject(T result)
Set the evaluation result.
|
String |
toString()
String representation of the evaluation.
|
public static IMethodResolver methodResolver
Methods.protected final Object target
protected final Object stack
public org.apache.wicket.model.IModel<T> loadableDetachable()
LoadableDetachableModel.public Class<T> getObjectClass()
getObjectClass in interface org.apache.wicket.model.IObjectClassAwareModel<T>null if it cannot be determinedpublic Type getObjectType()
getObjectType in interface IObjectTypeAwareModel<T>Class, ParameterizedType or null if not availablepublic Field getPropertyField()
getPropertyField in interface org.apache.wicket.model.IPropertyReflectionAwareModel<T>nullpublic Method getPropertyGetter()
getPropertyGetter in interface org.apache.wicket.model.IPropertyReflectionAwareModel<T>nullpublic Method getPropertySetter()
getPropertySetter in interface org.apache.wicket.model.IPropertyReflectionAwareModel<T>nullpublic void detach()
detach in interface org.apache.wicket.model.IDetachablepublic T getObject()
getObject in interface org.apache.wicket.model.IModel<T>org.apache.wicket.WicketRuntimeException - if this model is not bound to a targetpublic void setObject(T result)
setObject in interface org.apache.wicket.model.IModel<T>evaluation - resultorg.apache.wicket.WicketRuntimeException - if this model is not bound to a targetpublic Object getTarget()
null if this model is not bound to a
targetpublic LazyModel<T> bind(Object target)
target - target to bind topublic String toString()
public String getPath()
For evaluations accessing simple properties only, the representation
equals the property expression of a corresponding PropertyModel.
org.apache.wicket.WicketRuntimeException - if this model is not boundAbstractPropertyModel.getPropertyExpression()public static <T> T from(T target)
target - the target objectpublic static <T> T from(Class<T> targetType)
targetType - class of target objectpublic static <T> T from(org.apache.wicket.model.IModel<T> target)
target - model holding the target objectpublic static <R> LazyModel<R> model(R result)
result - evaluation resultpublic static <R> String path(R result)
result - evaluation resultCopyright © 2015. All rights reserved.