Java Reflection Super Class getSuperClasses(Class entryClass)

Here you can find the source of getSuperClasses(Class entryClass)

Description

Build a super classes List(Class(?

License

Open Source License

Return

List of Super Classes

Declaration

public static List<Class<? extends Object>> getSuperClasses(Class<?> entryClass) 

Method Source Code

//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;
    }
}

Related

  1. getSuperClasses(Class c)
  2. getSuperclasses(Class clazz)
  3. getSuperClasses(Class clazz)
  4. getSuperclasses(Class clazz)
  5. getSuperClasses(Class cls)
  6. getSuperclasses(Class the_class)
  7. getSuperClasses(final Class clazz)
  8. getSuperclassesForHeight(Collection> classes, int height)
  9. getSuperClasss(Class sourceClass, boolean isAddCurrentClass)