Package org.apache.wicket.model
Class CompoundPropertyModel<T>
- java.lang.Object
-
- org.apache.wicket.model.ChainingModel<T>
-
- org.apache.wicket.model.CompoundPropertyModel<T>
-
- Type Parameters:
T
- The model object type
- All Implemented Interfaces:
Serializable
,IComponentInheritedModel<T>
,IDetachable
,IModel<T>
,IClusterable
public class CompoundPropertyModel<T> extends ChainingModel<T> implements IComponentInheritedModel<T>
A simple compound model which uses the component's name as the property expression to retrieve properties on the nested model object. CompoundPropertyModel is a chaining model so it will call get/setobject on the given object if the object is an instanceof IModel itself.- Author:
- Jonathan Locke
- See Also:
IModel
,Model
,LoadableDetachableModel
,ChainingModel
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CompoundPropertyModel(IModel<T> model)
ConstructorCompoundPropertyModel(T object)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <S> IModel<S>
bind(String property)
Binds this model to a special property by returning a model that has this compound model as its nested/wrapped model and the property which should be evaluated.static <Z> CompoundPropertyModel<Z>
of(IModel<Z> model)
Type-infering factory methodstatic <Z extends Serializable>
CompoundPropertyModel<Z>of(Z object)
Type-infering factory methodprotected String
propertyExpression(Component component)
Returns the property expression that should be used against the target object<C> IWrapModel<C>
wrapOnInheritance(Component component)
-
Methods inherited from class org.apache.wicket.model.ChainingModel
detach, getChainedModel, getInnermostModelOrObject, getObject, getTarget, setObject, setTarget, toString
-
-
-
-
Constructor Detail
-
CompoundPropertyModel
public CompoundPropertyModel(IModel<T> model)
Constructor- Parameters:
model
- The model
-
CompoundPropertyModel
public CompoundPropertyModel(T object)
Constructor- Parameters:
object
- The model object
-
-
Method Detail
-
propertyExpression
protected String propertyExpression(Component component)
Returns the property expression that should be used against the target object- Parameters:
component
-- Returns:
- property expression that should be used against the target object
-
wrapOnInheritance
public <C> IWrapModel<C> wrapOnInheritance(Component component)
- Specified by:
wrapOnInheritance
in interfaceIComponentInheritedModel<T>
- Type Parameters:
C
- the model object type of the wrapped model- Returns:
- The WrapModel that wraps this model
-
bind
public <S> IModel<S> bind(String property)
Binds this model to a special property by returning a model that has this compound model as its nested/wrapped model and the property which should be evaluated. This can be used if the id of the Component isn't a valid property for the data object.- Type Parameters:
S
- the type of the property- Parameters:
property
- the name that will be used to find- Returns:
- The IModel that is a wrapper around the current model and the property
-
of
public static <Z> CompoundPropertyModel<Z> of(IModel<Z> model)
Type-infering factory method- Type Parameters:
Z
- the type of the model's object- Parameters:
model
- model- Returns:
CompoundPropertyModel
instance
-
of
public static <Z extends Serializable> CompoundPropertyModel<Z> of(Z object)
Type-infering factory method- Type Parameters:
Z
- the type of the model's object- Parameters:
object
- model object- Returns:
CompoundPropertyModel
instance
-
-