Returns the corresponding primitive type for the given primitive wrapper,
or null if the type is not a primitive wrapper.

@param wrapperType wrapperType
@return the corresponding primitive type
498418
public static Class<?> getPrimitiveType(Class<?> wrapperType) {
        if (Boolean.class.equals(wrapperType)) {
            return Boolean.TYPE;
        } else if (Byte.class.equals(wrapperType)) {
            return Byte.TYPE;
        } else if (Character.class.equals(wrapperType)) {
            return Character.TYPE;
        } else if (Short.class.equals(wrapperType)) {
            return Short.TYPE;
        } else if (Integer.class.equals(wrapperType)) {
            return Integer.TYPE;
        } else if (Long.class.equals(wrapperType)) {
            return Long.TYPE;
        } else if (Float.class.equals(wrapperType)) {
            return Float.TYPE;
        } else if (Double.class.equals(wrapperType)) {
            return Double.TYPE;
        } else {
            return null;
        }
    }
187049
private static Class primitiveToWrapperType(Class clazz) {
	// boolean, byte, char, short, int, long, float, and double
	if (clazz == null) return null;
	else if (clazz.isPrimitive()) {
	    if (clazz.getName().equals("boolean")) return Boolean.class;
	    else if (clazz.getName().equals("byte")) return Byte.class;
	    else if (clazz.getName().equals("char")) return Character.class;
	    else if (clazz.getName().equals("short")) return Short.class;
	    else if (clazz.getName().equals("int")) return Integer.class;
	    else if (clazz.getName().equals("long")) return Long.class;
	    else if (clazz.getName().equals("float")) return Float.class;
	    else if (clazz.getName().equals("double")) return Double.class;
	}
	return clazz;
    }
843291
Class<?> classOfPrimitiveArrayFor(String primitiveType) {
        return ClassUtils.arrayTypeForPrimitive(primitiveType)
                    .orElseThrow(() -> new IllegalArgumentException("Unsupported primitive type " + primitiveType));
    }
382704
public int getSarlElementEcoreType(LightweightTypeReference type) {
		final JvmType jvmType = type.getType();
		if (jvmType instanceof JvmGenericType) {
			return getSarlElementEcoreType((JvmGenericType) jvmType);
		}
		return 0;
	}
1052710
protected synchronized HierarchicalType getDataType(String type) {
        HierarchicalType dataType = typeInstances.get(type);
        //todo: are there still cases where type can be null?
        if (dataType == null) {
            dataType = createDataType(type);
            typeInstances.put(type, dataType);
        }
        return dataType;
    }
410874
@Nullable
  private Type getPrimitiveOrVoidType(String typeStr) {
    switch (typeStr) {
      case "byte":
        return getSymtab().byteType;
      case "short":
        return getSymtab().shortType;
      case "int":
        return getSymtab().intType;
      case "long":
        return getSymtab().longType;
      case "float":
        return getSymtab().floatType;
      case "double":
        return getSymtab().doubleType;
      case "boolean":
        return getSymtab().booleanType;
      case "char":
        return getSymtab().charType;
      case "void":
        return getSymtab().voidType;
      default:
        return null;
    }
  }
899853
public static Class<?> getRawType(Type type) {
		if (type instanceof Class<?>) {
			// type is a normal class.
			return (Class<?>) type;

		} else if (type instanceof ParameterizedType) {
			ParameterizedType parameterizedType = (ParameterizedType) type;

			// I'm not exactly sure why getRawType() returns Type instead of Class.
			// Neal isn't either but suspects some pathological case related
			// to nested classes exists.
			Type rawType = parameterizedType.getRawType();
			if (!(rawType instanceof Class)) {
				String message = MessageFormat.format("Expected a Class, but <{0}> is of type {1}", type, type.getClass()
						.getName());
				throw new IllegalArgumentException(message);
			}
			return (Class<?>) rawType;

		} else if (type instanceof GenericArrayType) {
			Type componentType = ((GenericArrayType) type).getGenericComponentType();
			return Array.newInstance(getRawType(componentType), 0).getClass();

		} else if (type instanceof TypeVariable) {
			// we could use the variable's bounds, but that'll won't work if there are multiple.
			// having a raw type that's more general than necessary is okay  
			return Object.class;

		} else {
			throw new IllegalArgumentException("Expected a Class, ParameterizedType, or " + "GenericArrayType, but <"
					+ type + "> is of type " + type.getClass().getName());
		}
	}
