* @author Erik Brakkee
*/
public class ReflectionUtils {
+
+ public static final List<Class> PRIMITIVE_WRAPPERS =
+ createPrimitiveWrappers();
+
+ private static final List<Class> createPrimitiveWrappers() {
+ Class[] vals = {
+ Boolean.class, Byte.class, Character.class, Short.class, Integer.class, Long.class,
+ Float.class, Double.class };
+ return Arrays.asList(vals);
+ }
+
+
+
+
/**
* Wraps a type by the corresponding wrapper type if it is a primitive type.
*
getAllFields(superClass, aFound, aExcludedClasses);
}
}
+
+ /**
+ * Checks if a class is a primitive type or wrapper type.
+ * @param aClass
+ * @return
+ */
+ public static boolean isPrimitive(Class aClass) {
+ if ( aClass.isPrimitive()) {
+ return true;
+ }
+ return PRIMITIVE_WRAPPERS.contains(aClass);
+ }
}