Java Utililty Methods Class Type Check

List of utility methods to do Class Type Check

Description

The list of methods to do Class Type Check are organized into topic(s).

Method

booleanisPrimitiveType(String className)
is Primitive Type
return primitiveTypeMap.containsKey(className);
booleanisPrimitiveWrapper(Class clazz)
is Primitive Wrapper
return primitiveWrapperTypes.contains(clazz);
booleanisPrimitiveWrapper(Class type)
Returns whether the given type is a primitive wrapper ( Boolean , Byte , Character , Short , Integer , Long , Double , Float ).
return wrapperPrimitiveMap.containsKey(type);
booleanisSimpleClass(Class clazz)
is Simple Class
return clazz.isPrimitive() || clazz.isEnum() || String.class.isAssignableFrom(clazz)
        || Number.class.isAssignableFrom(clazz) || String.class.isAssignableFrom(clazz)
        || Boolean.class.isAssignableFrom(clazz) || Date.class.isAssignableFrom(clazz)
        || Calendar.class.isAssignableFrom(clazz) || UUID.class.isAssignableFrom(clazz);
booleanisSimpleType(Class clazz)
is Simple Type
return clazz.isPrimitive() || clazz.isEnum() || SIMPLE_TYPES.contains(clazz);
booleanisSupportedParameter(Class type)
is Supported Parameter
if (supportedParamTypes.contains(type)) {
    return true;
return false;
booleanisTerminal(Class clazz)
is Terminal
return clazz == Object.class || Iterable.class.isAssignableFrom(clazz) || clazz.isArray()
        || Map.class.isAssignableFrom(clazz);
booleanisTypeConvertible(Class srcType, Class destType)
is Type Convertible
if (srcType == null)
    return (Object.class.isAssignableFrom(destType));
if (destType.isAssignableFrom(srcType))
    return true;
if ((srcType == Boolean.TYPE || srcType == Boolean.class)
        && (destType == Boolean.TYPE || destType == Boolean.class))
    return true;
int i = _numericPrimitiveClasses.indexOf(srcType);
...
booleanisUniformCollection(Collection c, Class e)
Check if the given collection is a uniform collection of the given type.
if (e == null) {
    throw new IllegalArgumentException("Null reference type");
if (c == null) {
    throw new IllegalArgumentException("Null collection");
if (c.isEmpty()) {
    return false;
...
booleanisWrapperOfPrimitiveType(Class primitiveType, Class otherType)
is Wrapper Of Primitive Type
return primitiveType == WRAPPER_TO_PRIMITIVE.get(otherType);