List of utility methods to do Object Convert to
boolean | objToBoolean(Object o) obj To Boolean if (o != null) { if (o instanceof Boolean) return ((Boolean) o).booleanValue(); else if (o instanceof String) { String s = (String) o; if (s.equalsIgnoreCase("true")) return true; if (s.equalsIgnoreCase("false")) ... |
Long | objToLong(Object obj) obj To Long return null == obj || "null".equals(obj.toString()) ? 0 : Long.parseLong(obj.toString()); |
String[] | objToPrim() obj To Prim String[] methods = new String[types.length]; for (int i = 0; i < methods.length; i++) { String prim = types[i][0]; String obj = types[i][1]; insertDoc(methods, i, "Converts a {@link %o} array to its primitive equivalent (%p[])"); methods[i] += "public static " + prim + "[] objToPrim(" + obj + "[] array) {\n"; methods[i] += " " + prim + "[] clone = new " + prim + "[array.length];\n"; methods[i] += "\n for(int i = 0; i < array.length; i++)\n"; ... |
Long | objToTimeLong(Object obj) obj To Time Long Long l = null; if (obj != null) { l = (Long) obj; return l; |