|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.util.TypeConversionHelper
Class with methods for type conversion
Constructor Summary | |
TypeConversionHelper()
|
Method Summary | |
static java.lang.Object |
convertTo(java.lang.Object value,
java.lang.Class type)
Convert the value to a instance of the given type. |
static java.lang.Object |
getBigDecimalArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getBigIntegerArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.util.BitSet |
getBitSetFromBooleanArray(boolean[] buf)
Convert a boolean[] into an instance of our value class. |
static boolean[] |
getBooleanArrayFromBitSet(java.util.BitSet value)
Convert an instance of our value class into a boolean[]. |
static java.lang.Object |
getBooleanArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getBooleanObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static byte[] |
getByteArrayFromBigDecimalArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromBigIntegerArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromBooleanArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromBooleanObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromByteObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromCharArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromCharObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromDoubleArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromDoubleObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromFloatArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromFloatObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromIntArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromIntObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromLongArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromLongObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromShortArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static byte[] |
getByteArrayFromShortObjectArray(java.lang.Object value)
Convert an instance of our value class into a byte[]. |
static java.lang.Object |
getByteObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getCharArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getCharObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getDoubleArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getDoubleObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getFloatArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getFloatObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.String |
getHexFromInt(int val)
Utility to convert an int into a 8-char hex String |
static java.lang.String |
getHexFromShort(short val)
Utility to convert a short into a 4-char hex String |
static java.lang.Object |
getIntArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static int |
getIntFromByteArray(byte[] bytes)
Utility to convert a byte array to an int. |
static java.lang.Object |
getIntObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getLongArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getLongObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getShortArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.Object |
getShortObjectArrayFromByteArray(byte[] buf)
Convert a byte[] into an instance of our value class. |
static java.lang.String |
getStringFromInt(int val)
Utility to convert an int into a byte-generated String |
static java.lang.String |
getStringFromShort(short val)
Utility to convert a short into a byte-generated String |
static int |
intFromString(java.lang.String str,
int dflt)
Convert a string into an integer. |
static java.sql.Timestamp |
stringToTimestamp(java.lang.String s,
java.util.Calendar cal)
Converts a string in JDBC timestamp escape format to a Timestamp object. |
static java.lang.String |
timestampToString(java.sql.Timestamp ts,
java.util.Calendar cal)
Formats a timestamp in JDBC timestamp escape format using the timezone of the passed Calendar. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TypeConversionHelper()
Method Detail |
public static boolean[] getBooleanArrayFromBitSet(java.util.BitSet value)
value
- Object to be converted
public static java.util.BitSet getBitSetFromBooleanArray(boolean[] buf)
buf
- boolean array to be converted
public static java.lang.Object getBooleanArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromBooleanArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getCharArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromCharArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getDoubleArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromDoubleArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getFloatArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromFloatArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getIntArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromIntArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getLongArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromLongArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getShortArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromShortArray(java.lang.Object value)
value
- Object to be converted
public static byte[] getByteArrayFromBigDecimalArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getBigDecimalArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromBigIntegerArray(java.lang.Object value)
value
- Object to be converted
public static java.lang.Object getBigIntegerArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromBooleanObjectArray(java.lang.Object value)
value
- Boolean[] to be converted
public static java.lang.Object getBooleanObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromByteObjectArray(java.lang.Object value)
value
- Byte[] to be converted
public static java.lang.Object getByteObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromCharObjectArray(java.lang.Object value)
value
- Character array to be converted
public static java.lang.Object getCharObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromDoubleObjectArray(java.lang.Object value)
value
- Double array to be converted
public static java.lang.Object getDoubleObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromFloatObjectArray(java.lang.Object value)
value
- Float array to be converted
public static java.lang.Object getFloatObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromIntObjectArray(java.lang.Object value)
value
- Integer array to be converted
public static java.lang.Object getIntObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromLongObjectArray(java.lang.Object value)
value
- Long array to be converted
public static java.lang.Object getLongObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static byte[] getByteArrayFromShortObjectArray(java.lang.Object value)
value
- Short array to be converted
public static java.lang.Object getShortObjectArrayFromByteArray(byte[] buf)
buf
- byte array to be converted
public static java.lang.Object convertTo(java.lang.Object value, java.lang.Class type)
value
- the value to be convertedtype
- the type of the expected object returned from the coversion
public static java.lang.String getStringFromInt(int val)
val
- The int
public static java.lang.String getStringFromShort(short val)
val
- The short
public static java.lang.String getHexFromInt(int val)
val
- The int
public static java.lang.String getHexFromShort(short val)
val
- The short
public static int getIntFromByteArray(byte[] bytes)
bytes
- The byte array
public static java.sql.Timestamp stringToTimestamp(java.lang.String s, java.util.Calendar cal)
s
- Timestamp stringcal
- The Calendar to use for conversion
java.lang.IllegalArgumentException
- Thrown if the format of the
String is invalidpublic static java.lang.String timestampToString(java.sql.Timestamp ts, java.util.Calendar cal)
ts
- The timestamp to be formatted.cal
- The Calendar
Timestamp
public static int intFromString(java.lang.String str, int dflt)
str
- The stringdflt
- The default value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |