Package org.apache.wicket.model
Class AbstractPropertyModel<T>
- java.lang.Object
-
- org.apache.wicket.model.ChainingModel<T>
-
- org.apache.wicket.model.AbstractPropertyModel<T>
-
- Type Parameters:
T- The Model object type
- All Implemented Interfaces:
Serializable,IDetachable,IModel<T>,IObjectClassAwareModel<T>,IPropertyReflectionAwareModel<T>,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
PropertyModel
public abstract class AbstractPropertyModel<T> extends ChainingModel<T> implements IObjectClassAwareModel<T>, IPropertyReflectionAwareModel<T>
Serves as a base class for different kinds of property models. By default, this class usesPropertyResolverto resolve expressions on the target model object. Note that the property resolver by default provides access to private members and methods. If guaranteeing encapsulation of the target objects is a big concern, you should consider using an alternative implementation.- Author:
- Chris Turner, Eelco Hillenius, Jonathan Locke
- See Also:
PropertyResolver,IDetachable, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPropertyModel(Object modelObject)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description TgetObject()Gets the model object.Class<T>getObjectClass()Returns the class of model objectStringgetPropertyExpression()Gets the property expression for this modelFieldgetPropertyField()Returns the field of model property or null if the field doesn't exist.MethodgetPropertyGetter()Returns the getter method of model property or null if the method doesn't exist.MethodgetPropertySetter()Returns the setter method of model property or null if the method doesn't exist.protected abstract StringpropertyExpression()voidsetObject(T object)Applies the property expression on the model object using the given object argument.-
Methods inherited from class org.apache.wicket.model.ChainingModel
detach, getChainedModel, getInnermostModelOrObject, getTarget, setTarget, toString
-
-
-
-
Constructor Detail
-
AbstractPropertyModel
public AbstractPropertyModel(Object modelObject)
Constructor- Parameters:
modelObject- The nested model object
-
-
Method Detail
-
getPropertyExpression
public final String getPropertyExpression()
Gets the property expression for this model- Returns:
- The property expression
-
setObject
public void setObject(T object)
Applies the property expression on the model object using the given object argument.- Specified by:
setObjectin interfaceIModel<T>- Overrides:
setObjectin classChainingModel<T>- Parameters:
object- The object that will be used when setting a value on the model object- See Also:
IModel.setObject(Object)
-
getObjectClass
public Class<T> getObjectClass()
Description copied from interface:IObjectClassAwareModelReturns the class of model object- Specified by:
getObjectClassin interfaceIObjectClassAwareModel<T>- Returns:
- model object class
-
getPropertyField
public Field getPropertyField()
Description copied from interface:IPropertyReflectionAwareModelReturns the field of model property or null if the field doesn't exist.- Specified by:
getPropertyFieldin interfaceIPropertyReflectionAwareModel<T>- Returns:
- Field or null
-
getPropertyGetter
public Method getPropertyGetter()
Description copied from interface:IPropertyReflectionAwareModelReturns the getter method of model property or null if the method doesn't exist.- Specified by:
getPropertyGetterin interfaceIPropertyReflectionAwareModel<T>- Returns:
- Method or null
-
getPropertySetter
public Method getPropertySetter()
Description copied from interface:IPropertyReflectionAwareModelReturns the setter method of model property or null if the method doesn't exist.- Specified by:
getPropertySetterin interfaceIPropertyReflectionAwareModel<T>- Returns:
- Method or null
-
propertyExpression
protected abstract String propertyExpression()
- Returns:
- The property expression for the component
-
-