Package io.github.astrapi69.model.util
Class ListModel<T>
- java.lang.Object
-
- io.github.astrapi69.model.GenericModel<T>
-
- io.github.astrapi69.model.util.GenericCollectionModel<java.util.List<T>>
-
- io.github.astrapi69.model.util.ListModel<T>
-
- Type Parameters:
T
- type of object inside list
- All Implemented Interfaces:
Attachable
,IDetachable
,IModel<java.util.List<T>>
,IObjectClassAwareModel<java.util.List<T>>
,java.io.Serializable
public class ListModel<T> extends GenericCollectionModel<java.util.List<T>>
Based onIModel
but for lists of serializable objects.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<T>
newSerializableCollectionOf(java.util.List<T> object)
Creates a serializable version of the object.static <C> IModel<java.util.List<C>>
of(java.util.List<C> list)
Factory method for models that contain list.-
Methods inherited from class io.github.astrapi69.model.util.GenericCollectionModel
canEqual, equals, hashCode, setObject, toString
-
Methods inherited from class io.github.astrapi69.model.GenericModel
attach, detach, getObject, getObjectClass, ofCollection, ofList, ofMap, ofSet
-
-
-
-
Constructor Detail
-
ListModel
public ListModel(java.util.List<T> list)
Creates model that will containlist
.- Parameters:
list
- the list
-
ListModel
public ListModel()
-
-
Method Detail
-
of
public static <C> IModel<java.util.List<C>> of(java.util.List<C> list)
Factory method for models that contain list. This factory method will automatically rebuild a nonserializablelist
into a serializableArrayList
.- Type Parameters:
C
- model type- Parameters:
list
- The list, which may or may not be Serializable- Returns:
- A IModel object wrapping the Set
-
newSerializableCollectionOf
protected java.util.List<T> newSerializableCollectionOf(java.util.List<T> object)
Creates a serializable version of the object. The object is usually a collection.- Specified by:
newSerializableCollectionOf
in classGenericCollectionModel<java.util.List<T>>
- Parameters:
object
- the object- Returns:
- serializable version of
object
-
-