EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.mappings.converters
Class SerializedObjectConverter

java.lang.Object
  extended by org.eclipse.persistence.mappings.converters.SerializedObjectConverter
All Implemented Interfaces:
java.io.Serializable, Converter

public class SerializedObjectConverter
extends java.lang.Object
implements Converter

Purpose: The serialized object converter can be used to store an arbitrary object or set of objects into a database blob field. It uses the Java serializer so the target must be serializable.

See Also:
Serialized Form
Author:
James Sutherland
Since:
OracleAS TopLink 10g (10.0.3)

Field Summary
protected  DatabaseMapping mapping
           
 
Constructor Summary
SerializedObjectConverter()
          PUBLIC: Default constructor.
SerializedObjectConverter(DatabaseMapping mapping)
          PUBLIC: Default constructor.
 
Method Summary
 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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mapping

protected DatabaseMapping mapping
Constructor Detail

SerializedObjectConverter

public SerializedObjectConverter()
PUBLIC: Default constructor.


SerializedObjectConverter

public SerializedObjectConverter(DatabaseMapping mapping)
PUBLIC: Default constructor.

Method Detail

convertDataValueToObjectValue

public java.lang.Object convertDataValueToObjectValue(java.lang.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:
convertDataValueToObjectValue in interface Converter
Throws:
DescriptorException

convertObjectValueToDataValue

public java.lang.Object convertObjectValueToDataValue(java.lang.Object attributeValue,
                                                      Session session)
INTERNAL: Convert the object to a byte array through serialize.

Specified by:
convertObjectValueToDataValue in interface Converter

initialize

public void initialize(DatabaseMapping mapping,
                       Session session)
INTERNAL: Set the mapping.

Specified by:
initialize in interface Converter

getMapping

protected DatabaseMapping 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.

Specified by:
isMutable in interface Converter

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference