public class SerializedObjectConverter extends java.lang.Object implements Converter, org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired
Purpose: The serialized object converter can be used to store an arbitrary object or set of objects into a database binary or character field. By default it uses the Java serializer so the target must be serializable. A custom Serializer can also be specified, such as XML or JSON.
Serializer
,
XMLSerializer
,
JSONSerializer
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected DatabaseMapping |
mapping |
protected Serializer |
serializer |
protected java.lang.String |
serializerClassName |
protected java.lang.String |
serializerPackage |
Constructor and Description |
---|
SerializedObjectConverter()
PUBLIC:
Default constructor.
|
SerializedObjectConverter(DatabaseMapping mapping)
PUBLIC:
Default constructor.
|
SerializedObjectConverter(DatabaseMapping mapping,
Serializer serializer)
PUBLIC:
Default constructor.
|
SerializedObjectConverter(DatabaseMapping mapping,
java.lang.String serializerClassName)
PUBLIC:
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this converter to actual class-based
settings.
|
java.lang.Object |
convertDataValueToObjectValue(java.lang.Object fieldValue,
Session session)
INTERNAL:
The fieldValue will be a byte array.
|
java.lang.Object |
convertObjectValueToDataValue(java.lang.Object attributeValue,
Session session)
INTERNAL:
Convert the object to a byte array through serialize.
|
protected DatabaseMapping |
getMapping()
INTERNAL:
Return the mapping.
|
Serializer |
getSerializer()
Return the serialize used for this converter.
|
java.lang.String |
getSerializerClassName()
Return the class name of the serializer.
|
java.lang.String |
getSerializerPackage()
Return the package used for XML and JSON serialization JAXBContext.
|
void |
initialize(DatabaseMapping mapping,
Session session)
INTERNAL:
Set the mapping.
|
boolean |
isMutable()
INTERNAL:
If the converter converts the value to a non-atomic value, i.e.
|
void |
setSerializer(Serializer serializer)
Set the serialize used for this converter.
|
void |
setSerializerClassName(java.lang.String serializerClassName)
Set the class name of the serializer.
|
void |
setSerializerPackage(java.lang.String serializerPackage)
Set the package used for XML and JSON serialization JAXBContext.
|
protected DatabaseMapping mapping
protected Serializer serializer
protected java.lang.String serializerClassName
protected java.lang.String serializerPackage
public SerializedObjectConverter()
public SerializedObjectConverter(DatabaseMapping mapping)
public SerializedObjectConverter(DatabaseMapping mapping, Serializer serializer)
public SerializedObjectConverter(DatabaseMapping mapping, java.lang.String serializerClassName)
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
convertClassNamesToClasses
in interface org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired
classLoader
- public java.lang.Object convertDataValueToObjectValue(java.lang.Object fieldValue, Session session) throws DescriptorException
convertDataValueToObjectValue
in interface CoreConverter<DatabaseMapping,Session>
convertDataValueToObjectValue
in interface Converter
DescriptorException
public java.lang.Object convertObjectValueToDataValue(java.lang.Object attributeValue, Session session)
convertObjectValueToDataValue
in interface CoreConverter<DatabaseMapping,Session>
convertObjectValueToDataValue
in interface Converter
public void initialize(DatabaseMapping mapping, Session session)
initialize
in interface CoreConverter<DatabaseMapping,Session>
initialize
in interface Converter
protected DatabaseMapping getMapping()
public boolean isMutable()
public Serializer getSerializer()
public void setSerializer(Serializer serializer)
public java.lang.String getSerializerClassName()
public void setSerializerClassName(java.lang.String serializerClassName)
public java.lang.String getSerializerPackage()
public void setSerializerPackage(java.lang.String serializerPackage)