Java Utililty Methods Object Type Case

List of utility methods to do Object Type Case

Description

The list of methods to do Object Type Case are organized into topic(s).

Method

StringcastTotal(boolean isDoubleQuote, String target)
cast Total
return castQuote(isDoubleQuote, target.replace("\n", "\\n").replace("\t", "\\t"));
TcastToTypeOrNull(Object object, Class clazz)
cast To Type Or Null
return clazz.isInstance(object) ? clazz.cast(object) : null;
StringcastUnderLine(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();
TcastValue(String value, Class clazz)
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) {
...
TcastWithGenericsOrNull(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;