Java Reflection Super Class getAllSuperClasses(Class clz)

Here you can find the source of getAllSuperClasses(Class clz)

Description

Get all super classes

License

Apache License

Parameter

Parameter Description
clz a parameter

Declaration

public static Class<?>[] getAllSuperClasses(Class<?> clz) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from  w  ww .  j  av a  2 s  . c o  m*/
     * Get all super classes
     *
     * @param clz
     * @return
     */
    public static Class<?>[] getAllSuperClasses(Class<?> clz) {
        List<Class<?>> list = new ArrayList<>();
        while ((clz = clz.getSuperclass()) != null) {
            list.add(clz);
        }
        return list.toArray(new Class<?>[list.size()]);
    }
}

Related

  1. getAllSuperClass(Class clazz, boolean includesObjectClass)
  2. getAllSuperclasses(Class cls)
  3. getAllSuperclasses(Class cls)
  4. getAllSuperclasses(Class clazz)
  5. getAllSuperClasses(Class clazz)
  6. getAllSuperTypeNames(Class aClass)
  7. getParents(final Class Class)
  8. getSuper(Class clazz, Set result)
  9. getSuperClasses(Class clazz, Set result)