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

public Class XMLConversionManager

extends ConversionManager
implements ConversionManager, TimeZoneHolder
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.internal.helper.TimeZoneHolder, org.eclipse.persistence.internal.oxm.ConversionManager
Imports
java.io.ByteArrayOutputStream, .File, .IOException, java.math.BigDecimal, .BigInteger, java.sql.Time, .Timestamp, java.util.ArrayList, .Calendar, .Collection, .Date, .GregorianCalendar, .HashMap, .List, .Locale, .Map, .StringTokenizer, .TimeZone, .UUID, javax.xml.datatype.DatatypeConfigurationException, .DatatypeConstants, .DatatypeFactory, .Duration, .XMLGregorianCalendar, javax.xml.namespace.QName, org.eclipse.persistence.exceptions.ConversionException, .XMLConversionException, org.eclipse.persistence.internal.core.helper.CoreClassConstants, org.eclipse.persistence.internal.core.queries.CoreContainerPolicy, org.eclipse.persistence.internal.core.sessions.CoreAbstractSession, org.eclipse.persistence.internal.helper.ConversionManager, .Helper, .TimeZoneHolder, org.eclipse.persistence.internal.oxm.conversion.Base64, org.eclipse.persistence.internal.oxm.record.AbstractUnmarshalRecord, org.eclipse.persistence.internal.queries.ContainerPolicy

INTERNAL:

Purpose: Primarily used to convert objects from a given XML Schema type to a different type in Java. Uses a singleton instance

Since
OracleAS TopLink 10g

Field Summary

Modifier and TypeField and Description
protected DatatypeFactory
protected static Map<Class<?>, QName>
protected static XMLConversionManager
protected static Map<QName, Class<?>>
protected static final String
protected static final String
private static final char
protected TimeZone
protected boolean
protected static final int
protected static final int
Inherited from org.eclipse.persistence.internal.helper.ConversionManager:
dataTypesConvertedFromAClassdataTypesConvertedToAClassdefaultManagerdefaultNullValuesloadershouldUseClassLoaderFromCurrentThread

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private String
appendMillis(String string, long time)

Convenience method that appends millisecond values from a given time to a given string.

private String
appendNanos(String string, Timestamp ts)

Convenience method that appends nanosecond values from a given time to a given string.

private String
appendTimeZone(String string, Date date)

private byte[]
public String
public String
protected String
private static Map<Class<?>, QName>
buildJavaTypes()

Build and return a Hashtable containing the default Java to XML conversion pairs

public QName
buildQNameFromString(String stringValue, AbstractUnmarshalRecord<ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, FIELD extends CoreField, UNMARSHALLER extends Unmarshaller<ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, CONTEXT extends Context<ABSTRACT_SESSION extends CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>>, DESCRIPTOR extends Descriptor<?, ?, ?, ?, ?, NAMESPACE_RESOLVER, ?, ?, ?, ?>, FIELD extends Field, NAMESPACE_RESOLVER extends NamespaceResolver, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION extends CoreSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager>, SESSION_EVENT_LISTENER extends CoreSessionEventListener>, DESCRIPTOR extends Descriptor, ID_RESOLVER extends IDResolver, MEDIA_TYPE extends MediaType, ROOT extends Root, UNMARSHALLER_HANDLER extends UnmarshallerHandler, UNMARSHALLER_LISTENER extends Unmarshaller.Listener>> record)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.buildQNameFromString.

private static Map<QName, Class<?>>
buildXMLTypes()

Build and return a Hashtable containing the default XML to Java conversion pairs

public Object
public String
collapseStringValue(String value)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.collapseStringValue.

Removes all leading and trailing whitespaces, and replaces any sequences of whitespaces that occur in the string with a single ' ' character.
public String
convertArrayToString(Object[] sourceObject, QName schemaType)

public Object
convertHexBinaryListToByteArrayList(Object sourceObject, CoreContainerPolicy<ABSTRACT_SESSION extends CoreAbstractSession> containerPolicy, CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>> session)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.convertHexBinaryListToByteArrayList.

public String
convertListToString(Object sourceObject, QName schemaType)

public <T> T

Returns:

