Class SerializedObjectConverter
java.lang.Object
org.eclipse.persistence.mappings.converters.SerializedObjectConverter
- All Implemented Interfaces:
Serializable,CoreConverter<DatabaseMapping,,Session> org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired,Converter
public class SerializedObjectConverter
extends 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.
- See Also:
- Author:
- James Sutherland
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DatabaseMappingprotected Serializerprotected Stringprotected String -
Constructor Summary
ConstructorsConstructorDescriptionPUBLIC: Default constructor.SerializedObjectConverter(DatabaseMapping mapping) PUBLIC: Default constructor.SerializedObjectConverter(DatabaseMapping mapping, String serializerClassName) PUBLIC: Default constructor.SerializedObjectConverter(DatabaseMapping mapping, Serializer serializer) PUBLIC: Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidconvertClassNamesToClasses(ClassLoader classLoader) INTERNAL: Convert all the class-name-based settings in this converter to actual class-based settings.convertDataValueToObjectValue(Object fieldValue, Session session) INTERNAL: The fieldValue will be a byte array.convertObjectValueToDataValue(Object attributeValue, Session session) INTERNAL: Convert the object to a byte array through serialize.protected DatabaseMappingINTERNAL: Return the mapping.Return the serialize used for this converter.Return the class name of the serializer.Return the package used for XML and JSON serialization JAXBContext.voidinitialize(DatabaseMapping mapping, Session session) INTERNAL: Set the mapping.booleanINTERNAL: If the converter converts the value to a non-atomic value, i.e.voidsetSerializer(Serializer serializer) Set the serialize used for this converter.voidsetSerializerClassName(String serializerClassName) Set the class name of the serializer.voidsetSerializerPackage(String serializerPackage) Set the package used for XML and JSON serialization JAXBContext.
-
Field Details
-
mapping
-
serializer
-
serializerClassName
-
serializerPackage
-
-
Constructor Details
-
SerializedObjectConverter
public SerializedObjectConverter()PUBLIC: Default constructor. -
SerializedObjectConverter
PUBLIC: Default constructor. -
SerializedObjectConverter
PUBLIC: Default constructor. -
SerializedObjectConverter
PUBLIC: Default constructor.
-
-
Method Details
-
convertClassNamesToClasses
INTERNAL: Convert all the class-name-based settings in this converter to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes. This method is implemented by subclasses as necessary.- Specified by:
convertClassNamesToClassesin interfaceorg.eclipse.persistence.internal.descriptors.ClassNameConversionRequired- Parameters:
classLoader-
-
convertDataValueToObjectValue
public Object convertDataValueToObjectValue(Object fieldValue, Session session) throws DescriptorException INTERNAL: The fieldValue will be a byte array. Create a ByteArrayInputStream on the fieldValue. Create an ObjectInputStream on the ByteArrayInputStream to read in the objects.- Specified by:
convertDataValueToObjectValuein interfaceConverter- Specified by:
convertDataValueToObjectValuein interfaceCoreConverter<DatabaseMapping,Session> - Throws:
DescriptorException
-
convertObjectValueToDataValue
INTERNAL: Convert the object to a byte array through serialize.- Specified by:
convertObjectValueToDataValuein interfaceConverter- Specified by:
convertObjectValueToDataValuein interfaceCoreConverter<DatabaseMapping,Session>
-
initialize
INTERNAL: Set the mapping.- Specified by:
initializein interfaceConverter- Specified by:
initializein interfaceCoreConverter<DatabaseMapping,Session>
-
getMapping
INTERNAL: Return the mapping. -
isMutable
public boolean isMutable()INTERNAL: If the converter converts the value to a non-atomic value, i.e. a value that can have its' parts changed without being replaced, then it must return false, serialization can be non-atomic. -
getSerializer
Return the serialize used for this converter. -
setSerializer
Set the serialize used for this converter. -
getSerializerClassName
Return the class name of the serializer. -
setSerializerClassName
Set the class name of the serializer. -
getSerializerPackage
Return the package used for XML and JSON serialization JAXBContext. -
setSerializerPackage
Set the package used for XML and JSON serialization JAXBContext.
-