ClassUtil { public static Class<?>[] getClassHierarchy(Class<?> type) { ArrayDeque<Class<?>> classes = new ArrayDeque<Class<?>>(); Class<?> classType = type; while (classType != null && !classType.equals(Object.class)) { classes.addFirst(classType); classType = classType.getSuperclass(); } return classes.toArray(new Class[0]); }  static Object findEnumConstant(Class<?> type, String constantName); static Object findEnumConstant(Class<?> type, String constantName, boolean caseSensitive); static Class<?>[] getClassHierarchy(Class<?> type); static boolean hasBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method[] getBeanMethods(Class<?> type, String propertyName, Class<?> propertyType, boolean caseSensitive); static Method getMethod(Class<?> type, String name, Class<?> returnType, Class<?> paramType, boolean caseSensitive);  }
@Test public void getClassHierarchy() throws Exception { Class[] hierarchy = ClassUtil.getClassHierarchy(InternetPerson.class); Assert.assertEquals(2, hierarchy.length); Assert.assertEquals(Person.class, hierarchy[0]); Assert.assertEquals(InternetPerson.class, hierarchy[1]); }