Here you can find the source of getAllSuperclasses(Class> clazz)
Parameter | Description |
---|---|
clazz | - the class to look up |
public static List<Class<?>> getAllSuperclasses(Class<?> clazz)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { /**//from ww w . j ava 2s. com * Returns a List of superclasses for the given class. * * @param clazz - the class to look up * @return the List of super-classes in order going up from this one */ public static List<Class<?>> getAllSuperclasses(Class<?> clazz) { List<Class<?>> classes = new ArrayList<Class<?>>(); Class<?> superclass = clazz.getSuperclass(); while (superclass != null) { classes.add(superclass); superclass = superclass.getSuperclass(); } return classes; } }