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

ClassgetPrimitiveClass(String primitiveClassName)
get Primitive Class
return primitiveClasses.get(primitiveClassName);
ClassgetPrimitiveClass(String primitiveName)
get Primitive Class
return nameToPrimitiveClass.get(primitiveName);
ClassgetPrimitiveClassIfWrapper(Class clazz)
get Primitive Class If Wrapper
Class<?> ret = getPrimitiveClass(clazz);
if (ret != null) {
    return ret;
return clazz;
ObjectgetPrimitiveDefault(Class primitiveClazz)
Returns the wrapper object of a given primitive Class with the default value
return primitiveWrappersMap.get(primitiveClazz);
floatgetPrimitivePromotionCost(final Class srcClass, final Class destClass)
get Primitive Promotion Cost
float cost = 0.0f;
Class<?> cls = srcClass;
if (!cls.isPrimitive()) {
    cost += 0.1f;
    cls = wrapperToPrimitive(cls);
for (int i = 0; cls != destClass && i < ORDERED_PRIMITIVE_TYPES.length; i++) {
    if (cls == ORDERED_PRIMITIVE_TYPES[i]) {
...
intgetPrimitiveSize(Class type)
get Primitive Size
return primarySizeMapper.get(type);
ClassgetPrimitiveType(Class clazz)
get Primitive Type
return CORRESPONDING_TYPES.containsKey(clazz) ? CORRESPONDING_TYPES.get(clazz) : clazz;
ClassgetPrimitiveType(String javaClassName)
get Primitive Type
return javaPrimitiveToType.get(javaClassName);
ClassgetPrimitiveWrapper(Class primitiveType)
Gets the wrapper object class for the given primitive type class.
return primitiveTypeToWrapperMap.get(primitiveType);
intgetRank(Class aNumberClass)
Gets the ordinal type rank of the given Number Class.
Integer rank = (Integer) NUMBER_RANK_MAP.get(aNumberClass);
assert rank != null;
return rank.intValue();