Here you can find the source of getSuperclasses(Class from)
public static Set<Class> getSuperclasses(Class from)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static Set<Class> getSuperclasses(Class from) { Set<Class> superclasses = new HashSet<Class>(); collectInterfaces(from, superclasses); while (!from.equals(Object.class) && !from.isInterface()) { superclasses.add(from.getSuperclass()); from = from.getSuperclass(); collectInterfaces(from, superclasses); }/*from www. ja va 2 s . c om*/ return superclasses; } public static void collectInterfaces(Class from, Set<Class> accumulator) { for (Class intface : from.getInterfaces()) { accumulator.add(intface); collectInterfaces(intface, accumulator); } } }