@Test void forObject() { Class<Number> numberClass = ClassUtil.forObject(BigDecimal.ONE); assertThat(numberClass, equalTo(BigDecimal.class)); }
@SuppressWarnings("unchecked") public static <T> Class<T> forObject(T value) { Objects.requireNonNull(value); return (Class<T>) value.getClass(); }
ClassUtil extends UtilityClass { @SuppressWarnings("unchecked") public static <T> Class<T> forObject(T value) { Objects.requireNonNull(value); return (Class<T>) value.getClass(); } }
ClassUtil extends UtilityClass { @SuppressWarnings("unchecked") public static <T> Class<T> forObject(T value) { Objects.requireNonNull(value); return (Class<T>) value.getClass(); }  }
ClassUtil extends UtilityClass { @SuppressWarnings("unchecked") public static <T> Class<T> forObject(T value) { Objects.requireNonNull(value); return (Class<T>) value.getClass(); }  @SuppressWarnings("unchecked") static Class<T> forObject(T value); static Optional<Class<?>> forName(String className); static Optional<Class<?>> forArrayOf(Class<?> componentClass); static Method getDeclaredMethod(Class<?> aClass, String name, Class<?>... parameterTypes); static Optional<Method> declaredMethod(Class<?> aClass, String name, Class<?>... parameterTypes); static Stream<Method> declaredMethods(Class<?> aClass); static Field getDeclaredField(Class<?> aClass, String fieldName); static Optional<Field> declaredField(Class<?> aClass, String fieldName); static Optional<Field> findField(Class<?> aClass, String fieldName); static Optional<Class<?>> superclass(Class<?> aClass); static Stream<Class<?>> superclasses(Class<?> aClass); static boolean hasAnnotation(Class<?> aClass, Class<A> annotationClass); static Optional<A> annotation(Class<T> aClass, Class<A> annotationClass); static Stream<A> annotations(Class<T> aClass, Class<A> annotationClass); static Optional<Constructor<T>> constructor(Class<T> aClass, Class<?>... parameterTypes); }
ClassUtil extends UtilityClass { @SuppressWarnings("unchecked") public static <T> Class<T> forObject(T value) { Objects.requireNonNull(value); return (Class<T>) value.getClass(); }  @SuppressWarnings("unchecked") static Class<T> forObject(T value); static Optional<Class<?>> forName(String className); static Optional<Class<?>> forArrayOf(Class<?> componentClass); static Method getDeclaredMethod(Class<?> aClass, String name, Class<?>... parameterTypes); static Optional<Method> declaredMethod(Class<?> aClass, String name, Class<?>... parameterTypes); static Stream<Method> declaredMethods(Class<?> aClass); static Field getDeclaredField(Class<?> aClass, String fieldName); static Optional<Field> declaredField(Class<?> aClass, String fieldName); static Optional<Field> findField(Class<?> aClass, String fieldName); static Optional<Class<?>> superclass(Class<?> aClass); static Stream<Class<?>> superclasses(Class<?> aClass); static boolean hasAnnotation(Class<?> aClass, Class<A> annotationClass); static Optional<A> annotation(Class<T> aClass, Class<A> annotationClass); static Stream<A> annotations(Class<T> aClass, Class<A> annotationClass); static Optional<Constructor<T>> constructor(Class<T> aClass, Class<?>... parameterTypes);  }