Java Utililty Methods Reflection Super Class

List of utility methods to do Reflection Super Class

Description

The list of methods to do Reflection Super Class are organized into topic(s).

Method

List>findSuperTypes(Class cls, Class endBefore)
Method that will find all sub-classes and implemented interfaces of a given class or interface.
return findSuperTypes(cls, endBefore, new ArrayList<Class<?>>());
List>getAllSuperClass(Class clazz, boolean includesObjectClass)
Returns all super class of the given class.
List<Class<?>> result = new ArrayList<Class<?>>();
Class<?> temp = clazz.getSuperclass();
while (temp != null) {
    if (includesObjectClass == false) {
        if (temp == Object.class) {
            break;
    result.add(temp);
    temp = temp.getSuperclass();
return result;
ListgetAllSuperclasses(Class cls)

Gets a List of superclasses for the given class.

if (cls == null)
    return null;
List classes = new ArrayList();
Class superclass = cls.getSuperclass();
while (superclass != null) {
    classes.add(superclass);
    superclass = superclass.getSuperclass();
return classes;
Class[]getAllSuperclasses(Class cls)
get All Superclasses
if (cls == null) {
    return new Class[0];
List<Class> classList = new ArrayList<Class>();
Class superClass = cls;
while (superClass != null && !Object.class.equals(superClass) && !Class.class.equals(superClass)) {
    classList.add(superClass);
    superClass = superClass.getSuperclass();
...
List>getAllSuperclasses(Class clazz)
Returns a List of superclasses for the given class.
List<Class<?>> classes = new ArrayList<Class<?>>();
Class<?> superclass = clazz.getSuperclass();
while (superclass != null) {
    classes.add(superclass);
    superclass = superclass.getSuperclass();
return classes;
ArrayList>getAllSuperClasses(Class clazz)
get All Super Classes
ArrayList<Class<?>> ret = new ArrayList<>();
_getAllSuperClasses(clazz, ret);
return ret;
Class[]getAllSuperClasses(Class clz)
Get all super classes
List<Class<?>> list = new ArrayList<>();
while ((clz = clz.getSuperclass()) != null) {
    list.add(clz);
return list.toArray(new Class<?>[list.size()]);
String[]getAllSuperTypeNames(Class aClass)
Gets all super-type names (super classes and super interfaces) of aClass and return them in an array.
Set<Class> types = new HashSet<Class>();
getAllSuperTypes(aClass, types);
String[] typeNames = new String[types.size()];
Iterator<Class> iter = types.iterator();
for (int i = 0; i < typeNames.length; i++) {
    typeNames[i] = iter.next().getName();
return typeNames;
...
Class[]getParents(final Class Class)
get Parents
return getParents(Class, null);
voidgetSuper(Class clazz, Set result)
Populates all interface and superclasses for the given class, recursivly.
getSuperInterfaces(clazz, result);
getSuperClasses(clazz, result);