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

booleanisPrimitiveWrapper(Class klass)
Determines if klass represents a wrapper for a primitive type.
return PRIMITIVE_WRAPPERS.containsValue(klass);
booleanisPrimitiveWrapper(final Class type)
Returns whether the given type is a primitive wrapper ( Boolean , Byte , Character , Short , Integer , Long , Double , Float ).
return wrapperPrimitiveMap.containsKey(type);
booleanisPrimitiveWrapperArray(Class clazz)
Check if the given class represents an array of primitive wrappers, i.e.
if (clazz == null)
    throw new IllegalArgumentException("Class must not be null");
return (clazz.isArray() && isPrimitiveWrapper(clazz.getComponentType()));
booleanisPrimitiveWrapperClass(Class primitiveWrapperClass)
is Primitive Wrapper Class
return primitiveStringToClass.values().contains(primitiveWrapperClass);
booleanisWrapper(Class clazz)
Returns information whether the given class is the wrapper class.
return wrappers.contains(clazz);
booleanisWrapper(Class dataType)
is Wrapper
return wrapperClassesMap().containsKey(dataType);
booleanisWrapperAndPrimitivePair(Class c1, Class c2)
is Wrapper And Primitive Pair
if (c1 == null || c2 == null) {
    return false;
if (c1.isPrimitive()) {
    return PRIMITIVES_TO_WRAPPERS.get(c1).equals(c2);
} else if (c2.isPrimitive()) {
    return PRIMITIVES_TO_WRAPPERS.get(c2).equals(c1);
return false;
booleanisWrapperClass(Class clazz)
is Wrapper Class
return primitiveMap.values().contains(clazz);
booleanisWrapperType(Class type)
is Wrapper Type
return WRAPPER_TYPES.contains(type);
intmatchPrimitive(Class paramType, Object arg)
Attempts to match the argument value against the passed primitive type.
Class<?> argType = getPrimitiveType(arg);
if (argType == null)
    return -1;
if (paramType == argType)
    return 1;
if (integralDistance.containsKey(argType) && integralDistance.containsKey(paramType)) {
    int argDepth = integralDistance.get(argType).intValue();
    int paramDepth = integralDistance.get(paramType).intValue();
...