Package org.apache.wicket.model
Class ChainingModel<T>
- java.lang.Object
-
- org.apache.wicket.model.ChainingModel<T>
-
- Type Parameters:
T
- The Model object type
- All Implemented Interfaces:
Serializable
,IDetachable
,IModel<T>
,IClusterable
- Direct Known Subclasses:
AbstractPropertyModel
,CompoundPropertyModel
public class ChainingModel<T> extends Object implements IModel<T>
This model and its subclasses support chaining of IModels.getObject()
ofChainingModel
returns its object like this:if ( object instanceof IModel) { return ((IModel)object).getObject()} else return object;
ChainingModel also detaches the inner model on detach.- Since:
- 6.0.0
- See Also:
CompoundPropertyModel
,AbstractPropertyModel
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ChainingModel(Object modelObject)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detach()
Unsets this property model's instance variables and detaches the model.IModel<?>
getChainedModel()
Object
getInnermostModelOrObject()
T
getObject()
Gets the model object.Object
getTarget()
void
setObject(T object)
Sets the model object.protected ChainingModel<T>
setTarget(Object modelObject)
Sets a new target - object or modelString
toString()
-
-
-
Constructor Detail
-
ChainingModel
public ChainingModel(Object modelObject)
-
-
Method Detail
-
detach
public void detach()
Unsets this property model's instance variables and detaches the model.- Specified by:
detach
in interfaceIDetachable
- Specified by:
detach
in interfaceIModel<T>
- See Also:
IDetachable.detach()
-
setObject
public void setObject(T object)
Description copied from interface:IModel
Sets the model object.
-
setTarget
protected final ChainingModel<T> setTarget(Object modelObject)
Sets a new target - object or model- Returns:
- this object
-
getChainedModel
public IModel<?> getChainedModel()
- Returns:
- The target - if it is a model, null otherwise
-
getInnermostModelOrObject
public final Object getInnermostModelOrObject()
- Returns:
- The innermost model or the object if the target is not a model
-
-