org.eclipse.persistence.mappings.converters
Class ClassInstanceConverter

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

public class ClassInstanceConverter
extends Object
implements Converter

Purpose: Allows a class name to be converted to and from a new instance of the class. When using a ClassInstanceConverter, the database will store the Class name and the java object model will contain an instance of that class initialized with its default constructor

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

Constructor Summary
ClassInstanceConverter()
          PUBLIC: Default constructor.
 
Method Summary
 Object convertDataValueToObjectValue(Object fieldValue, Session session)
          INTERNAL: Convert the class name to a class, then create an instance of the class.
 Object convertObjectValueToDataValue(Object attributeValue, Session session)
          INTERNAL: Convert to the field class.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassInstanceConverter

public ClassInstanceConverter()
PUBLIC: Default constructor.

Method Detail

convertDataValueToObjectValue

public Object convertDataValueToObjectValue(Object fieldValue,
                                            Session session)
INTERNAL: Convert the class name to a class, then create an instance of the class.

Specified by:
convertDataValueToObjectValue in interface Converter

convertObjectValueToDataValue

public Object convertObjectValueToDataValue(Object attributeValue,
                                            Session session)
INTERNAL: Convert to the field class.

Specified by:
convertObjectValueToDataValue in interface Converter

initialize

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

Specified by:
initialize in interface Converter

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