1227017
public static Object getPrimitiveDefaultValue(Class<?> primitiveType) {
        if (boolean.class.equals(primitiveType)) {
            return false;
        } else if (byte.class.equals(primitiveType)) {
            return (byte) 0;
        } else if (char.class.equals(primitiveType)) {
            return '\0';
        } else if (short.class.equals(primitiveType)) {
            return (short) 0;
        } else if (int.class.equals(primitiveType)) {
            return 0;
        } else if (long.class.equals(primitiveType)) {
            return 0L;
        } else if (float.class.equals(primitiveType)) {
            return 0F;
        } else if (double.class.equals(primitiveType)) {
            return 0D;
        } else {
            return null;
        }
    }
1372794
public String mapPrimitiveType2ObjectTypeName(String primitiveTypeName) {
		if (primitive2ObjectTypeNameMap.containsKey(primitiveTypeName)) {
			return primitive2ObjectTypeNameMap.get(primitiveTypeName);
		} else {
			return primitiveTypeName;
		}
	}
92800
@Override
    public boolean isWrapperFor(@SuppressWarnings("rawtypes") Class wrappedType) {
        if (!ServletRequest.class.isAssignableFrom(wrappedType)) {
            throw new IllegalArgumentException("Given class " +
                                               wrappedType.getName() + " not a subinterface of " +
                                               ServletRequest.class.getName());
        }

        final ServletRequest request = getHttpServletRequest();
        @SuppressWarnings("unchecked")
        final Class<? extends ServletRequest> wrappedServletType = wrappedType;

        if (wrappedServletType.isAssignableFrom(request.getClass())) {
            return true;
        } else if (request instanceof ServletRequestWrapper) {
            return ((ServletRequestWrapper) request).isWrapperFor(wrappedType);
        } else {
            return false;
        }
    }
244070
public static boolean isPrimitiveWrapper(Class<?> clazz) {
		if (null == clazz) {
			return false;
		}
		return BasicType.wrapperPrimitiveMap.containsKey(clazz);
	}
706689
public static Class<?> getPrimitiveClass(Type type) {
        switch (type.getDescriptor().charAt(0)) {
            case 'B':
                return byte.class;
            case 'C':
                return char.class;
            case 'D':
                return double.class;
            case 'F':
                return float.class;
            case 'I':
                return int.class;
            case 'J':
                return long.class;
            case 'S':
                return short.class;
            case 'V':
                return void.class;
            case 'Z':
                return boolean.class;

            default:
                throw new IllegalArgumentException("Unrecognized type [ " + type.getDescriptor() + " ]");
        }
    }
1130105
public static Class<?> getPrimitiveClass(final Class<?> clazz) {

    if (clazz == null) {
      return null;
    }
    int index = ArrayUtils.indexOf(WRAPPER_CLASSES, clazz);
    if (index != ArrayUtils.INDEX_OF_NOT_FOUND) {
      return PRIMITIVE_CLASSES[index];
    }
    return clazz;
  }
823316
public static Class unwrapType(Class pType) {
        if (pType == Boolean.class) {
            return Boolean.TYPE;
        }
        else if (pType == Byte.class) {
            return Byte.TYPE;
        }
        else if (pType == Character.class) {
            return Character.TYPE;
        }
        else if (pType == Double.class) {
            return Double.TYPE;
        }
        else if (pType == Float.class) {
            return Float.TYPE;
        }
        else if (pType == Integer.class) {
            return Integer.TYPE;
        }
        else if (pType == Long.class) {
            return Long.TYPE;
        }
        else if (pType == Short.class) {
            return Short.TYPE;
        }

        throw new IllegalArgumentException("Not a primitive wrapper: " + pType);
    }
542975
@Override
	public JavaType getJavaType(final int jdbcType, final String jdbcTypeName) {
		JDBCType type = null;
		try {
			type = JDBCType.valueOf(jdbcType);
		} catch (IllegalArgumentException ex) {
			type = JDBCType.OTHER;
		}
		return getJavaType(type, jdbcTypeName);
	}
728444
public static Type getArrayComponentType(Type type) {
		if (type instanceof Class) {
			Class<?> clazz = (Class<?>)type;
			return clazz.getComponentType();
		} else if (type instanceof GenericArrayType) {
			GenericArrayType aType = (GenericArrayType) type;
			return aType.getGenericComponentType();
		} else {
			return null;
		}
	}
1136089
@Trivial
    private static Type getType(Converter<?> converter) {
        Type type = null;

        Type[] itypes = converter.getClass().getGenericInterfaces();
        for (Type itype : itypes) {
            ParameterizedType ptype = (ParameterizedType) itype;
            if (ptype.getRawType() == Converter.class) {
                Type[] atypes = ptype.getActualTypeArguments();
                if (atypes.length == 1) {
                    type = atypes[0];
                    break;
                } else {
                    throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
                }
            }
        }
        if (type == null) {
            throw new ConfigException(Tr.formatMessage(tc, "unable.to.determine.conversion.type.CWMCG0009E", converter.getClass().getName()));
        }

        return type;
    }