org.apache.wicket.model
Class Model

java.lang.Object
  extended by org.apache.wicket.model.Model
All Implemented Interfaces:
java.io.Serializable, IClusterable, IDetachable, IModel

public class Model
extends java.lang.Object
implements IModel

Model is the basic implementation of an IModel. It just wraps a simple model object. The model object must be serializable, as it is stored in the session. If you have large objects to store, consider using LoadableDetachableModel instead of this class.

Author:
Chris Turner, Eelco Hillenius
See Also:
Serialized Form

Constructor Summary
Model()
          Construct the model without providing an object.
Model(java.io.Serializable object)
          Construct the model, setting the given object as the wrapped object.
 
Method Summary
 void detach()
          Detaches model after use.
 java.lang.Object getObject()
          Gets the model object.
 java.lang.Object getObject(Component component)
          Deprecated. replace by IModel.getObject().
 void setObject(Component component, java.lang.Object object)
          Deprecated. replace by IModel.setObject(Object).
 void setObject(java.lang.Object object)
          Set the model object; calls setObject(java.io.Serializable).
 void setObject(java.io.Serializable object)
          Sets the model object.
 java.lang.String toString()
           
static Model valueOf(java.util.List list)
           
static Model valueOf(java.util.Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Model

public Model()
Construct the model without providing an object.


Model

public Model(java.io.Serializable object)
Construct the model, setting the given object as the wrapped object.

Parameters:
object - The model object proper
Method Detail

valueOf

public static Model valueOf(java.util.Map map)
Parameters:
map - The Map, which may or may not be Serializable
Returns:
A Model object wrapping the Map

valueOf

public static Model valueOf(java.util.List list)
Parameters:
list - The List, which may or may not be Serializable
Returns:
A Model object wrapping the List

getObject

public java.lang.Object getObject()
Description copied from interface: IModel
Gets the model object.

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

setObject

public void setObject(java.lang.Object object)
Set the model object; calls setObject(java.io.Serializable). The model object must be serializable, as it is stored in the session

Specified by:
setObject in interface IModel
Parameters:
object - the model object
See Also:
IModel.setObject(Object)

setObject

public void setObject(java.io.Serializable object)
Sets the model object. The model object must be serializable, as it is stored in the session

Parameters:
object - The serializable model object
See Also:
IModel.setObject(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()

getObject

public final java.lang.Object getObject(Component component)
Deprecated. replace by IModel.getObject().

Parameters:
component -
Returns:

setObject

public final void setObject(Component component,
                            java.lang.Object object)
Deprecated. replace by IModel.setObject(Object).

Parameters:
component -
object -


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.