public class DataConverter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FORMAT_PATTERN_DATE |
static String |
FORMAT_PATTERN_DATETIME |
static String |
FORMAT_PATTERN_DAY |
static String |
FORMAT_PATTERN_MONTH |
static String |
FORMAT_PATTERN_MONTHDAY |
static String |
FORMAT_PATTERN_TIME |
static String |
FORMAT_PATTERN_YEAR |
static String |
FORMAT_PATTERN_YEARMONTH |
static String |
FORMAT_PATTERN_YEARMONTHDAY |
static DataConverter |
INSTANCE |
| Modifier and Type | Method and Description |
|---|---|
Object |
convert(Type targetType,
Object value) |
Object |
convert(Type targetType,
Type sourceType,
Object value) |
Object |
fromBoolean(Type targetType,
boolean value) |
Object |
fromByte(Type targetType,
byte value) |
Object |
fromBytes(Type targetType,
byte[] value) |
Object |
fromCharacter(Type targetType,
char value) |
Object |
fromDate(Type targetType,
Date value) |
Object |
fromDecimal(Type targetType,
BigDecimal value) |
Object |
fromDouble(Type targetType,
double value) |
Object |
fromFloat(Type targetType,
float value) |
Object |
fromInt(Type targetType,
int value) |
Object |
fromInteger(Type targetType,
BigInteger value) |
Object |
fromLong(Type targetType,
long value) |
Object |
fromShort(Type targetType,
short value) |
Object |
fromString(Property targetProperty,
String value)
Converts the given string value to an object appropriate
for the target property and its type.
|
Object |
fromString(Type targetType,
String value)
Converts the given string value to an object appropriate
for the target type.
|
Object |
fromStrings(Type targetType,
List<String> value) |
Object |
fromTemporalDataType(Type targetType,
Type sourceType,
String value) |
List<DataType> |
getAllowableTargetTypes(DataType dataType) |
DateFormat |
getDateFormat() |
DateFormat[] |
getDateFormats() |
DateFormat |
getDateTimeFormat() |
DateFormat |
getDayFormat() |
org.joda.time.format.PeriodFormatter |
getDurationFormat() |
DateFormat |
getMonthDayFormat() |
DateFormat |
getMonthFormat() |
DateFormat |
getTimeFormat() |
DateFormat |
getYearFormat() |
DateFormat |
getYearMonthDayFormat() |
DateFormat |
getYearMonthFormat() |
boolean |
toBoolean(Type sourceType,
Object value) |
byte |
toByte(Type sourceType,
Object value) |
byte[] |
toBytes(Type sourceType,
Object value) |
char |
toCharacter(Type sourceType,
Object value) |
Date |
toDate(Type sourceType,
Object value) |
BigDecimal |
toDecimal(Type sourceType,
Object value) |
double |
toDouble(Type sourceType,
Object value) |
float |
toFloat(Type sourceType,
Object value) |
int |
toInt(Type sourceType,
Object value) |
BigInteger |
toInteger(Type sourceType,
Object value) |
long |
toLong(Type sourceType,
Object value) |
Class<?> |
toPrimitiveJavaClass(DataType dataType)
Returns a primitive Java class, wherever possible, for
the given SDO data-type (as
per the SDO Specification 2.10 Section 8.1), and where
no primitive exists for the give SDO datatype, the appropriate
class is returned.
|
short |
toShort(Type sourceType,
Object value) |
String |
toString(Property property,
Object value)
Converts the given value to a string.
|
String |
toString(Type sourceType,
Object value)
Converts the given value to a string.
|
List<String> |
toStrings(Type sourceType,
Object value) |
String |
toTemporalDataType(Type targetType,
Type sourceType,
Object value) |
Class<?> |
toWrapperJavaClass(DataType dataType)
Returns a primitive wrapper Java class, wherever possible, for
the given SDO data-type (as
per the SDO Specification 2.10 Section 8.1), and where
no primitive exists for the give SDO datatype, the appropriate
class is returned.
|
public static volatile DataConverter INSTANCE
public static final String FORMAT_PATTERN_TIME
public static final String FORMAT_PATTERN_DATE
public static final String FORMAT_PATTERN_DATETIME
public static final String FORMAT_PATTERN_DAY
public static final String FORMAT_PATTERN_MONTH
public static final String FORMAT_PATTERN_MONTHDAY
public static final String FORMAT_PATTERN_YEAR
public static final String FORMAT_PATTERN_YEARMONTH
public static final String FORMAT_PATTERN_YEARMONTHDAY
public DateFormat[] getDateFormats()
public DateFormat getDateTimeFormat()
public DateFormat getTimeFormat()
public DateFormat getDateFormat()
public org.joda.time.format.PeriodFormatter getDurationFormat()
public DateFormat getDayFormat()
public DateFormat getMonthFormat()
public DateFormat getMonthDayFormat()
public DateFormat getYearFormat()
public DateFormat getYearMonthFormat()
public DateFormat getYearMonthDayFormat()
public BigDecimal toDecimal(Type sourceType, Object value)
public Object fromDecimal(Type targetType, BigDecimal value)
public BigInteger toInteger(Type sourceType, Object value)
public Object fromInteger(Type targetType, BigInteger value)
public String toString(Type sourceType, Object value)
sourceType - the target datatypevalue - the value to convertInvalidDataConversionException - if the given source
type cannot be converted to string as per the SDO 2.1
datatype conversion table.IllegalArgumentException - if the given value is not
the expected Java type as per the SDO 2.1 specificationpublic String toString(Property property, Object value)
sourceProperty - the property type for the given propertyvalue - the value to convertInvalidDataConversionException - If an array of objects of the target type
is detected for the given value,
and the given property is not a 'many' propertyIllegalArgumentException - if the given value is not
the expected Java type as per the SDO 2.1 specificationIllegalArgumentException - if an array of objects of the target type is detected for the given value,
and the given property is not a 'many' propertypublic Object fromString(Type targetType, String value)
targetType - the target data typevalue - the valuepublic Object fromString(Property targetProperty, String value)
targetType - the target data typevalue - the value to convert from stringIllegalArgumentException - if the given property is a 'many' property and no
java.util.Arrays formatting is detected for the given value.public Object fromTemporalDataType(Type targetType, Type sourceType, String value)
public Class<?> toPrimitiveJavaClass(DataType dataType)
dataType - the SDO datatypepublic Class<?> toWrapperJavaClass(DataType dataType)
dataType - the SDO datatypeCopyright © 2017. All rights reserved.