code: protected static void dumpInstance (
          PrintStream out, Object object, boolean includeToString, String indent)
      {
          // summarize the current object
          summarizeObject(out, object, includeToString, indent);
          // increment the indentation level
          indent += " ";
          // summarize the object's fields
          Field[] fields = object.getClass().getDeclaredFields();
          for (int i = 0; i < fields.length; i++) {
              try {
                  Object field = fields[i].get(object);
                  dumpInstance(out, field, includeToString, indent);
              } catch (Exception e) {
                  out.println(indent + "*** unable to fetch field " +
                              "[field=" + fields[i] + ", error=" + e + "]");
              }
          }
      }
docs: Helper function.