Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.sdo.helper
Class SDODataHelper

java.lang.Object
  extended by org.eclipse.persistence.sdo.helper.SDODataHelper


public class SDODataHelper
extends java.lang.Object

Purpose: A helper class for performing data conversions.


Field Summary
private  HelperContext aHelperContext
           

 

Constructor Summary
SDODataHelper()
           
SDODataHelper(HelperContext aContext)
           

 

Method Summary
 java.lang.Object convert(Property property, java.lang.Object value)
          Convert the specified value to an instance of the specified property's type.
 java.lang.Object convert(Type type, java.lang.Object value)
          Convert the specified value to an instance of the specified type.
 java.lang.Object convertFromStringValue(java.lang.String value, java.lang.Class convertClass)
          Convert a String value based to the appropriate type.
 java.lang.Object convertFromStringValue(java.lang.String value, Type sdoType)
          Convert a String value based to the appropriate type.
 java.lang.Object convertFromStringValue(java.lang.String value, Type sdoType, javax.xml.namespace.QName schemaType)
          Convert a String value based to the appropriate type.
 java.lang.String convertToStringValue(java.lang.Object value, Type sdoType)
          Convert to a String value based to the SDO type.
private  java.lang.String convertToStringValue(java.lang.Object value, Type sdoType, javax.xml.namespace.QName xsdType)
          Convert to a String value based to the SDO type.
 java.lang.Object convertValue(java.lang.Object value, java.lang.Class convertClass, javax.xml.namespace.QName schemaType)
          Convert a value based to the appropriate type.
 java.lang.Object convertValueToClass(Property prop, java.lang.Object valueToConvert, java.lang.Class convertToClass)
          INTERNAL:
 HelperContext getHelperContext()
          INTERNAL:
private  org.eclipse.persistence.internal.oxm.XMLConversionManager getXMLConversionManager()
           
private  void setCalendar(java.util.Calendar c, int i, int data)
          Perform Calendar setting based on passed in parameters.
 void setHelperContext(HelperContext helperContext)
          INTERNAL:
 void setTimeZone(java.util.TimeZone timeZone)
          The specified TimeZone will be used for all String to Date object conversions.
 void setTimeZoneQualified(boolean timeZoneQualified)
          By setting this flag to true the marshalled date objects marshalled to the XML schema types time and dateTime will be qualified by a time zone.
