Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.internal.helper
Class ConversionManager

java.lang.Object
  extended byoracle.toplink.internal.helper.ConversionManager

All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ConversionManager
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Purpose: Contains the conversion routines for some common classes in the system. Primarly used to convert objects from a given database type to a different type in Java. Uses a singleton instance, this is also used from the platform.

Responsibilities:

See Also:
Serialized Form

Constructor Summary
ConversionManager()

Method Summary
java.lang.Object convertObject(java.lang.Object sourceObject, java.lang.Class javaClass)
Convert the object to the appropriate type by invoking the appropriate ConversionManager method
static ConversionManager getDefaultManager()
A singleton conversion manager is used to handle generic converisons.
java.lang.Object getDefaultNullValue(java.lang.Class theClass)
Allow for the null values for classes to be defaulted in one place.
java.util.Hashtable getDefaultNullValues()
Allow for the null values for classes to be defaulted in one place.
java.lang.ClassLoader getLoader()
static java.lang.Class getObjectClass(java.lang.Class javaClass)
This is used to determine the wrapper class for a primitive.
static java.lang.Class getPrimitiveClass(java.lang.String classType)
Returns a class based on the passed in string.
static boolean isNonRelational(java.lang.Class classType)
static void setDefaultManager(ConversionManager theManager)
A singleton conversion manager is used to handle generic converisons.
void setDefaultNullValue(java.lang.Class theClass, java.lang.Object theValue)
Allow for the null values for classes to be defaulted in one place.
void setDefaultNullValues(java.util.Hashtable defaultNullValues)
Allow for the null values for classes to be defaulted in one place.
void setLoader(java.lang.ClassLoader classLoader)
void setShouldUseClassLoaderFromCurrentThread(boolean useCurrentThread)
ADVANCED: This flag should be set if the current thread classLoader should be used.
boolean shouldUseClassLoaderFromCurrentThread()
ADVANCED: This flag should be set if the current thread classLoader should be used.

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ConversionManager

public ConversionManager()

Method Detail

convertObject

public java.lang.Object convertObject(java.lang.Object sourceObject,
                                      java.lang.Class javaClass)
                               throws ConversionException
Convert the object to the appropriate type by invoking the appropriate ConversionManager method
Parameters:
javaClass - - the class that the object must be converted to
Returns:
- the newly converted object
Throws:
- - ConversionException, all exceptions will be thrown as this type.
ConversionException

getDefaultManager

public static ConversionManager getDefaultManager()
A singleton conversion manager is used to handle generic converisons. This should not be used for conversion under the session context, thse must go through the platform. This allows for the singleton to be customized through setting the default to a user defined subclass.

getDefaultNullValue

public java.lang.Object getDefaultNullValue(java.lang.Class theClass)
Allow for the null values for classes to be defaulted in one place. Any nulls read from the database to be converted to the class will be given the specified null value.

getDefaultNullValues

public java.util.Hashtable getDefaultNullValues()
Allow for the null values for classes to be defaulted in one place. Any nulls read from the database to be converted to the class will be given the specified null value.

getLoader

public java.lang.ClassLoader getLoader()
Returns:
java.lang.ClassLoader

getObjectClass

public static java.lang.Class getObjectClass(java.lang.Class javaClass)
This is used to determine the wrapper class for a primitive.

isNonRelational

public static boolean isNonRelational(java.lang.Class classType)

getPrimitiveClass

public static java.lang.Class getPrimitiveClass(java.lang.String classType)
Returns a class based on the passed in string.

setDefaultManager

public static void setDefaultManager(ConversionManager theManager)
A singleton conversion manager is used to handle generic converisons. This should not be used for conversion under the session context, thse must go through the platform. This allows for the singleton to be customized through setting the default to a user defined subclass.

setDefaultNullValue

public void setDefaultNullValue(java.lang.Class theClass,
                                java.lang.Object theValue)
Allow for the null values for classes to be defaulted in one place. Any nulls read from the database to be converted to the class will be given the specified null value. Primitive null values should be set to the wrapper class.

setDefaultNullValues

public void setDefaultNullValues(java.util.Hashtable defaultNullValues)
Allow for the null values for classes to be defaulted in one place. Any nulls read from the database to be converted to the class will be given the specified null value.

setLoader

public void setLoader(java.lang.ClassLoader classLoader)

setShouldUseClassLoaderFromCurrentThread

public void setShouldUseClassLoaderFromCurrentThread(boolean useCurrentThread)
ADVANCED: This flag should be set if the current thread classLoader should be used. This is the case in certain Application Servers were the class loader must be retreived from the current Thread. If classNotFoundExceptions are being thrown then set this flag. In certain cases it will resolve the problem

shouldUseClassLoaderFromCurrentThread

public boolean shouldUseClassLoaderFromCurrentThread()
ADVANCED: This flag should be set if the current thread classLoader should be used. This is the case in certain Application Servers were the class loader must be retreived from the current Thread. If classNotFoundExceptions are being thrown then set this flag. In certain cases it will resolve the problem

Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.