Java Reflection Super Class getSuperClasses(Class cls)

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

Description

get Super Classes

License

GNU General Public License

Parameter

Parameter Description
cls Class to get super classes.

Return

Super classes for given class.

Declaration

static List<Class<?>> getSuperClasses(Class<?> cls) 

Method Source Code

//package com.java2s;
// Copyright (C) GridGain Systems Licensed under GPLv3, http://www.gnu.org/licenses/gpl.html

import java.util.*;

public class Main {
    /**/*from   w w  w. j  a  v a  2  s  . co  m*/
     * @param cls Class to get super classes.
     * @return Super classes for given class.
     */
    static List<Class<?>> getSuperClasses(Class<?> cls) {
        List<Class<?>> results = new ArrayList<Class<?>>();

        Class<?> cur = cls;

        while (cur != null) {
            results.add(cur);

            cur = cur.getSuperclass();
        }

        return results;
    }
}

Related

  1. getSuperclasses(Class from)
  2. getSuperClasses(Class c)
  3. getSuperclasses(Class clazz)
  4. getSuperClasses(Class clazz)
  5. getSuperclasses(Class clazz)
  6. getSuperClasses(Class entryClass)
  7. getSuperclasses(Class the_class)
  8. getSuperClasses(final Class clazz)
  9. getSuperclassesForHeight(Collection> classes, int height)