Top Description Fields Constructors Methods
org.eclipse.persistence.internal.helper

public Class ConversionManager

extends CoreConversionManager
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Known Direct Subclasses
org.eclipse.persistence.internal.helper.JPAConversionManager, org.eclipse.persistence.internal.oxm.XMLConversionManager
Imports
java.io.ByteArrayOutputStream, .IOException, .InputStream, .Serializable, java.math.BigDecimal, .BigInteger, java.net.URL, java.sql.Blob, .Clob, .SQLException, .Time, .Timestamp, java.time.LocalDateTime, .ZoneId, .ZoneOffset, java.util.Calendar, .HashMap, .Hashtable, .List, .Map, .UUID, java.util.concurrent.CopyOnWriteArrayList, org.eclipse.persistence.config.SystemProperties, org.eclipse.persistence.exceptions.ConversionException, .DatabaseException, org.eclipse.persistence.internal.core.helper.CoreConversionManager, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.logging.AbstractSessionLog, .SessionLog

Purpose: Contains the conversion routines for some common classes in the system. Primarily 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:

Field Summary

Modifier and TypeField and Description
protected Map<Object, List<Class<?>>>
dataTypesConvertedFromAClass

Store the list of Classes that can be converted to from the key.

protected Map<Class<?>, List<Class<?>>>
dataTypesConvertedToAClass

Store the list of Classes that can be converted from to the key.

private static ClassLoader
defaultLoader

Allows the setting of a global default if no instance-level loader is set.

protected static ConversionManager
protected Map<Class<?>, Object>
private static ZoneId
protected ClassLoader
protected boolean
shouldUseClassLoaderFromCurrentThread

This flag is here if the Conversion Manager should use the class loader on the thread when loading classes.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected List<Class<?>>
protected void
protected void
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
protected List<Class<?>>
public Object
clone()

Overrides java.lang.Object.clone.

INTERNAL:
public <T> Class<T>
convertClassNameToClass(String className)

PUBLIC: Resolve the given String className into a class using this ConversionManager's classloader.

public <T> T

Returns:

the newly converted object
convertObject
(Object
the object that must be converted
sourceObject
,
Class<T>
the class that the object must be converted to
javaClass
)

Implements abstract org.eclipse.persistence.internal.core.helper.CoreConversionManager.convertObject.

Convert the object to the appropriate type by invoking the appropriate ConversionManager method
protected BigDecimal
convertObjectToBigDecimal(Object
Valid instance of String, BigInteger, any Number
sourceObject
)

Build a valid instance of BigDecimal from the given sourceObject

protected BigInteger
convertObjectToBigInteger(Object
Valid instance of String, BigDecimal, or any Number
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
Valid instance of String or any Number
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
Valid instance of java.util.Date, String, java.sql.Timestamp, or Long
sourceObject
)

Build a valid instance of java.util.Calendar from the given source object.

protected Character
convertObjectToChar(Object
Valid instance of String or any Number
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 <T> Class<T>
convertObjectToClass(Object
Valid instance of String
sourceObject
)

Build a valid Class from the string that is passed in

protected Date
convertObjectToDate(Object
Object of type java.sql.Timestamp, java.util.Date, String or Long
sourceObject
)

Convert the object to an instance of java.sql.Date.

protected Double
convertObjectToDouble(Object
Object of type String or Number.
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 LocalDate
convertObjectToLocalDate(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.time.LocalDate from the given source object.

protected LocalDateTime
convertObjectToLocalDateTime(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.time.LocalDateTime from the given source object.

protected LocalTime
convertObjectToLocalTime(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.time.LocalTime from the given source object.

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 OffsetDateTime
convertObjectToOffsetDateTime(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.time.OffsetDateTime from the given source object.

protected OffsetTime
convertObjectToOffsetTime(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.time.OffsetTime from the given source object.

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 their string representations.

protected Time
convertObjectToTime(Object
Valid instance of java.sql.Time, String, java.util.Date, java.sql.Timestamp, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.sql.Time from the given source object.

protected Timestamp
convertObjectToTimestamp(Object
Valid object of class java.sql.Timestamp, String, java.util.Date, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.sql.Timestamp from the given source object.

protected URL
convertObjectToUrl(Object
Valid instance of java.net.URL, or String
sourceObject
)

INTERNAL: Build a valid instance of java.net.URL from the given source object.

protected Date
convertObjectToUtilDate(Object
Valid instance of java.util.Date, String, java.sql.Timestamp, or Long
sourceObject
)

INTERNAL: Build a valid instance of java.util.Date from the given source object.

protected UUID
convertObjectToUUID(Object
Valid instance of java.util.UUID, or String
sourceObject
)

INTERNAL: Build a valid instance of java.util.UUID from the given source object.

public List<Class<?>>

Returns:

- a vector of classes
getDataTypesConvertedFrom
(Class<?>
- the class that is converted from
javaClass
)

PUBLIC: Return the list of Classes that can be converted to from the passed in javaClass.

public List<Class<?>>

Returns:

- a vector of classes
getDataTypesConvertedTo
(Class<?>
- the class that is converted to
javaClass
)

PUBLIC: Return the list of Classes that can be converted from to the passed in javaClass.

public static ClassLoader

Returns:

java.lang.ClassLoader
getDefaultLoader
()

INTERNAL: Get the default class loader to use if no instance-level loader is set

public static ConversionManager
getDefaultManager()

A singleton conversion manager is used to handle generic conversions.

public <T> T
getDefaultNullValue(Class<T> theClass)

INTERNAL: Allow for the null values for classes to be defaulted in one place.

public Map<Class<?>, Object>
getDefaultNullValues()

INTERNAL: Allow for the null values for classes to be defaulted in one place.

private static ZoneId
public ClassLoader
public static <T> Class<T>
getObjectClass(Class<?> javaClass)

INTERNAL: This is used to determine the wrapper class for a primitive.

public static <T> Class<T>
getPrimitiveClass(String classType)

INTERNAL: Returns a class based on the passed in string.

public boolean
public static <T> Class<T>
loadClass(String className)

INTERNAL: Load the class using the default managers class loader.

public static void
setDefaultLoader(ClassLoader classLoader)

INTERNAL: Set the default class loader to use if no instance-level loader is set

public static void
setDefaultManager(ConversionManager theManager)

A singleton conversion manager is used to handle generic conversions.

public void
setDefaultNullValue(Class<?> theClass, Object theValue)

INTERNAL: Allow for the null values for classes to be defaulted in one place.

public void
setDefaultNullValues(Map<Class<?>, Object> defaultNullValues)

INTERNAL: Allow for the null values for classes to be defaulted in one place.

public void
setLoader(ClassLoader classLoader)

INTERNAL:

public void
setShouldUseClassLoaderFromCurrentThread(boolean useCurrentThread)

ADVANCED: This flag should be set if the current thread classLoader should be used.

public boolean
shouldUseClassLoaderFromCurrentThread()

ADVANCED: This flag should be set if the current thread classLoader should be used.