Class Model<T extends Serializable>

    • Constructor Detail

      • Model

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

        public Model​(T object)
        Construct the model, setting the given object as the wrapped object.
        Parameters:
        object - The model object proper
    • Method Detail

      • ofList

        public static <C> IModel<List<C>> ofList​(List<C> list)
        Factory method for models that contain lists. This factory method will automatically rebuild a non-serializable list into a serializable one.
        Type Parameters:
        C - model type
        Parameters:
        list - The List, which may or may not be Serializable
        Returns:
        A Model object wrapping the List
      • ofMap

        public static <K,​V> IModel<Map<K,​V>> ofMap​(Map<K,​V> map)
        Factory method for models that contain maps. This factory method will automatically rebuild a non-serializable map into a serializable one.
        Type Parameters:
        K - key type in map
        V - value type in map
        Parameters:
        map - The Map, which may or may not be Serializable
        Returns:
        A Model object wrapping the Map
      • ofSet

        public static <C> IModel<Set<C>> ofSet​(Set<C> set)
        Factory method for models that contain sets. This factory method will automatically rebuild a non-serializable set into a serializable one.
        Type Parameters:
        C - model type
        Parameters:
        set - The Set, which may or may not be Serializable
        Returns:
        A Model object wrapping the Set
      • of

        public static <C> IModel<Collection<C>> of​(Collection<C> collection)
        Factory method for models that contain collections. This factory method will automatically rebuild a non-serializable collection into a serializable ArrayList.
        Type Parameters:
        C - model type
        Parameters:
        collection - The Collection, which may or may not be Serializable
        Returns:
        A Model object wrapping the Set
      • of

        public static <T extends SerializableModel<T> of​(T object)
        Factory methods for Model which uses type inference to make code shorter. Equivalent to new Model(object).
        Type Parameters:
        T -
        Parameters:
        object -
        Returns:
        Model that contains object
      • of

        public static <T extends SerializableModel<T> of()
        Factory methods for Model which uses type inference to make code shorter. Equivalent to new Model().
        Type Parameters:
        T -
        Returns:
        Model that contains object
      • setObject

        public void setObject​(T 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<T extends Serializable>
        Parameters:
        object - the 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
        Specified by:
        detach in interface IModel<T extends Serializable>