code: public static Field getDeclaredFieldWithPath(Class<?> clazz, String path) {
  
          int lastDot = path.lastIndexOf('.');
  
          if (lastDot > -1) {
              String parentPath = path.substring(0, lastDot);
              String fieldName = path.substring(lastDot + 1);
              Field parentField = getDeclaredFieldWithPath(clazz, parentPath);
              return getDeclaredFieldInHierarchy(parentField.getType(), fieldName);
          } else {
              return getDeclaredFieldInHierarchy(clazz, path);
          }
      }
docs: Returns the Field for a given parent class and a dot-separated path of
  field names.
  
  @param clazz
  Parent class.
  @param path
  Path to the desired field.