List of utility methods to do Primitive Type Create
Class> | toPrimitiveType(Class> c) to Primitive Type if (c == null || c.isPrimitive()) return c; if (c.equals(Void.class)) return c; else if (c.equals(Boolean.class)) return Boolean.TYPE; else if (c.equals(Integer.class)) return Integer.TYPE; ... |
Class> | toPrimitiveType(Class> cls) to Primitive Type Class<?> pType = cls; if (!cls.isArray()) { if (Boolean.TYPE == cls) pType = Boolean.class; else if (Character.TYPE == cls) pType = Character.class; else if (Byte.TYPE == cls) pType = Byte.class; ... |
Class> | toPrimitiveType(Class> type) to Primitive Type if (type == Boolean.class) return Boolean.TYPE; else if (type == Byte.class) return Byte.TYPE; else if (type == Short.class) return Short.TYPE; else if (type == Integer.class) return Integer.TYPE; ... |
Class | toPrimitiveWrapper(Class type) to Primitive Wrapper if (type.equals(boolean.class)) { return Boolean.class; } else if (type.equals(byte.class)) { return Byte.class; } else if (type.equals(char.class)) { return Character.class; } else if (type.equals(short.class)) { return Short.class; ... |
T | toPrimitiveWrapper(String primitiveJson, Class to Primitive Wrapper Object result = null; if (clazz.isAssignableFrom(Integer.class)) { result = Integer.valueOf(primitiveJson); } else if (clazz.isAssignableFrom(Long.class)) { result = Long.valueOf(primitiveJson); } else if (clazz.isAssignableFrom(Short.class)) { result = Short.valueOf(primitiveJson); } else if (clazz.isAssignableFrom(Float.class)) { ... |