Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /** * Returns a list of classes containing the class of the object and all its super classes * * @author Tristan Bepler */ private static List<Class<?>> getSupers(Object o) { List<Class<?>> classes = new ArrayList<Class<?>>(); Class<?> curClass = o.getClass(); while (curClass != null) { classes.add(curClass); curClass = curClass.getSuperclass(); } return classes; } }