Java Reflection Super Class getSuperclasses(Class from)

Here you can find the source of getSuperclasses(Class from)

Description

get Superclasses

License

Open Source License

Declaration

public static Set<Class> getSuperclasses(Class from) 

Method Source Code

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

Related

  1. getAllSuperTypeNames(Class aClass)
  2. getParents(final Class Class)
  3. getSuper(Class clazz, Set result)
  4. getSuperClasses(Class clazz, Set result)
  5. getSuperClasses(Class clz, boolean reverseOrder)
  6. getSuperClasses(Class c)
  7. getSuperclasses(Class clazz)
  8. getSuperClasses(Class clazz)
  9. getSuperclasses(Class clazz)