Java Utililty Methods Reflection Primitive

List of utility methods to do Reflection Primitive

Description

The list of methods to do Reflection Primitive are organized into topic(s).

Method

ClassprimitiveArraysForName(String className)
primitive Arrays For Name
return PRIMITIVE_ARRAYS.get(className);
ClassprimitiveToWrapper(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;
ClassprimitiveToWrapper(final Class cls)
primitive To Wrapper
Class<?> convertedClass = cls;
if (cls != null && cls.isPrimitive()) {
    convertedClass = primitiveWrapperMap.get(cls);
return convertedClass;
ClassresolveClassPrimitiveAware(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);
...
ClassresolvePrimitiveClassName(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;
ClassresolvePrimitiveClassName(String name)
resolve Primitive Class Name
Class result = null;
if (name != null && name.length() <= 8) {
    result = primitiveTypeNameMap.get(name);
return result;
ClassresolvePrimitiveIfNecessary(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);
ClassresolvePrimitiveType(Class clazz)
Resolve the given class if it is a primitive wrapper class, returning the corresponding primitive type instead.
return primitiveWrapperTypeMap.get(clazz);
TtoPrimitive(String primitiveJson, Class clazz)
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)) {
...
ClassunwrapPrimitive(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;