Package com.exedio.cope.pattern
Class Serializer<E>
- java.lang.Object
-
- com.exedio.cope.Feature
-
- com.exedio.cope.Pattern
-
- com.exedio.cope.pattern.Serializer<E>
-
- All Implemented Interfaces:
Settable<E>
,Serializable
public final class Serializer<E> extends Pattern implements Settable<E>
Stores a java object by serialization - use with care!Stores serializable objects into a backing
DataField
. BEWARE: Generally this is not a good idea. In contrast to normal fields, such asStringField
,DateField
, etc. there is no searching, order by or caching. The main purpose is to maintain database compatibility to legacy systems.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> Serializer<E>
create(Class<E> valueClass)
static <E> Serializer<E>
create(Class<E> valueClass, DataField source)
SetValue<?>[]
execute(E value, Item exceptionItem)
E
get(Item item)
Set<Class<? extends Throwable>>
getInitialExceptions()
Returns the exceptions possibly thrown, when setting a value for this settable.Class<?>
getInitialType()
DataField
getSource()
boolean
isFinal()
Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.boolean
isInitial()
Returns true, if a value for the settable should be specified on the creation of an item.boolean
isMandatory()
static <E> Serializer<E>
newSerializer(Class<E> valueClass)
Deprecated.Usecreate(Class)
insteadstatic <E> Serializer<E>
newSerializer(Class<E> valueClass, DataField source)
Deprecated.Usecreate(Class,DataField)
insteadSerializer<E>
optional()
void
set(Item item, E value)
-
Methods inherited from class com.exedio.cope.Pattern
addSource, addSource, addSource, addSource, addSourceFeature, addSourceFeature, addSourceFeature, annotationField, equals, getGeneratedTypes, getSourceFeatures, getSourceFeaturesGather, getSourceFields, getSources, getSourceTypes, getType, hashCode, initialize, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newType, newType, onMount, registerSource
-
Methods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
-
-
-
Method Detail
-
create
public static <E> Serializer<E> create(Class<E> valueClass, DataField source)
-
create
public static <E> Serializer<E> create(Class<E> valueClass)
-
optional
public Serializer<E> optional()
-
getSource
public DataField getSource()
-
isInitial
public boolean isInitial()
Description copied from interface:Settable
Returns true, if a value for the settable should be specified on the creation of an item.
-
isFinal
public boolean isFinal()
Description copied from interface:Settable
Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.
-
isMandatory
public boolean isMandatory()
- Specified by:
isMandatory
in interfaceSettable<E>
-
getInitialType
public Class<?> getInitialType()
- Specified by:
getInitialType
in interfaceSettable<E>
-
getInitialExceptions
public Set<Class<? extends Throwable>> getInitialExceptions()
Description copied from interface:Settable
Returns the exceptions possibly thrown, when setting a value for this settable.- Specified by:
getInitialExceptions
in interfaceSettable<E>
-
newSerializer
@Deprecated public static <E> Serializer<E> newSerializer(Class<E> valueClass, DataField source)
Deprecated.Usecreate(Class,DataField)
instead
-
newSerializer
@Deprecated public static <E> Serializer<E> newSerializer(Class<E> valueClass)
Deprecated.Usecreate(Class)
instead
-
-