- the newly converted object
convertObject
(Object
- will always be a string if read from XML
sourceObject
,
Class<T>
- the class that the object must be converted to
javaClass
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObject.

Convert the given object to the appropriate type by invoking the appropriate ConversionManager method.
public <T> T

Returns:

- the newly converted object
convertObject
(Object
- will always be a string if read from XML
sourceObject
,
Class<T>
- the class that the object must be converted to
javaClass
,
QName
- the XML schema that the object is being converted from
schemaTypeQName
)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.convertObject.

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

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToBigDecimal.

Build a valid instance of BigDecimal from the given sourceObject
protected BigInteger
convertObjectToBigInteger(Object
Valid instance of String, BigDecimal, or any Number
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToBigInteger.

Build a valid instance of BigInteger from the provided sourceObject.
protected Boolean
convertObjectToBoolean(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToBoolean.

Build a valid instance of Boolean from the source object.
protected Byte
convertObjectToByte(Object
Valid instance of String or any Number
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToByte.

Build a valid instance of Byte from the provided sourceObject
protected Calendar
convertObjectToCalendar(Object
Valid instance of java.util.Date, String, java.sql.Timestamp, or Long
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToCalendar.

INTERNAL: Converts given object to a Calendar object
private Calendar
convertObjectToCalendar(Object sourceObject, QName schemaTypeQName)

protected Character
convertObjectToChar(Object sourceObject, QName schemaTypeQName)

Build a valid instance of Character from the provided sourceObject.

protected Character
convertObjectToChar(Object
Valid instance of String or any Number
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToChar.

Build a valid instance of Character from the provided sourceObject.
protected Date
convertObjectToDate(Object
Object of type java.sql.Timestamp, java.util.Date, String or Long
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToDate.

Convert the object to an instance of java.sql.Date.
protected Double
convertObjectToDouble(Object
Object of type String or Number.
sourceObject
)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToDouble.

Convert the object to an instance of Double.
protected Duration
convertObjectToDuration(Object sourceObject)

Build a valid instance of Duration from the provided sourceObject.

protected Float
convertObjectToFloat(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToFloat.

Build a valid Float instance from a String or another Number instance.
protected Integer
convertObjectToInteger(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToInteger.

Build a valid Integer instance from a String or another Number instance.
protected Long
convertObjectToLong(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToLong.

Build a valid Long instance from a String or another Number instance.
protected BigDecimal
convertObjectToNumber(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToNumber.

INTERNAL: Build a valid BigDecimal instance from a String or another Number instance.
protected QName
convertObjectToQName(Object sourceObject)

INTERNAL: Converts given object to a QName object

protected Short
convertObjectToShort(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToShort.

INTERNAL: Build a valid Short instance from a String or another Number instance.
protected Date
convertObjectToSQLDate(Object sourceObject, QName schemaTypeQName)

protected Time
convertObjectToSQLTime(Object sourceObject, QName schemaTypeQName)

protected String
convertObjectToString(Object sourceObject)

Overrides org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToString.

INTERNAL: Converts objects to their string representations.
protected String
convertObjectToString(Object sourceObject, QName schemaTypeQName)

protected Timestamp
convertObjectToTimestamp(Object sourceObject, QName schemaTypeQName)

protected URI
convertObjectToURI(Object sourceObject)

Convert a String to a URI.

private Date
convertObjectToUtilDate(Object sourceObject, QName schemaTypeQName)

protected XMLGregorianCalendar
convertObjectToXMLGregorianCalendar(Object sourceObject, QName schemaTypeQName)

Build a valid instance of XMLGregorianCalendar from the provided sourceObject.

protected XMLGregorianCalendar
convertObjectToXMLGregorianCalendar(Object sourceObject)

Build a valid instance of XMLGregorianCalendar from the provided sourceObject.

public Object
convertSchemaBase64ListToByteArrayList(Object sourceObject, CoreContainerPolicy<ABSTRACT_SESSION extends CoreAbstractSession> containerPolicy, CoreAbstractSession<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, PLATFORM extends CorePlatform<CONVERSION_MANAGER extends CoreConversionManager>, PROJECT extends CoreProject<DESCRIPTOR extends CoreDescriptor<ATTRIBUTE_GROUP extends CoreAttributeGroup, DESCRIPTOR_EVENT_MANAGER extends CoreDescriptorEventManager, FIELD extends CoreField, INHERITANCE_POLICY extends CoreInheritancePolicy, INSTANTIATION_POLICY extends CoreInstantiationPolicy, LIST extends List<E>, OBJECT_BUILDER extends CoreObjectBuilder>, LOGIN extends CoreLogin<PLATFORM extends CorePlatform>, SESSION extends CoreSession>, SESSION_EVENT_MANAGER extends CoreSessionEventManager<SESSION_EVENT_LISTENER extends CoreSessionEventListener>> session)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.convertSchemaBase64ListToByteArrayList.

public byte[]
convertSchemaBase64ToByteArray(Object sourceObject)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.convertSchemaBase64ToByteArray.

INTERNAL: Converts a String which is in Base64 format to a Byte[]
protected Byte[]
public Calendar
convertStringToCalendar(String sourceString, QName schemaTypeQName)

public Date
convertStringToDate(String sourceString, QName schemaType)

public Duration
convertStringToDuration(String sourceString)

Return a Duration created with a given date string.

protected File
protected List<String>
public <T> Collection<T>

Returns:

- the newly converted object
convertStringToList
(Object
- will always be a string if read from XML
sourceObject
,
Class<T>
- the type of the elements contained in the list
elementType
,
ContainerPolicy containerPolicy, QName schemaType)

Convert the given sourceObject (String) to the appropriate collection type specified by the containerPolicy, using the elementType to properly convert each element of the list.

protected Timestamp
public Timestamp
convertStringToTimestamp(String sourceString, QName schemaType)

public XMLGregorianCalendar
convertStringToXMLGregorianCalendar(String sourceString, QName schemaTypeQName)

public XMLGregorianCalendar
convertStringToXMLGregorianCalendar(String sourceString)

Return an XMLGregorianCalander created with a given date string

protected DatatypeFactory
getDatatypeFactory()

INTERNAL: Return the DatatypeFactory instance.

public static Map<Class<?>, QName>
public static XMLConversionManager
public static Map<QName, Class<?>>
public TimeZone
getTimeZone()

Implements org.eclipse.persistence.internal.helper.TimeZoneHolder.getTimeZone.

Return the specified TimeZone used for all String to date object conversions.
private boolean
isNumericQName(QName schemaTypeQName)

public boolean
private boolean
isWhitespace(char character, boolean includeSpace)

public <T> Class<T>

Returns:

the Java class for the XML schema type.
javaType
(QName
The type you want to find a corresponding Java class for.
schemaType
)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.javaType.

public String
normalizeStringValue(String value)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.normalizeStringValue.

Replaces any CR, Tab or LF characters in the string with a single ' ' character.
private QName
qnameFromString(String sourceString)

public QName

Returns:

the schema type for the Java class.
schemaType
(Class<?>
The type you want to find a corresponding schema type for.
javaType
)

Implements org.eclipse.persistence.internal.oxm.ConversionManager.schemaType.

public void
setTimeZone(TimeZone timeZone)

The specified TimeZone will be used for all String to date object conversions.

public void
setTimeZoneQualified(boolean timeZoneQualified)

Specify if Specify if when date objects are converted to Strings in the XML Schema time or dateTime format

public String
stringFromCalendar(Calendar sourceCalendar, QName schemaTypeQName)

private String
stringFromCalendar(Calendar sourceCalendar)

private String
stringFromDate(Date sourceDate)

This method returns a dateTime string representing a given java.util.Date.

public String
stringFromDate(Date sourceDate, QName schemaType)

This method returns a string representing a given java.util.Date based on a given schema type QName.

private String
private String
stringFromQName(QName sourceQName)

private String
stringFromSQLDate(Date sourceDate)

private String
stringFromSQLDate(Date sourceDate, QName schemaType)

private String
stringFromSQLTime(Time sourceTime)

private String
stringFromSQLTime(Time sourceTime, QName schemaType)

private String
stringFromTimestamp(Timestamp sourceDate)

This method returns a dateTime string representing a given Timestamp.

private String
stringFromTimestamp(Timestamp sourceDate, QName schemaType)

This method returns a string representing a given Timestamp based on a given schema type QName.

private String
private String
private Calendar
private String
truncateMillis(String xmlFormat)

Truncate any trailing zeros from the millisecond portion of a given string.

Inherited from org.eclipse.persistence.internal.helper.ConversionManager:
buildAllTypesToAClassVecbuildDataTypesConvertedFromAClassbuildDataTypesConvertedToAClassbuildDateTimeVecbuildFromBigDecimalVecbuildFromBigIntegerVecbuildFromBlobVecbuildFromBooleanVecbuildFromByteArrayVecbuildFromByteObjectArraryVecbuildFromByteVecbuildFromCalendarVecbuildFromCharacterArrayVecbuildFromCharacterVecbuildFromCharArrayVecbuildFromClobVecbuildFromDateVecbuildFromDoubleVecbuildFromFloatVecbuildFromIntegerVecbuildFromLongVecbuildFromNumberVecbuildFromShortVecbuildFromStringVecbuildFromTimestampVecbuildFromTimeVecbuildFromUtilDateVecbuildNumberVecbuildToBigDecimalVecbuildToBigIntegerVecbuildToBlobVecbuildToBooleanVecbuildToByteArrayVecbuildToByteObjectArrayVecbuildToByteVecbuildToCalendarVecbuildToCharacterArrayVecbuildToCharacterVecbuildToCharArrayVecbuildToClobVecbuildToDateVecbuildToDoubleVecbuildToFloatVecbuildToIntegerVecbuildToLongVecbuildToNumberVecbuildToShortVecbuildToStringVecbuildToTimestampVecbuildToTimeVecbuildToUtilDateVecconvertClassNameToClassconvertObjectToByteArrayconvertObjectToByteObjectArrayconvertObjectToCharacterArrayconvertObjectToCharArrayconvertObjectToClassconvertObjectToLocalDateconvertObjectToLocalDateTimeconvertObjectToLocalTimeconvertObjectToOffsetDateTimeconvertObjectToOffsetTimeconvertObjectToTimeconvertObjectToTimestampconvertObjectToUrlconvertObjectToUtilDateconvertObjectToUUIDgetDataTypesConvertedFromgetDataTypesConvertedTogetDefaultLoadergetDefaultManagergetDefaultNullValuegetDefaultNullValuesgetLoadergetObjectClassgetPrimitiveClasshasDefaultNullValuesloadClasssetDefaultLoadersetDefaultManagersetDefaultNullValuesetDefaultNullValuessetLoadersetShouldUseClassLoaderFromCurrentThreadshouldUseClassLoaderFromCurrentThread