public static Set<Class<?>> getSuperClasses(Class<?> cl) {
        Set<Class<?>> classes = new HashSet<Class<?>>();
        Class<?> c = cl;
        while (c != null) {
            classes.add(c);
            c = c.getSuperclass();
        }
        return classes;
    }
ReflectionUtils provides Reflection related functionality

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/util/ReflectionUtils.java