code: public static NestableFieldValidator fv(final Class cls, final boolean nullAllowed) {
          return new NestableFieldValidator() {
              @Override
              public void validateField(String pd, String name, Object field) throws IllegalArgumentException {
                  if (nullAllowed && field == null) {
                      return;
                  }
                  if (!cls.isInstance(field)) {
                      throw new IllegalArgumentException(pd + name + " must be a " + cls.getName() + ". (" + field + ")");
                  }
              }
          };
      }
docs: Returns a new NestableFieldValidator for a given class.
  
  @param cls         the Class the field should be a type of
  @param nullAllowed whether or not a value of null is valid
  @return a NestableFieldValidator for that class