public static Set<Field> getFields(Class<?> cl) {
        Set<Field> fields = new HashSet<Field>();
        Class<?> c = cl;
        while (c != null) {
            fields.addAll(Arrays.asList(c.getDeclaredFields()));
            c = c.getSuperclass();
        }
        return fields;
    }
ReflectionUtils provides Reflection related functionality

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