Class GenericBaseModel<T>

  • Type Parameters:
    T - type of model object
    All Implemented Interfaces:
    java.io.Serializable, IDetachable, IModel<T>, IObjectClassAwareModel<T>, org.apache.wicket.util.io.IClusterable
    Direct Known Subclasses:
    CollectionModel, ListModel, MapModel, SetModel

    public abstract class GenericBaseModel<T>
    extends java.lang.Object
    implements IObjectClassAwareModel<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 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
      • 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
        Specified by:
        detach in interface IModel<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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