code: private static Field findFieldOrThrowException(Class<?> fieldType, Class<?> where) {
          if (fieldType == null || where == null) {
              throw new IllegalArgumentException("fieldType and where cannot be null");
          }
          Field field = null;
          for (Field currentField : where.getDeclaredFields()) {
              currentField.setAccessible(true);
              if (currentField.getType().equals(fieldType)) {
                  field = currentField;
                  break;
              }
          }
          if (field == null) {
              throw new FieldNotFoundException("Cannot find a field of type " + fieldType + "in where.");
          }
          return field;
      }
docs: Find field or throw exception.
  
  @param fieldType the field type
  @param where     the where
  @return the field