java.lang.Object
org.eclipse.persistence.sdo.helper.SDODataHelper
- All Implemented Interfaces:
DataHelper
Purpose: A helper class for performing data conversions.
-
Field Summary
Fields inherited from interface commonj.sdo.helper.DataHelper
INSTANCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvert the specified value to aninstance
of the specified type.convertFromStringValue
(String value, Type sdoType) Convert a String value based to the appropriate type.convertFromStringValue
(String value, Type sdoType, QName schemaType) Convert a String value based to the appropriate type.convertFromStringValue
(String value, Class<?> convertClass) Convert a String value based to the appropriate type.convertFromStringValue
(String value, Class<?> convertClass, QName schemaType) Convert a String value based to the appropriate type.convertToStringValue
(Object value, Type sdoType) Convert to a String value based to the SDO type.convertValue
(Object value, Class<?> convertClass, QName schemaType) Convert a value based to the appropriate type.convertValueToClass
(Property prop, Object valueToConvert, Class<?> convertToClass) INTERNAL:INTERNAL:void
setHelperContext
(HelperContext helperContext) INTERNAL:void
setTimeZone
(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.toCalendar
(String dateString) Convert from a String representation of an SDO date type to a Calendar using the default locale.toCalendar
(String dateString, 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.Convert from a String representation of the Date type to a Date.toDateTime
(Calendar calendar) Convert from a Calendar to a String representation of the DateTime type.toDateTime
(Date date) Convert from a Date to a String representation of the DateTime type.Convert from a Calendar to a String representation of the Day type.Convert from a Date to a String representation of the Day type.toDuration
(Calendar calendar) Convert from a Calendar to a String representation of the Duration type.toDuration
(Date date) Convert from a Date to a String representation of the Duration type.Convert from a Calendar to a String representation of the Month type.Convert from a Date to a String representation of the Month type.toMonthDay
(Calendar calendar) Convert from a Calendar to a String representation of the MonthDay type.toMonthDay
(Date date) Convert from a Date to a String representation of the MonthDay type.Convert from a Calendar to a String representation of the Time type.Convert from a Date to a String representation of the Time type.Convert from a Calendar to a String representation of the Year type.Convert from a Date to a String representation of the Year type.toYearMonth
(Calendar calendar) Convert from a Calendar to a String representation of the YearMonth type.toYearMonth
(Date date) Convert from a Date to a String representation of the YearMonth type.toYearMonthDay
(Calendar calendar) Convert from a Calendar to a String representation of the YearMonthDay type.toYearMonthDay
(Date date) Convert from a Date to a String representation of the YearMonthDay type.
-
Constructor Details
-
SDODataHelper
public SDODataHelper() -
SDODataHelper
-
-
Method Details
-
setTimeZone
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
Convert from a String representation of an SDO date type to a Calendar using the default locale. Same as toCalendar(dateString, null).- Specified by:
toCalendar
in interfaceDataHelper
- Parameters:
dateString
- the String representation of an SDO date type- Returns:
- a Calendar representation of an SDO date type.
- Throws:
IllegalArgumentException
- for invalid formats.
-
toCalendar
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.- Specified by:
toCalendar
in interfaceDataHelper
- Parameters:
dateString
- the String representation of an SDO date typelocale
- the locale or null for default locale.- Returns:
- a Calendar representation of an SDO date type.
- Throws:
IllegalArgumentException
- for invalid formats.
-
toDate
Convert from a String representation of the Date type to a Date.- Specified by:
toDate
in interfaceDataHelper
- Parameters:
dateString
- a String representation of the Date type- Returns:
- a Date from a String representation of the Date type.
-
toDateTime
Convert from a Calendar to a String representation of the DateTime type.- Specified by:
toDateTime
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the DateTime type.
-
toDateTime
Convert from a Date to a String representation of the DateTime type.- Specified by:
toDateTime
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the DateTime type.
-
toDay
Convert from a Calendar to a String representation of the Day type.- Specified by:
toDay
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the Day type.
-
toDay
Convert from a Date to a String representation of the Day type.- Specified by:
toDay
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the Day type.
-
toDuration
Convert from a Calendar to a String representation of the Duration type.- Specified by:
toDuration
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the Duration type.
-
toDuration
Convert from a Date to a String representation of the Duration type.- Specified by:
toDuration
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the Duration type.
-
toMonth
Convert from a Calendar to a String representation of the Month type.- Specified by:
toMonth
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the Month type.
-
toMonth
Convert from a Date to a String representation of the Month type.- Specified by:
toMonth
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the Month type.
-
toMonthDay
Convert from a Calendar to a String representation of the MonthDay type.- Specified by:
toMonthDay
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the MonthDay type.
-
toMonthDay
Convert from a Date to a String representation of the MonthDay type.- Specified by:
toMonthDay
in interfaceDataHelper
- Parameters:
date
- the date to convert- Returns:
- a Date to a String representation of the MonthDay type.
-
toTime
Convert from a Calendar to a String representation of the Time type.- Specified by:
toTime
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the Time type.
-
toTime
Convert from a Date to a String representation of the Time type.- Specified by:
toTime
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the Time type.
-
toYear
Convert from a Calendar to a String representation of the Year type.- Specified by:
toYear
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the Year type.
-
toYear
Convert from a Date to a String representation of the Year type.- Specified by:
toYear
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the Year type.
-
toYearMonth
Convert from a Date to a String representation of the YearMonth type.- Specified by:
toYearMonth
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the YearMonth type.
-
toYearMonthDay
Convert from a Date to a String representation of the YearMonthDay type.- Specified by:
toYearMonthDay
in interfaceDataHelper
- Parameters:
date
- the date- Returns:
- a Date to a String representation of the YearMonthDay type.
-
toYearMonth
Convert from a Calendar to a String representation of the YearMonth type.- Specified by:
toYearMonth
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the YearMonth type.
-
toYearMonthDay
Convert from a Calendar to a String representation of the YearMonthDay type.- Specified by:
toYearMonthDay
in interfaceDataHelper
- Parameters:
calendar
- the calendar to convert- Returns:
- a Calendar to a String representation of the YearMonthDay type.
-
convertValue
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
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
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
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.
-
convertFromStringValue
Convert a String value based to the appropriate type.- Parameters:
value
- The String 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.
-
convertToStringValue
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
Convert the specified value to aninstance
of the specified type. Supported conversions are listed in Section 14 of the SDO specification.- Specified by:
convert
in interfaceDataHelper
- Parameters:
type
- the targetdata type
.value
- the value to convert- Returns:
- a value of the specified type's instance class
- Throws:
IllegalArgumentException
- if the value could not be converted- See Also:
-
convert
Convert the specified value to aninstance
of the specified property'stype
. The specified value must be a List if the property ismany valued
. In this case, all the values in the List are converted.- Specified by:
convert
in interfaceDataHelper
- Parameters:
property
- the targetdata type
property.value
- the value or List of values to convert- Returns:
- a converted value or list of converted values
- Throws:
IllegalArgumentException
- if the value could not be converted- See Also:
-
convertValueToClass
INTERNAL: -
getHelperContext
INTERNAL: -
setHelperContext
INTERNAL:
-