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:
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable |
dataTypesConvertedFromAClass
Store the list of Classes that can be converted to from the key.
|
protected java.util.Hashtable |
dataTypesConvertedToAClass
Store the list of Classes that can be converted from to the key.
|
protected static ConversionManager |
defaultManager |
protected java.util.Map |
defaultNullValues |
protected java.lang.ClassLoader |
loader |
protected boolean |
shouldUseClassLoaderFromCurrentThread
This flag is here if the Conversion Manager should use the class loader on the
thread when loading classes.
|
Constructor and Description |
---|
ConversionManager() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Vector |
buildAllTypesToAClassVec() |
protected void |
buildDataTypesConvertedFromAClass() |
protected void |
buildDataTypesConvertedToAClass() |
protected java.util.Vector |
buildDateTimeVec() |
protected java.util.Vector |
buildFromBigDecimalVec() |
protected java.util.Vector |
buildFromBigIntegerVec() |
protected java.util.Vector |
buildFromBlobVec() |
protected java.util.Vector |
buildFromBooleanVec() |
protected java.util.Vector |
buildFromByteArrayVec() |
protected java.util.Vector |
buildFromByteObjectArraryVec() |
protected java.util.Vector |
buildFromByteVec() |
protected java.util.Vector |
buildFromCalendarVec() |
protected java.util.Vector |
buildFromCharacterArrayVec() |
protected java.util.Vector |
buildFromCharacterVec() |
protected java.util.Vector |
buildFromCharArrayVec() |
protected java.util.Vector |
buildFromClobVec() |
protected java.util.Vector |
buildFromDateVec() |
protected java.util.Vector |
buildFromDoubleVec() |
protected java.util.Vector |
buildFromFloatVec() |
protected java.util.Vector |
buildFromIntegerVec() |
protected java.util.Vector |
buildFromLongVec() |
protected java.util.Vector |
buildFromNumberVec() |
protected java.util.Vector |
buildFromShortVec() |
protected java.util.Vector |
buildFromStringVec() |
protected java.util.Vector |
buildFromTimestampVec() |
protected java.util.Vector |
buildFromTimeVec() |
protected java.util.Vector |
buildFromUtilDateVec() |
protected java.util.Vector |
buildNumberVec() |
protected java.util.Vector |
buildToBigDecimalVec() |
protected java.util.Vector |
buildToBigIntegerVec() |
protected java.util.Vector |
buildToBlobVec() |
protected java.util.Vector |
buildToBooleanVec() |
protected java.util.Vector |
buildToByteArrayVec() |
protected java.util.Vector |
buildToByteObjectArrayVec() |
protected java.util.Vector |
buildToByteVec() |
protected java.util.Vector |
buildToCalendarVec() |
protected java.util.Vector |
buildToCharacterArrayVec() |
protected java.util.Vector |
buildToCharacterVec() |
protected java.util.Vector |
buildToCharArrayVec() |
protected java.util.Vector |
buildToClobVec() |
protected java.util.Vector |
buildToDateVec() |
protected java.util.Vector |
buildToDoubleVec() |
protected java.util.Vector |
buildToFloatVec() |
protected java.util.Vector |
buildToIntegerVec() |
protected java.util.Vector |
buildToLongVec() |
protected java.util.Vector |
buildToNumberVec() |
protected java.util.Vector |
buildToShortVec() |
protected java.util.Vector |
buildToStringVec() |
protected java.util.Vector |
buildToTimestampVec() |
protected java.util.Vector |
buildToTimeVec() |
protected java.util.Vector |
buildToUtilDateVec() |
java.lang.Object |
clone()
INTERNAL:
|
java.lang.Class |
convertClassNameToClass(java.lang.String className)
PUBLIC:
Resolve the given String className into a class using this
ConversionManager's classloader.
|
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
|
protected java.math.BigDecimal |
convertObjectToBigDecimal(java.lang.Object sourceObject)
Build a valid instance of BigDecimal from the given sourceObject
|
protected java.math.BigInteger |
convertObjectToBigInteger(java.lang.Object sourceObject)
Build a valid instance of BigInteger from the provided sourceObject.
|
protected java.lang.Boolean |
convertObjectToBoolean(java.lang.Object sourceObject)
Build a valid instance of Boolean from the source object.
|
protected java.lang.Byte |
convertObjectToByte(java.lang.Object sourceObject)
Build a valid instance of Byte from the provided sourceObject
|
protected byte[] |
convertObjectToByteArray(java.lang.Object sourceObject)
Build a valid instance of a byte array from the given object.
|
protected java.lang.Byte[] |
convertObjectToByteObjectArray(java.lang.Object sourceObject)
Build a valid instance of a Byte array from the given object.
|
protected java.util.Calendar |
convertObjectToCalendar(java.lang.Object sourceObject)
Build a valid instance of java.util.Calendar from the given source object.
|
protected java.lang.Character |
convertObjectToChar(java.lang.Object sourceObject)
Build a valid instance of Character from the provided sourceObject.
|
protected java.lang.Character[] |
convertObjectToCharacterArray(java.lang.Object sourceObject)
Build a valid instance of a Character array from the given object.
|
protected char[] |
convertObjectToCharArray(java.lang.Object sourceObject)
Build a valid instance of a char array from the given object.
|
protected java.lang.Class |
convertObjectToClass(java.lang.Object sourceObject)
Build a valid Class from the string that is passed in
|
protected java.sql.Date |
convertObjectToDate(java.lang.Object sourceObject)
Convert the object to an instance of java.sql.Date.
|
protected java.lang.Double |
convertObjectToDouble(java.lang.Object sourceObject)
Convert the object to an instance of Double.
|
protected java.lang.Float |
convertObjectToFloat(java.lang.Object sourceObject)
Build a valid Float instance from a String or another Number instance.
|
protected java.lang.Integer |
convertObjectToInteger(java.lang.Object sourceObject)
Build a valid Integer instance from a String or another Number instance.
|
protected java.lang.Long |
convertObjectToLong(java.lang.Object sourceObject)
Build a valid Long instance from a String or another Number instance.
|
protected java.math.BigDecimal |
convertObjectToNumber(java.lang.Object sourceObject)
INTERNAL:
Build a valid BigDecimal instance from a String or another
Number instance.
|
protected java.lang.Short |
convertObjectToShort(java.lang.Object sourceObject)
INTERNAL:
Build a valid Short instance from a String or another Number instance.
|
protected java.lang.String |
convertObjectToString(java.lang.Object sourceObject)
INTERNAL:
Converts objects to thier string representations.
|
protected java.sql.Time |
convertObjectToTime(java.lang.Object sourceObject)
INTERNAL:
Build a valid instance of java.sql.Time from the given source object.
|
protected java.sql.Timestamp |
convertObjectToTimestamp(java.lang.Object sourceObject)
INTERNAL:
Build a valid instance of java.sql.Timestamp from the given source object.
|
protected java.util.Date |
convertObjectToUtilDate(java.lang.Object sourceObject)
INTERNAL:
Build a valid instance of java.util.Date from the given source object.
|
java.util.Vector |
getDataTypesConvertedFrom(java.lang.Class javaClass)
PUBLIC:
Return the list of Classes that can be converted to from the passed in javaClass.
|
java.util.Vector |
getDataTypesConvertedTo(java.lang.Class javaClass)
PUBLIC:
Return the list of Classes that can be converted from to the passed in javaClass.
|
static java.lang.ClassLoader |
getDefaultLoader()
INTERNAL:
Get the default class loader to use if no instance-level loader is set
|
static ConversionManager |
getDefaultManager()
A singleton conversion manager is used to handle generic converisons.
|
java.lang.Object |
getDefaultNullValue(java.lang.Class theClass)
INTERNAL:
Allow for the null values for classes to be defaulted in one place.
|
java.util.Map |
getDefaultNullValues()
INTERNAL:
Allow for the null values for classes to be defaulted in one place.
|
java.lang.ClassLoader |
getLoader()
INTERNAL:
|
static java.lang.Class |
getObjectClass(java.lang.Class javaClass)
INTERNAL:
This is used to determine the wrapper class for a primitive.
|
static java.lang.Class |
getPrimitiveClass(java.lang.String classType)
INTERNAL:
Returns a class based on the passed in string.
|
static java.lang.Class |
loadClass(java.lang.String className)
INTERNAL:
Load the class using the default managers class loader.
|
static void |
setDefaultLoader(java.lang.ClassLoader classLoader)
INTERNAL:
Set the default class loader to use if no instance-level loader is set
|
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)
INTERNAL:
Allow for the null values for classes to be defaulted in one place.
|
void |
setDefaultNullValues(java.util.Map defaultNullValues)
INTERNAL:
Allow for the null values for classes to be defaulted in one place.
|
void |
setLoader(java.lang.ClassLoader classLoader)
INTERNAL:
|
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.
|
protected java.util.Map defaultNullValues
protected boolean shouldUseClassLoaderFromCurrentThread
protected static ConversionManager defaultManager
protected java.lang.ClassLoader loader
protected java.util.Hashtable dataTypesConvertedFromAClass
protected java.util.Hashtable dataTypesConvertedToAClass
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.Object convertObject(java.lang.Object sourceObject, java.lang.Class javaClass) throws ConversionException
object
- - the object that must be convertedjavaClass
- - the class that the object must be converted to-
- ConversionException, all exceptions will be thrown as this type.ConversionException
protected java.math.BigDecimal convertObjectToBigDecimal(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of String, BigInteger, any NumberConversionException
protected java.math.BigInteger convertObjectToBigInteger(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of String, BigDecimal, or any NumberConversionException
protected java.lang.Boolean convertObjectToBoolean(java.lang.Object sourceObject)
protected java.lang.Byte convertObjectToByte(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of String or any NumberConversionException
protected byte[] convertObjectToByteArray(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.Byte[] convertObjectToByteObjectArray(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.util.Calendar convertObjectToCalendar(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of java.util.Date, String, java.sql.Timestamp, or LongConversionException
protected java.lang.Character convertObjectToChar(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of String or any NumberConversionException
protected java.lang.Character[] convertObjectToCharacterArray(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected char[] convertObjectToCharArray(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.Class convertObjectToClass(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of StringConversionException
protected java.sql.Date convertObjectToDate(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Object of type java.sql.Timestamp, java.util.Date, String or LongConversionException
protected java.lang.Double convertObjectToDouble(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Object of type String or Number.ConversionException
protected java.lang.Float convertObjectToFloat(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.Integer convertObjectToInteger(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.Long convertObjectToLong(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.math.BigDecimal convertObjectToNumber(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.Short convertObjectToShort(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.lang.String convertObjectToString(java.lang.Object sourceObject) throws ConversionException
ConversionException
protected java.sql.Time convertObjectToTime(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of java.sql.Time, String, java.util.Date, java.sql.Timestamp, or LongConversionException
protected java.sql.Timestamp convertObjectToTimestamp(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid obejct of class java.sql.Timestamp, String, java.util.Date, or LongConversionException
protected java.util.Date convertObjectToUtilDate(java.lang.Object sourceObject) throws ConversionException
sourceObject
- Valid instance of java.util.Date, String, java.sql.Timestamp, or LongConversionException
public java.lang.Class convertClassNameToClass(java.lang.String className) throws ConversionException
ConversionException
public static ConversionManager getDefaultManager()
public java.lang.Object getDefaultNullValue(java.lang.Class theClass)
public java.util.Map getDefaultNullValues()
public java.lang.ClassLoader getLoader()
public static java.lang.Class loadClass(java.lang.String className)
public static java.lang.Class getObjectClass(java.lang.Class javaClass)
public static java.lang.Class getPrimitiveClass(java.lang.String classType)
public static void setDefaultManager(ConversionManager theManager)
public void setDefaultNullValue(java.lang.Class theClass, java.lang.Object theValue)
public void setDefaultNullValues(java.util.Map defaultNullValues)
public void setLoader(java.lang.ClassLoader classLoader)
public static void setDefaultLoader(java.lang.ClassLoader classLoader)
public static java.lang.ClassLoader getDefaultLoader()
public void setShouldUseClassLoaderFromCurrentThread(boolean useCurrentThread)
public boolean shouldUseClassLoaderFromCurrentThread()
public java.util.Vector getDataTypesConvertedFrom(java.lang.Class javaClass)
javaClass
- - the class that is converted frompublic java.util.Vector getDataTypesConvertedTo(java.lang.Class javaClass)
javaClass
- - the class that is converted toprotected java.util.Vector buildNumberVec()
protected java.util.Vector buildDateTimeVec()
protected void buildDataTypesConvertedFromAClass()
protected java.util.Vector buildFromBooleanVec()
protected java.util.Vector buildFromNumberVec()
protected java.util.Vector buildFromBigDecimalVec()
protected java.util.Vector buildFromBigIntegerVec()
protected java.util.Vector buildFromIntegerVec()
protected java.util.Vector buildFromFloatVec()
protected java.util.Vector buildFromDoubleVec()
protected java.util.Vector buildFromShortVec()
protected java.util.Vector buildFromByteVec()
protected java.util.Vector buildFromLongVec()
protected java.util.Vector buildFromStringVec()
protected java.util.Vector buildFromCharacterVec()
protected java.util.Vector buildFromByteArrayVec()
protected java.util.Vector buildFromClobVec()
protected java.util.Vector buildFromBlobVec()
protected java.util.Vector buildFromUtilDateVec()
protected java.util.Vector buildFromTimestampVec()
protected java.util.Vector buildFromCalendarVec()
protected java.util.Vector buildFromDateVec()
protected java.util.Vector buildFromTimeVec()
protected java.util.Vector buildFromByteObjectArraryVec()
protected java.util.Vector buildFromCharArrayVec()
protected java.util.Vector buildFromCharacterArrayVec()
protected void buildDataTypesConvertedToAClass()
protected java.util.Vector buildAllTypesToAClassVec()
protected java.util.Vector buildToBigDecimalVec()
protected java.util.Vector buildToBigIntegerVec()
protected java.util.Vector buildToBooleanVec()
protected java.util.Vector buildToByteVec()
protected java.util.Vector buildToDoubleVec()
protected java.util.Vector buildToFloatVec()
protected java.util.Vector buildToIntegerVec()
protected java.util.Vector buildToLongVec()
protected java.util.Vector buildToNumberVec()
protected java.util.Vector buildToShortVec()
protected java.util.Vector buildToByteArrayVec()
protected java.util.Vector buildToByteObjectArrayVec()
protected java.util.Vector buildToCharacterVec()
protected java.util.Vector buildToCharacterArrayVec()
protected java.util.Vector buildToCharArrayVec()
protected java.util.Vector buildToStringVec()
protected java.util.Vector buildToCalendarVec()
protected java.util.Vector buildToTimestampVec()
protected java.util.Vector buildToUtilDateVec()
protected java.util.Vector buildToDateVec()
protected java.util.Vector buildToTimeVec()
protected java.util.Vector buildToBlobVec()
protected java.util.Vector buildToClobVec()