Package commonj.sdo.helper
Interface DataHelper
-
public interface DataHelperData helper methods.
-
-
Field Summary
Fields Modifier and Type Field Description static DataHelperINSTANCEThe default DataHelper.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Objectconvert(Property property, java.lang.Object value)java.lang.Objectconvert(Type type, java.lang.Object value)Convert the specified value to aninstanceof the specified type.java.util.CalendartoCalendar(java.lang.String dateString)Convert from a String representation of an SDO date type to a Calendar using the default locale.java.util.CalendartoCalendar(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.DatetoDate(java.lang.String dateString)Convert from a String representation of an SDO date type to a Date.java.lang.StringtoDateTime(java.util.Calendar calendar)Convert from a Calendar to a String representation of the DateTime type.java.lang.StringtoDateTime(java.util.Date date)Convert from a Date to a String representation of the DateTime type.java.lang.StringtoDay(java.util.Calendar calendar)Convert from a Calendar to a String representation of the Day type.java.lang.StringtoDay(java.util.Date date)Convert from a Date to a String representation of the Day type.java.lang.StringtoDuration(java.util.Calendar calendar)Convert from a Calendar to a String representation of the Duration type.java.lang.StringtoDuration(java.util.Date date)Convert from a Date to a String representation of the Duration type.java.lang.StringtoMonth(java.util.Calendar calendar)Convert from a Calendar to a String representation of the Month type.java.lang.StringtoMonth(java.util.Date date)Convert from a Date to a String representation of the Month type.java.lang.StringtoMonthDay(java.util.Calendar calendar)Convert from a Calendar to a String representation of the MonthDay type.java.lang.StringtoMonthDay(java.util.Date date)Convert from a Date to a String representation of the MonthDay type.java.lang.StringtoTime(java.util.Calendar calendar)Convert from a Calendar to a String representation of the Time type.java.lang.StringtoTime(java.util.Date date)Convert from a Date to a String representation of the Time type.java.lang.StringtoYear(java.util.Calendar calendar)Convert from a Calendar to a String representation of the Year type.java.lang.StringtoYear(java.util.Date date)Convert from a Date to a String representation of the Year type.java.lang.StringtoYearMonth(java.util.Calendar calendar)Convert from a Calendar to a String representation of the YearMonth type.java.lang.StringtoYearMonth(java.util.Date date)Convert from a Date to a String representation of the YearMonth type.java.lang.StringtoYearMonthDay(java.util.Calendar calendar)Convert from a Calendar to a String representation of the YearMonthDay type.java.lang.StringtoYearMonthDay(java.util.Date date)Convert from a Date to a String representation of the YearMonthDay type.
-
-
-
Field Detail
-
INSTANCE
static final DataHelper INSTANCE
The default DataHelper.
-
-
Method Detail
-
toDate
java.util.Date toDate(java.lang.String dateString)
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:
java.lang.IllegalArgumentException- for invalid formats.
-
toCalendar
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
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 typelocale- the locale or null for default locale.- Returns:
- a Calendar representation of an SDO date type.
- Throws:
java.lang.IllegalArgumentException- for invalid formats.
-
toDateTime
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.
-
toDuration
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.
-
toTime
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.
-
toDay
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.
-
toMonth
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
java.lang.String toMonthDay(java.util.Date date)
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
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
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
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.
-
toDateTime
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.
-
toDuration
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.
-
toTime
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.
-
toDay
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.
-
toMonth
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.
-
toMonthDay
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.
-
toYear
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.
-
toYearMonth
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
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.
-
convert
java.lang.Object convert(Type type, java.lang.Object value)
Convert the specified value to aninstanceof 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:
java.lang.IllegalArgumentException- if the value could not be converted- See Also:
convert(Property, Object)
-
convert
java.lang.Object convert(Property property, java.lang.Object value)
Convert the specified value to aninstanceof 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 typeproperty.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)
-
-