/** * @param type any class * @return true if this class is an array (e.g. int[].class, {@link Integer}[] ) */ public static boolean isClassArray(Class<?> type) { checkNull(type); boolean array = false; if (type.isArray()) { array = true; } return array; }
/** * @param type any class * @return true if this class is a list (e.g. {@link List}, {@link ArrayList}) */ public static boolean isClassList(Class<?> type) { checkNull(type); boolean list = false; if (List.class.isAssignableFrom(type)) { list = true; } return list; }
/** * @param type any class * @return true if this class is a map (e.g. {@link Map}, {@link HashMap}) */ public static boolean isClassMap(Class<?> type) { checkNull(type); boolean collection = false; if (Map.class.isAssignableFrom(type)) { collection = true; } return collection; }
/** * @param type any class * @return true if this class is a collection (e.g. {@link Collection}, {@link HashSet}, {@link Vector}) */ public static boolean isClassCollection(Class<?> type) { checkNull(type); boolean collection = false; if (Collection.class.isAssignableFrom(type)) { collection = true; } return collection; }
/** * @param type any class * @return true if this class is a primitive (e.g. int.class, boolean.class) */ public static boolean isClassPrimitive(Class<?> type) { checkNull(type); boolean primitive = false; if (type.isPrimitive()) { primitive = true; } return primitive; }
/** * @param type any class * @return true if this class is a map (e.g. {@link Map}, {@link HashMap}) */ public static boolean isClassMap(Class<?> type) { checkNull(type); boolean collection = false; if (Map.class.isAssignableFrom(type)) { collection = true; } return collection; }
/** * @param type any class * @return true if this class is an array (e.g. int[].class, {@link Integer}[] ) */ public static boolean isClassArray(Class<?> type) { checkNull(type); boolean array = false; if (type.isArray()) { array = true; } return array; }
/** * @param type any class * @return true if this class is a primitive (e.g. int.class, boolean.class) */ public static boolean isClassPrimitive(Class<?> type) { checkNull(type); boolean primitive = false; if (type.isPrimitive()) { primitive = true; } return primitive; }
/** * @param type any class * @return true if this class is a list (e.g. {@link List}, {@link ArrayList}) */ public static boolean isClassList(Class<?> type) { checkNull(type); boolean list = false; if (List.class.isAssignableFrom(type)) { list = true; } return list; }
/** * @param type any class * @return true if this class is a collection (e.g. {@link Collection}, {@link HashSet}, {@link Vector}) */ public static boolean isClassCollection(Class<?> type) { checkNull(type); boolean collection = false; if (Collection.class.isAssignableFrom(type)) { collection = true; } return collection; }
/** * @param type any class * @return true if this class is a primitive or other simple class (like String or immutable) */ public static boolean isClassSimple(Class<?> type) { checkNull(type); boolean simple = false; if ( isClassPrimitive(type) || getImmutableTypes().contains(type)) { simple = true; } return simple; }
/** * @param type any class * @return true if this class is a primitive or other simple class (like String or immutable) */ public static boolean isClassSimple(Class<?> type) { checkNull(type); boolean simple = false; if ( isClassPrimitive(type) || getImmutableTypes().contains(type)) { simple = true; } return simple; }
/** * @param type any class * @return true if this class is a bean of some kind (i.e. not primitive, immutable, or a holder like a map) */ public static boolean isClassBean(Class<?> type) { checkNull(type); boolean bean = true; if ( isClassSimple(type) || isClassObjectHolder(type) ) { bean = false; } return bean; }
/** * @param type any class * @return true if this class is a bean of some kind (i.e. not primitive, immutable, or a holder like a map) */ public static boolean isClassBean(Class<?> type) { checkNull(type); boolean bean = true; if ( isClassSimple(type) || isClassObjectHolder(type) ) { bean = false; } return bean; }
/** * @param type any class * @return true if this is a collection, map, or array, * something that holds a bunch of objects (e.g. {@link Map}, {@link Set}, {@link List}, array) */ public static boolean isClassObjectHolder(Class<?> type) { checkNull(type); boolean holder = false; if ( isClassArray(type) || isClassCollection(type) || isClassMap(type) ) { holder = true; } return holder; }
/** * @param type any class * @return true if this is a collection, map, or array, * something that holds a bunch of objects (e.g. {@link Map}, {@link Set}, {@link List}, array) */ public static boolean isClassObjectHolder(Class<?> type) { checkNull(type); boolean holder = false; if ( isClassArray(type) || isClassCollection(type) || isClassMap(type) ) { holder = true; } return holder; }