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