Package io.github.astrapi69.model.util
Class CollectionModel<T>
- java.lang.Object
-
- io.github.astrapi69.model.GenericModel<T>
-
- io.github.astrapi69.model.util.GenericCollectionModel<java.util.Collection<T>>
-
- io.github.astrapi69.model.util.CollectionModel<T>
-
- Type Parameters:
T
- type of object inside collection
- All Implemented Interfaces:
Attachable
,IDetachable
,IModel<java.util.Collection<T>>
,IObjectClassAwareModel<java.util.Collection<T>>
,java.io.Serializable
public class CollectionModel<T> extends GenericCollectionModel<java.util.Collection<T>>
Based onIModel
but for any collections of serializable objects.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectionModel()
CollectionModel(java.util.Collection<T> collection)
Creates model that will containcollection
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<T>
newSerializableCollectionOf(java.util.Collection<T> object)
Creates a serializable version of the object.static <C> IModel<java.util.Collection<C>>
of(java.util.Collection<C> collection)
Factory method for models that contain collections.-
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
-
CollectionModel
public CollectionModel(java.util.Collection<T> collection)
Creates model that will containcollection
.- Parameters:
collection
- the collection
-
CollectionModel
public CollectionModel()
-
-
Method Detail
-
of
public static <C> IModel<java.util.Collection<C>> of(java.util.Collection<C> collection)
Factory method for models that contain collections. This factory method will automatically rebuild a nonserializablecollection
into a serializableArrayList
.- Type Parameters:
C
- model type- Parameters:
collection
- The Collection, which may or may not be Serializable- Returns:
- A IModel object wrapping the Set
-
newSerializableCollectionOf
protected java.util.Collection<T> newSerializableCollectionOf(java.util.Collection<T> object)
Creates a serializable version of the object. The object is usually a collection.- Specified by:
newSerializableCollectionOf
in classGenericCollectionModel<java.util.Collection<T>>
- Parameters:
object
- the object- Returns:
- serializable version of
object
-
-