Here you can find the source of getClasses(Class t)
public static List<Class> getClasses(Class t)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { public static List<Class> getClasses(Class t) { List<Class> list = new ArrayList<Class>(); list.add(t);//from ww w . j a v a 2s . c o m Class clazz = t.getSuperclass(); while (!clazz.equals(Object.class)) { list.add(clazz); clazz = clazz.getSuperclass(); } return list; } }