private Collection<Field> getAllFields(final Object object) {
    final Collection<Field> fields = new ArrayList<Field>();
    fields.addAll(Arrays.asList(object.getClass().getDeclaredFields()));
    // inspect super classes
    Class<?> superClass = object.getClass().getSuperclass();
    while (superClass != null) {
      fields.addAll(Arrays.asList(superClass.getDeclaredFields()));
      superClass = superClass.getSuperclass();
    }
    return fields;
  }
private Collection<Field> getAllFields(final Object object) {
    final Collection<Field> fields = new ArrayList<Field>();
    fields.addAll(Arrays.asList(object.getClass().getDeclaredFields()));
    
    Class<?> superClass = object.getClass().getSuperclass();
    while (superClass != null) {
      fields.addAll(Arrays.asList(superClass.getDeclaredFields()));
      superClass = superClass.getSuperclass();
    }
    return fields;
  }
private Collection < Field > getAllFields ( final Object object ) { final Collection < Field > fields = new ArrayList < Field > ( ) ; fields . addAll ( Arrays . asList ( object . getClass ( ) . getDeclaredFields ( ) ) ) ; // inspect super classes
 Class < ? > superClass = object . getClass ( ) . getSuperclass ( ) ; while ( superClass != null ) { fields . addAll ( Arrays . asList ( superClass . getDeclaredFields ( ) ) ) ; superClass = superClass . getSuperclass ( ) ; } return fields ; }
Return all fields for given object, also those from the super classes.
Return all fields for given object also those from the super classes .