Package io.github.astrapi69.model
Class SerializableModel<T extends java.io.Serializable>
- java.lang.Object
-
- io.github.astrapi69.model.GenericModel<T>
-
- io.github.astrapi69.model.SerializableModel<T>
-
- Type Parameters:
T
- the generic type of the model object
- All Implemented Interfaces:
Attachable
,IDetachable
,IModel<T>
,IObjectClassAwareModel<T>
,java.io.Serializable
public class SerializableModel<T extends java.io.Serializable> extends GenericModel<T>
The classSerializableModel
contains only model object that implements theSerializable
interface.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SerializableModel()
SerializableModel(T object)
Instantiates a newSerializableModel
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(java.lang.Object other)
boolean
equals(java.lang.Object o)
int
hashCode()
static <T extends java.io.Serializable>
IModel<T>of()
Factory methods for IModel which uses type inference to make code shorter.static <T> IModel<T>
of(IModel<?> model)
Supresses generics warning when converting model types.static <T extends java.io.Serializable>
IModel<T>of(T object)
Factory methods for IModel which uses type inference to make code shorter.void
setObject(T object)
Set the model object; calls setObject(java.io.Serializable).java.lang.String
toString()
-
Methods inherited from class io.github.astrapi69.model.GenericModel
attach, detach, getObject, getObjectClass, ofCollection, ofList, ofMap, ofSet
-
-
-
-
Constructor Detail
-
SerializableModel
public SerializableModel(T object)
Instantiates a newSerializableModel
.- Parameters:
object
- the object
-
SerializableModel
public SerializableModel()
-
-
Method Detail
-
of
public static <T extends java.io.Serializable> IModel<T> of()
Factory methods for IModel which uses type inference to make code shorter. Equivalent tonew SerializableModel<TypeOfObject>()
.- Type Parameters:
T
- the generic type- Returns:
- IModel that contains
object
-
of
public static <T> IModel<T> of(IModel<?> model)
Supresses generics warning when converting model types.- Type Parameters:
T
- the generic type- Parameters:
model
- the model- Returns:
model
-
of
public static <T extends java.io.Serializable> IModel<T> of(T object)
Factory methods for IModel which uses type inference to make code shorter. Equivalent tonew IModel<TypeOfObject>(object)
.- Type Parameters:
T
- the generic type- Parameters:
object
- the object- Returns:
- IModel 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classGenericModel<T extends java.io.Serializable>
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classGenericModel<T extends java.io.Serializable>
-
canEqual
protected boolean canEqual(java.lang.Object other)
- Overrides:
canEqual
in classGenericModel<T extends java.io.Serializable>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGenericModel<T extends java.io.Serializable>
-
-