List of utility methods to do Object Type Case
String | castTotal(boolean isDoubleQuote, String target) cast Total return castQuote(isDoubleQuote, target.replace("\n", "\\n").replace("\t", "\\t")); |
T | castToTypeOrNull(Object object, Class cast To Type Or Null return clazz.isInstance(object) ? clazz.cast(object) : null;
|
String | castUnderLine(String origin) cast Under Line String sa[] = origin.split("[_]"); StringBuffer sb = new StringBuffer(); for (int i = 0; i < sa.length; i++) { String s = firstUpper(sa[i]); sb.append(s); return sb.toString(); |
T | castValue(String value, Class cast Value if (clazz == String.class) { if (value == null) { return null; return (T) value; } else if (clazz == Integer.class) { return (T) toInteger(value); } else if (clazz == Long.class) { ... |
T | castWithGenericsOrNull(Class base, Object obj) Cast an object at a base class, but return a subclass (for Generics!). try { return (T) base.cast(obj); } catch (ClassCastException e) { return null; |