ReflectionExt { public static boolean isNumeric(Class<?> type) { if (Number.class.isAssignableFrom(type)) { return true; } if (Integer.TYPE == type || Long.TYPE == type || Float.TYPE == type || Double.TYPE == type) { return true; } return false; } private  ReflectionExt(); static boolean isPrimitiveOrWrapper(Class<?> type); static boolean isStandardDataType(Class<?> type); static boolean isContainerType(Field field); static boolean isNumeric(Class<?> type); static boolean isObjectMethod(Method method); static List<Class<?>> findAllInterfaces(Class<?> type); static List<Method> findAnnotatedMethods(T instance, Class<A> methodAnnotation); static Optional<StackTraceElement> findCallerStackTrace(); static Optional<Method> findInterfaceMethod(Method method); static Field getField(Class<?> type, String name); static T getFieldValue(Field field, Object object); static List<Field> getAllFields(Class<?> type); static Object invokeDefault(Object proxy, Class<?> apiInterface, Method method, Object[] args);  }
@Test public void testIsNumeric() throws Exception { assertThat(isNumeric(Integer.class)).isTrue(); assertThat(isNumeric(Long.class)).isTrue(); assertThat(isNumeric(IntegerHolder.class.getDeclaredField("intValue").getType())).isTrue(); }