code: private Field getFieldRecursive(Class c, String name) throws NoSuchFieldException
      {
          try
          {
              return c.getDeclaredField(name);
          }
          catch (NoSuchFieldException e)
          {
              // if field  could not be found in the inheritance hierarchy, signal error
              if ((c == Object.class) || (c.getSuperclass() == null) || c.isInterface())
              {
                  throw e;
              }
              // if field could not be found in class c try in superclass
              else
              {
                  return getFieldRecursive(c.getSuperclass(), name);
              }
          }
      }
docs: try to find a field in class c, recurse through class hierarchy if necessary
  
  @throws NoSuchFieldException if no Field was found into the class hierarchy