|
com.im.commons 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.im.commons.util.DataConvertorUtils
public final class DataConvertorUtils
| Nested Class Summary | |
|---|---|
static class |
DataConvertorUtils.DateOptions
An options bean for date conversion functions. |
| Method Summary | |
|---|---|
static Object |
convert(Object input,
Class targetType)
Convert value to value with targetType. |
static Boolean |
convertBoolean(Object o)
|
static Date |
convertDate(Object o,
DataConvertorUtils.DateOptions opts)
|
static Double |
convertDouble(Object o)
|
static Float |
convertFloat(Object o)
|
static Integer |
convertInteger(Object o,
DataConvertorOptions.Int options)
|
static byte[] |
decodeHex(String hex)
Converts a hexadecimal number to a byte array. |
static String |
encodeHex(byte[] raw)
Converts an array of bytes to their hexadecimal representation. |
static Object |
normalizeValue(Object value)
Cut space in the beginning and end of the string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Object normalizeValue(Object value)
Returns the original value if it is not a String instance
Returns null if value is null
Returns null if value after cutting spaces is String("")
value - To be normalized
public static Boolean convertBoolean(Object o)
public static Integer convertInteger(Object o,
DataConvertorOptions.Int options)
public static Float convertFloat(Object o)
public static Double convertDouble(Object o)
public static Date convertDate(Object o,
DataConvertorUtils.DateOptions opts)
public static Object convert(Object input,
Class targetType)
input - input valuetargetType - target Type (Integer, Float, Date, Boolean, String)
public static String encodeHex(byte[] raw)
Example: encodeHex(new byte [] { 10, 20, 30 }).equals("0A141E");
raw - An array of bytes to convert.
public static byte[] decodeHex(String hex)
Example: decodeHex("ABCDEF").equals(new byte [] { 171, 205, 239 });
hex - A string of hexadecimal digit pairs to convert. It must contain
an even number of characters.
hex string.
IllegalArgumentException - If hex string contains odd number of characters
or if the characters are not hexadecimal digits.
|
com.im.commons 5.9 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||