ClassUtil { public static <T> Class<T> getClassGenericType(final Class clazz) { return getClassGenericType(clazz, 0); }  static String getShortClassName(final Class<?> cls); static String getShortClassName(final String className); static String getPackageName(final Class<?> cls); static String getPackageName(final String className); static List<Class<?>> getAllSuperclasses(final Class<?> cls); static List<Class<?>> getAllInterfaces(final Class<?> cls); static boolean isSubClassOrInterfaceOf(Class subclass, Class superclass); static Class<?> unwrapCglib(Object instance); static Class<T> getClassGenericType(final Class clazz); static Class getClassGenericType(final Class clazz, final int index);  }
@Test public void getSuperClassGenericType() { assertThat(ClassUtil.getClassGenericType(TestBean.class)).isEqualTo(String.class); assertThat(ClassUtil.getClassGenericType(TestBean.class, 1)).isEqualTo(Long.class); assertThat(ClassUtil.getClassGenericType(TestBean2.class)).isEqualTo(Object.class); assertThat(ClassUtil.getClassGenericType(TestBean3.class)).isEqualTo(Object.class); }