public final class MCast extends Object
All Funktions are static.
| Constructor and Description |
|---|
MCast() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addCaster(Caster<?,?> caster,
boolean overwrite)
addCaster.
|
static byte |
byteFromHex(String in,
int offset)
Convert a two letter hex value to a single byte value.
|
static Object |
fromBinary(byte[] bin)
fromBinary.
|
static byte[] |
fromBinaryString(String in)
Convert a string with hex values in a byte array.
|
static Object |
getDefaultPrimitive(Class<?> type)
Return 0 in 7 flavors or null
|
static Date |
objectToDate(Object value)
objectToDate.
|
static String |
objectToString(Object value)
objectToString.
|
static byte[] |
toBinary(Object value)
toBinary.
|
static String |
toBinaryString(byte[] in)
Convert the byte array to a string representation.
|
static boolean |
toboolean(Object _in,
boolean _default)
Convert String to boolean.
|
static byte |
tobyte(Object in,
byte def)
tobyte.
|
static byte[] |
toByteArray(String in)
toByteArray.
|
static Calendar |
toCalendar(Date _in,
TimeZone tz,
Locale l)
toCalendar.
|
static Calendar |
toCalendar(Object in)
toCalendar.
|
static Calendar |
toCalendar(String in)
Parse a time date string.
|
static Calendar |
toCalendar(String in,
Calendar def)
Parse time and date and return calendar.
|
static String |
toCurrencyString(double _in)
Will round the value mathematically and
return every time a comma as separator and
two digits after comma.
|
static Date |
toDate(Object in,
Date def)
Try to parse a String and return the equivalent Date object.
|
static Date |
toDate(Object in,
Date def,
Locale locale)
toDate.
|
static double |
todouble(Object in,
double def)
Convert a string to double.
|
static <E extends Enum<E>> |
toEnum(Object value,
E def)
toEnum.
|
static float |
tofloat(Object in,
float def)
Convert a string to float.
|
static String |
toHex2String(byte in)
Convert a byte to a two letter hex value.
|
static String |
toHex2String(int _in)
Convert integer to two letter hex code.
|
static String |
toHex4String(int _in)
Convert integer to four letter hex code.
|
static Map<String,Object> |
toIndexedMap(Object... values)
Return an indexed map of the values.
|
static int |
toint(Object in,
int def)
Converts String to int.
|
static int |
tointFromHex(String _in)
tointFromHex.
|
static int[] |
toIntIntervalValues(String def,
int defStart,
int defStop)
Return a interval based of the the definition string.
|
static long |
tolong(Object in,
long def)
Converts a string to long.
|
static long[] |
toLongIntervalValues(String def)
Return a interval based of the the definition string.
|
static short |
toshort(Object in,
short def)
toshort.
|
static Date |
toSqlDate(Date date)
toSqlDate.
|
static String |
toString(boolean _in)
Convert a boolean to string.
|
static String |
toString(byte[] in)
toString.
|
static String |
toString(double in)
Convert a double to string.
|
static String |
toString(float in)
Convert a double to string.
|
static String |
toString(int _in)
Converts integer to String.
|
static String |
toString(int _in,
int _digits)
Converts integer to string with the minimum digits.
|
static String |
toString(long _in)
Convert long to string.
|
static String |
toString(Object in)
toString.
|
static String |
toString(Object in,
String def)
toString.
|
static String |
toString(String firstLine,
StackTraceElement[] trace)
toString.
|
static String |
toString(Throwable t)
toString.
|
static String[] |
toStringArray(List<?> _v)
Put all list elements in a string list.
|
static Object |
toType(Object in,
Class<?> type,
Object def)
toType.
|
public static String toCurrencyString(double _in)
_in - a double.String object.public static void addCaster(Caster<?,?> caster, boolean overwrite)
addCaster.
caster - a Caster object.overwrite - a boolean.public static Date toDate(Object in, Date def)
If the time is not in the string, it will be set to "00:00:00". It is possible to leave year, in this case it will be replaced with the actuall year. If you leave month, it will be replaced with the actuall month.
public static Calendar toCalendar(String in, Calendar def)
public static String toBinaryString(byte[] in)
in - an array of byte.String object.public static byte[] fromBinaryString(String in)
in - a String object.public static byte byteFromHex(String in, int offset)
in - a String object.offset - a int.public static String toHex2String(byte in)
in - a byte.String object.public static boolean toboolean(Object _in, boolean _default)
_in - a Object object._default - a boolean.public static float tofloat(Object in, float def)
in - a Object object.def - a float.public static double todouble(Object in, double def)
in - a Object object.def - a double.public static int toint(Object in, int def)
in - a Object object.def - a int.public static long tolong(Object in, long def)
in - a Object object.def - a long.public static byte tobyte(Object in, byte def)
tobyte.
in - a Object object.def - a byte.public static short toshort(Object in, short def)
toshort.
in - a Object object.def - a short.public static String toString(double in)
in - a double.String object.public static String toString(float in)
in - a float.String object.public static String toString(boolean _in)
_in - a boolean.String object.public static String toString(int _in)
_in - a int.String object.public static String toString(int _in, int _digits)
_in - a int._digits - a int.String object.public static String toString(long _in)
_in - a long.String object.public static String toHex2String(int _in)
_in - a int.String object.public static String toHex4String(int _in)
_in - a int.String object.public static String[] toStringArray(List<?> _v)
public static int tointFromHex(String _in)
tointFromHex.
_in - a String object.public static String toString(byte[] in)
toString.
in - an array of byte.String object.public static byte[] toByteArray(String in)
toByteArray.
in - a String object.public static String toString(String firstLine, StackTraceElement[] trace)
toString.
firstLine - a String object.trace - an array of StackTraceElement objects.String object.public static Map<String,Object> toIndexedMap(Object... values)
public static Object getDefaultPrimitive(Class<?> type)
public static byte[] toBinary(Object value) throws IOException
toBinary.
value - a Object object.IOException - if any.public static Object fromBinary(byte[] bin) throws IOException, ClassNotFoundException
fromBinary.
bin - an array of byte.Object object.IOException - if any.ClassNotFoundException - if any.public static long[] toLongIntervalValues(String def)
def - a String object.public static int[] toIntIntervalValues(String def, int defStart, int defStop)
def - defStart - a int.defStop - a int.Copyright © 2016. All Rights Reserved.