Top Description Fields Constructors Methods
org.eclipse.persistence.mappings.converters

public Class SerializedObjectConverter

extends Object
implements Converter, ClassNameConversionRequired
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired, org.eclipse.persistence.mappings.converters.Converter, java.io.Serializable, org.eclipse.persistence.core.mappings.converters.CoreConverter
Imports
java.security.AccessController, org.eclipse.persistence.exceptions.ConversionException, .DescriptorException, .ValidationException, org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired, org.eclipse.persistence.internal.helper.ClassConstants, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedClassForName, org.eclipse.persistence.mappings.DatabaseMapping, org.eclipse.persistence.mappings.foundation.AbstractDirectMapping, org.eclipse.persistence.sessions.Session, org.eclipse.persistence.sessions.serializers.JSONSerializer, .JavaSerializer, .Serializer, .XMLSerializer

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.

Author
James Sutherland
Since
OracleAS TopLink 10g (10.0.3)
See Also
Serializer, XMLSerializer, JSONSerializer

Field Summary

Modifier and TypeField and Description
protected DatabaseMapping
protected Serializer
protected String
protected String

Constructor Summary

AccessConstructor and Description
public
SerializedObjectConverter()

PUBLIC: Default constructor.

public
SerializedObjectConverter(DatabaseMapping mapping)

PUBLIC: Default constructor.

public
SerializedObjectConverter(DatabaseMapping mapping, Serializer serializer)

PUBLIC: Default constructor.

public
SerializedObjectConverter(DatabaseMapping mapping, String serializerClassName)

PUBLIC: Default constructor.

Method Summary

Modifier and TypeMethod and Description
public void
convertClassNamesToClasses(ClassLoader classLoader)

Implements org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings in this converter to actual class-based settings.
public Object
public Object
convertObjectValueToDataValue(Object attributeValue, Session session)

Implements org.eclipse.persistence.mappings.converters.Converter.convertObjectValueToDataValue.

INTERNAL: Convert the object to a byte array through serialize.
protected DatabaseMapping
getMapping()

INTERNAL: Return the mapping.

public Serializer
getSerializer()

Return the serialize used for this converter.

public String
getSerializerClassName()

Return the class name of the serializer.

public String
getSerializerPackage()

Return the package used for XML and JSON serialization JAXBContext.

public void
public boolean
isMutable()

Implements org.eclipse.persistence.mappings.converters.Converter.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.
public void
setSerializer(Serializer serializer)

Set the serialize used for this converter.

public void
setSerializerClassName(String serializerClassName)

Set the class name of the serializer.

public void
setSerializerPackage(String serializerPackage)

Set the package used for XML and JSON serialization JAXBContext.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mappingback to summary
protected DatabaseMapping mapping
serializerback to summary
protected Serializer serializer
serializerClassNameback to summary
protected String serializerClassName
serializerPackageback to summary
protected String serializerPackage

Constructor Detail

SerializedObjectConverterback to summary
public SerializedObjectConverter()

PUBLIC: Default constructor.

SerializedObjectConverterback to summary
public SerializedObjectConverter(DatabaseMapping mapping)

PUBLIC: Default constructor.

SerializedObjectConverterback to summary
public SerializedObjectConverter(DatabaseMapping mapping, Serializer serializer)

PUBLIC: Default constructor.

SerializedObjectConverterback to summary
public SerializedObjectConverter(DatabaseMapping mapping, String serializerClassName)

PUBLIC: Default constructor.

Method Detail

convertClassNamesToClassesback to summary
public void convertClassNamesToClasses(ClassLoader classLoader)

Implements org.eclipse.persistence.internal.descriptors.ClassNameConversionRequired.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.

Annotations
@Override
convertDataValueToObjectValueback to summary
public Object convertDataValueToObjectValue(Object fieldValue, Session session) throws DescriptorException

Implements org.eclipse.persistence.mappings.converters.Converter.convertDataValueToObjectValue.

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.

Annotations
@Override
convertObjectValueToDataValueback to summary
public Object convertObjectValueToDataValue(Object attributeValue, Session session)

Implements org.eclipse.persistence.mappings.converters.Converter.convertObjectValueToDataValue.

INTERNAL: Convert the object to a byte array through serialize.

Annotations
@Override
getMappingback to summary
protected DatabaseMapping getMapping()

INTERNAL: Return the mapping.

getSerializerback to summary
public Serializer getSerializer()

Return the serialize used for this converter.

getSerializerClassNameback to summary
public String getSerializerClassName()

Return the class name of the serializer.

getSerializerPackageback to summary
public String getSerializerPackage()

Return the package used for XML and JSON serialization JAXBContext.

initializeback to summary
public void initialize(DatabaseMapping mapping, Session session)

Implements org.eclipse.persistence.mappings.converters.Converter.initialize.

INTERNAL: Set the mapping.

Annotations
@Override
isMutableback to summary
public boolean isMutable()

Implements org.eclipse.persistence.mappings.converters.Converter.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.

Annotations
@Override
setSerializerback to summary
public void setSerializer(Serializer serializer)

Set the serialize used for this converter.

setSerializerClassNameback to summary
public void setSerializerClassName(String serializerClassName)

Set the class name of the serializer.

setSerializerPackageback to summary
public void setSerializerPackage(String serializerPackage)

Set the package used for XML and JSON serialization JAXBContext.