Getting All Fields from a Class

The method java.lang.Class.getDeclaredFields() gets all the fields (public, private, and protected) in the current class, and the method java.lang.Class.getFields() returns all the accessible public fields of the class or interface represented by the java.lang.Class object. If you need to obtain all Fields from a class, including the inherited ones you must get holder of the class' superclass(es) and then get the declared fields from them. [java] private static Field[] getAllFields(Class<?> clazz) {  ... Read more