Here you can find the source of getSuperClasses(Class> entryClass)
public static List<Class<? extends Object>> getSuperClasses(Class<?> entryClass)
//package com.java2s; /**/*from w w w . j a v a2 s.c o m*/ * Copyright (c) 2012 - Reinaldo de Carvalho <reinaldoc@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ import java.util.ArrayList; import java.util.List; public class Main { /** * Build a super classes List(Class(? extends Object)) * * @return List of Super Classes */ public static List<Class<? extends Object>> getSuperClasses(Class<?> entryClass) { List<Class<? extends Object>> list = new ArrayList<Class<? extends Object>>(); Class<? extends Object> superClazz = entryClass.getSuperclass(); while (superClazz != null) { list.add(superClazz); superClazz = superClazz.getSuperclass(); } return list; } }