Hi Dan,

Thanks, I didn't know about MetaDataKey- that cleans it up nicely:

public class SessionModel<T extends Serializable> implements IModel<T>
{
    protected MetaDataKey<T> key;

    public SessionModel(MetaDataKey<T> key)
    {
        this.key = key;
    }

    public SessionModel(MetaDataKey<T> key, T object)
    {
        this.key = key;
        setObject(object);
    }

    public T getObject()
    {
        return Session.get().getMetaData(key);
    }

    public void setObject(T object)
    {
        Session.get().setMetaData(key, object);
    }

    public void detach()
    {
        // no-op
    }

}

And then in MyDTO:

public static final MetaDataKey KEY = new MetaDataKey<MyDTO>() { };



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-model-for-passing-data-between-pages-tp4542878p4545388.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to