private  java.util.Calendar toCalendar(javax.xml.datatype.Duration dur, java.util.Locale loc)
          Creates a Calendar based on a given Duration and Locale.
 java.util.Calendar toCalendar(java.lang.String dateString)
          Convert from a String representation of an SDO date type to a Calendar using the default locale.
 java.util.Calendar toCalendar(java.lang.String dateString, java.util.Locale locale)
          Convert from a String representation of an SDO date type to a Calendar using the specified locale, or the default locale if the locale is null.
 java.util.Date toDate(java.lang.String dateString)
          Convert from a String representation of the Date type to a Date.
 java.lang.String toDateTime(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the DateTime type.
 java.lang.String toDateTime(java.util.Date date)
          Convert from a Date to a String representation of the DateTime type.
 java.lang.String toDay(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the Day type.
 java.lang.String toDay(java.util.Date date)
          Convert from a Date to a String representation of the Day type.
 java.lang.String toDuration(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the Duration type.
 java.lang.String toDuration(java.util.Date date)
          Convert from a Date to a String representation of the Duration type.
 java.lang.String toMonth(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the Month type.
 java.lang.String toMonth(java.util.Date date)
          Convert from a Date to a String representation of the Month type.
 java.lang.String toMonthDay(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the MonthDay type.
 java.lang.String toMonthDay(java.util.Date date)
          Convert from a Date to a String representation of the MonthDay type.
 java.lang.String toTime(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the Time type.
 java.lang.String toTime(java.util.Date date)
          Convert from a Date to a String representation of the Time type.
 java.lang.String toYear(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the Year type.
 java.lang.String toYear(java.util.Date date)
          Convert from a Date to a String representation of the Year type.
 java.lang.String toYearMonth(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the YearMonth type.
 java.lang.String toYearMonth(java.util.Date date)
          Convert from a Date to a String representation of the YearMonth type.
 java.lang.String toYearMonthDay(java.util.Calendar calendar)
          Convert from a Calendar to a String representation of the YearMonthDay type.
 java.lang.String toYearMonthDay(java.util.Date date)
          Convert from a Date to a String representation of the YearMonthDay type.

 

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

 

Field Detail

aHelperContext

private HelperContext aHelperContext

Constructor Detail

SDODataHelper

public SDODataHelper()

SDODataHelper

public SDODataHelper(HelperContext aContext)

Method Detail

getXMLConversionManager

private org.eclipse.persistence.internal.oxm.XMLConversionManager getXMLConversionManager()

setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)
The specified TimeZone will be used for all String to Date object conversions. By default the GMT time zone is used.

setTimeZoneQualified

public void setTimeZoneQualified(boolean timeZoneQualified)
By setting this flag to true the marshalled date objects marshalled to the XML schema types time and dateTime will be qualified by a time zone. By default time information is not time zone qualified.

toCalendar

private java.util.Calendar toCalendar(javax.xml.datatype.Duration dur,
                                      java.util.Locale loc)
Creates a Calendar based on a given Duration and Locale.
Parameters:
dur - the Duration object to use to populate the Calendar
loc - the Locale to use - null is a valid value
Returns:
a Calendar

toCalendar

public java.util.Calendar toCalendar(java.lang.String dateString)
Convert from a String representation of an SDO date type to a Calendar using the default locale. Same as toCalendar(dateString, null).
Parameters:
dateString - the String representation of an SDO date type
Returns:
a Calendar representation of an SDO date type.
Throws:
java.lang.IllegalArgumentException - for invalid formats.

toCalendar

public java.util.Calendar toCalendar(java.lang.String dateString,
                                     java.util.Locale locale)
Convert from a String representation of an SDO date type to a Calendar using the specified locale, or the default locale if the locale is null.
Parameters:
dateString - the String representation of an SDO date type
locale - the locale or null for default locale.
Returns:
a Calendar representation of an SDO date type.
Throws:
java.lang.IllegalArgumentException - for invalid formats.

toDate

public java.util.Date toDate(java.lang.String dateString)
Convert from a String representation of the Date type to a Date.
Parameters:
dateString - a String representation of the Date type
Returns:
a Date from a String representation of the Date type.

toDateTime

public java.lang.String toDateTime(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the DateTime type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the DateTime type.

toDateTime

public java.lang.String toDateTime(java.util.Date date)
Convert from a Date to a String representation of the DateTime type.
Parameters:
date - the date
Returns:
a Date to a String representation of the DateTime type.

toDay

public java.lang.String toDay(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the Day type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the Day type.

toDay

public java.lang.String toDay(java.util.Date date)
Convert from a Date to a String representation of the Day type.
Parameters:
date - the date
Returns:
a Date to a String representation of the Day type.

toDuration

public java.lang.String toDuration(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the Duration type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the Duration type.

toDuration

public java.lang.String toDuration(java.util.Date date)
Convert from a Date to a String representation of the Duration type.
Parameters:
date - the date
Returns:
a Date to a String representation of the Duration type.

toMonth

public java.lang.String toMonth(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the Month type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the Month type.

toMonth

public java.lang.String toMonth(java.util.Date date)
Convert from a Date to a String representation of the Month type.
Parameters:
date - the date
Returns:
a Date to a String representation of the Month type.

toMonthDay

public java.lang.String toMonthDay(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the MonthDay type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the MonthDay type.

toMonthDay

public java.lang.String toMonthDay(java.util.Date date)
Convert from a Date to a String representation of the MonthDay type.
Parameters:
date - the date to convert
Returns:
a Date to a String representation of the MonthDay type.

toTime

public java.lang.String toTime(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the Time type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the Time type.

toTime

public java.lang.String toTime(java.util.Date date)
Convert from a Date to a String representation of the Time type.
Parameters:
date - the date
Returns:
a Date to a String representation of the Time type.

toYear

public java.lang.String toYear(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the Year type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the Year type.

toYear

public java.lang.String toYear(java.util.Date date)
Convert from a Date to a String representation of the Year type.
Parameters:
date - the date
Returns:
a Date to a String representation of the Year type.

toYearMonth

public java.lang.String toYearMonth(java.util.Date date)
Convert from a Date to a String representation of the YearMonth type.
Parameters:
date - the date
Returns:
a Date to a String representation of the YearMonth type.

toYearMonthDay

public java.lang.String toYearMonthDay(java.util.Date date)
Convert from a Date to a String representation of the YearMonthDay type.
Parameters:
date - the date
Returns:
a Date to a String representation of the YearMonthDay type.

toYearMonth

public java.lang.String toYearMonth(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the YearMonth type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the YearMonth type.

toYearMonthDay

public java.lang.String toYearMonthDay(java.util.Calendar calendar)
Convert from a Calendar to a String representation of the YearMonthDay type.
Parameters:
calendar - the calendar to convert
Returns:
a Calendar to a String representation of the YearMonthDay type.

setCalendar

private void setCalendar(java.util.Calendar c,
                         int i,
                         int data)
Perform Calendar setting based on passed in parameters.
Parameters:
c - the Calendar to be set
i - an offset indicate what value to be set
data - the value to set to the Calendar

convertValue

public java.lang.Object convertValue(java.lang.Object value,
                                     java.lang.Class convertClass,
                                     javax.xml.namespace.QName schemaType)
Convert a value based to the appropriate type.
Parameters:
value - The value to convert.
convertClass - The class to convert the value to.
schemaType - The schema type if available.
Returns:
the original value converted based on the convertClass parameter.

convertFromStringValue

public java.lang.Object convertFromStringValue(java.lang.String value,
                                               java.lang.Class convertClass)
Convert a String value based to the appropriate type.
Parameters:
value - The String value to convert.
convertClass - The class to convert the value to.
Returns:
the original value converted based on the convertClass parameter.

convertFromStringValue

public java.lang.Object convertFromStringValue(java.lang.String value,
                                               Type sdoType)
Convert a String value based to the appropriate type.
Parameters:
value - The String value to convert.
sdoType - The SDO type of the value to convert the value to.
Returns:
the original value converted based on the SDO type.

convertFromStringValue

public java.lang.Object convertFromStringValue(java.lang.String value,
                                               Type sdoType,
                                               javax.xml.namespace.QName schemaType)
Convert a String value based to the appropriate type.
Parameters:
value - The String value to convert.
sdoType - The SDO type of the value to convert the value to.
schemaType - The schema type if available.
Returns:
the original value converted based on the convertClass parameter.

convertToStringValue

public java.lang.String convertToStringValue(java.lang.Object value,
                                             Type sdoType)
Convert to a String value based to the SDO type.
Parameters:
value - The value to convert.
sdoType - the SDO type
Returns:
the original value converted to a String based on the SDO type specified.

convertToStringValue

private java.lang.String convertToStringValue(java.lang.Object value,
                                              Type sdoType,
                                              javax.xml.namespace.QName xsdType)
Convert to a String value based to the SDO type.
Parameters:
value - The value to convert.
sdoType - the SDO type
Returns:
the original value converted to a String based on the SDO type specified.

convert

public java.lang.Object convert(Type type,
                                java.lang.Object value)
Convert the specified value to an instance of the specified type. Supported conversions are listed in Section 14 of the SDO specification.
Parameters:
type - the target data type.
value - the value to convert
Returns:
a value of the specified type's instance class
Throws:
java.lang.IllegalArgumentException - if the value could not be converted
See Also:
convert(Property, Object)

convert

public java.lang.Object convert(Property property,
                                java.lang.Object value)
Convert the specified value to an instance of the specified property's type. The specified value must be a List if the property is many valued. In this case, all the values in the List are converted.
Parameters:
property - the target data type property.
value - the value or List of values to convert
Returns:
a converted value or list of converted values
Throws:
java.lang.IllegalArgumentException - if the value could not be converted
See Also:
convert(Type, Object)

convertValueToClass

public java.lang.Object convertValueToClass(Property prop,
                                            java.lang.Object valueToConvert,
                                            java.lang.Class convertToClass)
INTERNAL:

getHelperContext

public HelperContext getHelperContext()
INTERNAL:

setHelperContext

public void setHelperContext(HelperContext helperContext)
INTERNAL:

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.