List of utility methods to do Reflection Primitive
Class> | primitiveArraysForName(String className) primitive Arrays For Name return PRIMITIVE_ARRAYS.get(className);
|
Class> | primitiveToWrapper(final Class> cls) Converts the specified primitive Class object to its corresponding wrapper Class object. Class<?> convertedClass = cls; if (cls != null && cls.isPrimitive()) { convertedClass = primitiveWrapperMap.get(cls); return convertedClass; |
Class> | primitiveToWrapper(final Class> cls) primitive To Wrapper Class<?> convertedClass = cls; if (cls != null && cls.isPrimitive()) { convertedClass = primitiveWrapperMap.get(cls); return convertedClass; |
Class> | resolveClassPrimitiveAware(String className) resolve Class Primitive Aware if (className == null) { throw new NullPointerException(); Class<?> primClass = PRIMITIVE_TYPES.get(className); if (primClass != null) { return primClass; } else { return Class.forName(className); ... |
Class | resolvePrimitiveClassName(String name) Resolve the given class name as primitive class, if appropriate, according to the JVM's naming rules for primitive classes. Class result = null; if (name != null && name.length() <= 8) { result = (Class) primitiveTypeNameMap.get(name); return result; |
Class> | resolvePrimitiveClassName(String name) resolve Primitive Class Name Class result = null; if (name != null && name.length() <= 8) { result = primitiveTypeNameMap.get(name); return result; |
Class> | resolvePrimitiveIfNecessary(Class> clazz) Resolve the given class if it is a primitive class, returning the corresponding primitive wrapper type instead. if (clazz == null) { throw new IllegalArgumentException("Class must not be null"); return (clazz.isPrimitive() && clazz != void.class ? primitiveTypeToWrapperMap.get(clazz) : clazz); |
Class> | resolvePrimitiveType(Class> clazz) Resolve the given class if it is a primitive wrapper class, returning the corresponding primitive type instead. return primitiveWrapperTypeMap.get(clazz);
|
T | toPrimitive(String primitiveJson, Class to Primitive Object result = null; if (clazz.isAssignableFrom(int.class)) { result = Integer.parseInt(primitiveJson); } else if (clazz.isAssignableFrom(long.class)) { result = Long.parseLong(primitiveJson); } else if (clazz.isAssignableFrom(short.class)) { result = Short.parseShort(primitiveJson); } else if (clazz.isAssignableFrom(float.class)) { ... |
Class> | unwrapPrimitive(final Class> clazz) If the specified Class is a wrapped primitive, then this function will return the primitive version. if (UNWRAP_MAP.containsKey(clazz)) { return UNWRAP_MAP.get(clazz); } else { return clazz; |