org.apache.wicket.model.util
Class GenericBaseModel<T>

java.lang.Object
  extended by org.apache.wicket.model.util.GenericBaseModel<T>
Type Parameters:
T - type of model object
All Implemented Interfaces:
java.io.Serializable, IClusterable, IDetachable, IModel<T>
Direct Known Subclasses:
CollectionModel, ListModel, MapModel, SetModel, WicketTreeModel, WildcardCollectionModel, WildcardListModel, WildcardSetModel

public abstract class GenericBaseModel<T>
extends java.lang.Object
implements IModel<T>

Base class for models that contain instances that do not appear to be serializable and cannot thus use Model directly. Makes sure that the object set into the model can be serialized.

Author:
Timo Rantalaiho
See Also:
Serialized Form

Constructor Summary
GenericBaseModel()
           
 
Method Summary
protected abstract  T createSerializableVersionOf(T object)
          Creates a serializable version of the object.
 void detach()
          Detaches model after use.
 boolean equals(java.lang.Object obj)
          
 T getObject()
          Gets the model object.
 int hashCode()
          
 void setObject(T object)
          Set the model object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GenericBaseModel

public GenericBaseModel()
Method Detail

getObject

public T getObject()
Description copied from interface: IModel
Gets the model object.

Specified by:
getObject in interface IModel<T>
Returns:
The model object
See Also:
IModel.getObject()

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 interface IModel<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 interface IDetachable
See Also:
IDetachable.detach()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.