- All Known Implementing Classes:
SDODataHelper
public interface DataHelper
Data helper methods.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionConvert the specified value to aninstance
of the specified type.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 an SDO 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) Deprecated.There is no accepted algorithm to convert a date into a Duration so use of this method is discouraged.toDuration
(Date date) Deprecated.There is no accepted algorithm to convert a date into a Duration so use of this method is discouraged.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.
-
Field Details
-
INSTANCE
The default DataHelper.
-
-
Method Details
-
toDate
Convert from a String representation of an SDO date type to a Date.- Parameters:
dateString
- the String representation of an SDO date type- Returns:
- a Date 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 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:
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.- 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.
-
toDateTime
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.
-
toDuration
Deprecated.There is no accepted algorithm to convert a date into a Duration so use of this method is discouraged. 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.
-
toTime
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.
-
toDay
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.
-
toMonth
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
Convert from a Date to a String representation of the MonthDay type.- Parameters:
date
- the date- Returns:
- a Date to a String representation of the MonthDay type.
-
toYear
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
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
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.
-
toDateTime
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.
-
toDuration
Deprecated.There is no accepted algorithm to convert a date into a Duration so use of this method is discouraged. 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.
-
toTime
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.
-
toDay
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.
-
toMonth
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.
-
toMonthDay
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.
-
toYear
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.
-
toYearMonth
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
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.
-
convert
Convert the specified value to aninstance
of the specified type. Supported conversions are listed in Section 16 of the SDO specification.- 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.- 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:
-