wicket.model
Class Model

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

public class Model
extends AbstractModel

Model is the basic implementation of an AbstractModel. 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 AbstractDetachableModelinstead 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
 IModel getNestedModel()
          This default implementation of getNestedModel unconditionally returns null.
 java.lang.Object getObject(Component component)
          Gets the model object.
 void setObject(Component component, 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 wicket.model.AbstractModel
detach
 
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

getNestedModel

public IModel getNestedModel()
Description copied from class: AbstractModel
This default implementation of getNestedModel unconditionally returns null.

Specified by:
getNestedModel in interface IModel
Overrides:
getNestedModel in class AbstractModel
Returns:
null
See Also:
IModel.getNestedModel()

getObject

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

Parameters:
component - The component which wants to get a model Object
Returns:
The model object
See Also:
IModel.getObject(wicket.Component)

setObject

public void setObject(Component component,
                      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

Parameters:
object - the model object
component - The component which wants to set a new model Object
See Also:
IModel.setObject(Component, 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(Component, Object)

toString

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


Copyright © 2004-2007 Wicket developers. All Rights Reserved.