public final class BasicTypeConverter extends Object implements Serializable
Converts objects to the required type if required.
| Modifier and Type | Field and Description |
|---|---|
static int |
ENUM
Type code for an Enum type.
|
static int |
MATH_BIGINTEGER
Type code for java.math.BigInteger.
|
static int |
UTIL_CALENDAR
Type code for java.util.Calendar.
|
static int |
UTIL_DATE
Type code for java.util.Date.
|
| Modifier and Type | Method and Description |
|---|---|
static Object |
convert(Object value,
int toDataType)
Convert the Object to the required data type.
|
static BigDecimal |
toBigDecimal(Object value)
convert the passed in object to a BigDecimal.
|
static Boolean |
toBoolean(Object value)
Convert the value to a Boolean.
|
static Boolean |
toBoolean(Object value,
String dbTrueValue)
Convert the value to a Boolean with an explicit String true value.
|
static Byte |
toByte(Object value) |
static Calendar |
toCalendar(Object value)
convert the passed in object to a java sql Date.
|
static Date |
toDate(Object value)
convert the passed in object to a java sql Date.
|
static Double |
toDouble(Object value)
Convert the object to a Double.
|
static Float |
toFloat(Object value) |
static Integer |
toInteger(Object value)
convert the passed in object to a Integer.
|
static Long |
toLong(Object value)
Convert the object to a Long.
|
static BigInteger |
toMathBigInteger(Object value) |
static Short |
toShort(Object value) |
static String |
toString(Object value)
Convert the value to a String.
|
static Time |
toTime(Object value) |
static Timestamp |
toTimestamp(Object value)
convert the passed in object to a Timestamp.
|
static Date |
toUtilDate(Object value)
convert the passed in object to a java sql Date.
|
static UUID |
toUUID(Object value)
Convert the value to a UUID.
|
public static final int UTIL_CALENDAR
public static final int UTIL_DATE
public static final int MATH_BIGINTEGER
public static final int ENUM
public static Object convert(Object value, int toDataType)
value - the Object valuetoDataType - the dataType as per java.sql.Types.public static Boolean toBoolean(Object value, String dbTrueValue)
public static Boolean toBoolean(Object value)
public static BigDecimal toBigDecimal(Object value)
public static Integer toInteger(Object value)
public static Long toLong(Object value)
public static BigInteger toMathBigInteger(Object value)
public static Double toDouble(Object value)
public static Timestamp toTimestamp(Object value)
public static Date toUtilDate(Object value)
Copyright © 2014. All Rights Reserved.