Package io.github.astrapi69.model.util
Class SetModel<T>
- java.lang.Object
-
- io.github.astrapi69.model.GenericModel<T>
-
- io.github.astrapi69.model.util.GenericCollectionModel<java.util.Set<T>>
-
- io.github.astrapi69.model.util.SetModel<T>
-
- Type Parameters:
T
- type of object inside set
- All Implemented Interfaces:
Attachable
,IDetachable
,IModel<java.util.Set<T>>
,IObjectClassAwareModel<java.util.Set<T>>
,java.io.Serializable
public class SetModel<T> extends GenericCollectionModel<java.util.Set<T>>
Based onIModel
but for sets 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.Set<T>
newSerializableCollectionOf(java.util.Set<T> object)
Creates a serializable version of the object.static <C> IModel<java.util.Set<C>>
ofSet(java.util.Set<C> set)
Factory method for models that contain sets.-
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
-
-
-
-
Constructor Detail
-
SetModel
public SetModel(java.util.Set<T> set)
Creates model that will containset
.- Parameters:
set
- the set
-
SetModel
public SetModel()
-
-
Method Detail
-
ofSet
public static <C> IModel<java.util.Set<C>> ofSet(java.util.Set<C> set)
Factory method for models that contain sets. This factory method will automatically rebuild a nonserializableset
into a serializable one.- Type Parameters:
C
- model type- Parameters:
set
- The Set, which may or may not be Serializable- Returns:
- A IModel object wrapping the Set
-
newSerializableCollectionOf
protected java.util.Set<T> newSerializableCollectionOf(java.util.Set<T> object)
Creates a serializable version of the object. The object is usually a collection.- Specified by:
newSerializableCollectionOf
in classGenericCollectionModel<java.util.Set<T>>
- Parameters:
object
- the object- Returns:
- serializable version of
object
-
-