Package org.apache.wicket.model.util
Class GenericBaseModel<T>
- java.lang.Object
-
- org.apache.wicket.model.util.GenericBaseModel<T>
-
- Type Parameters:
T
- type of model object
- All Implemented Interfaces:
Serializable
,IDetachable
,IModel<T>
,IObjectClassAwareModel<T>
,IClusterable
- Direct Known Subclasses:
CollectionModel
,ListModel
,MapModel
,SetModel
public abstract class GenericBaseModel<T> extends Object implements IObjectClassAwareModel<T>
Base class for models that contain instances that do not appear to be serializable and cannot thus useModel
directly. Makes sure that the object set into the model can be serialized.- Author:
- Timo Rantalaiho
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GenericBaseModel()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
createSerializableVersionOf(T object)
Creates a serializable version of the object.void
detach()
Detaches model after use.boolean
equals(Object obj)
T
getObject()
Gets the model object.Class<T>
getObjectClass()
Returns the class of model objectint
hashCode()
void
setObject(T object)
Set the model object.String
toString()
-
-
-
Constructor Detail
-
GenericBaseModel
public GenericBaseModel()
-
-
Method Detail
-
setObject
public void setObject(T object)
Set the model object. The contents must be serializable, as they are stored in the session- Specified by:
setObject
in interfaceIModel<T>
- Parameters:
object
- the model object- See Also:
IModel.setObject(Object)
-
createSerializableVersionOf
protected abstract T createSerializableVersionOf(T object)
Creates a serializable version of the object. The object is usually a collection.- Parameters:
object
-- Returns:
- serializable version of
object
-
detach
public void detach()
Description copied from interface:IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.- Specified by:
detach
in interfaceIDetachable
- Specified by:
detach
in interfaceIModel<T>
-
getObjectClass
public Class<T> getObjectClass()
Description copied from interface:IObjectClassAwareModel
Returns the class of model object- Specified by:
getObjectClass
in interfaceIObjectClassAwareModel<T>
- Returns:
- class of model object or null if the class couldn't be determined
-
-