Interface Field.Validator

All Known Implementing Classes:
Field.EnumRecommender, Field.RangeValidator
Enclosing class:
Field
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface Field.Validator
A functional interface that can be used to validate field values.
  • Method Details

    • validate

      int validate(Configuration config, Field field, Field.ValidationOutput problems)
      Validate the supplied value for the field, and report any problems to the designated consumer.
      Parameters:
      config - the configuration containing the field to be validated; may not be null
      field - the Field being validated; never null
      problems - the consumer to be called with each problem; never null
      Returns:
      the number of problems that were found, or 0 if the value is valid
    • and

      default Field.Validator and(Field.Validator other)
      Obtain a new Field.Validator object that validates using this validator and the supplied validator.
      Parameters:
      other - the validation function to call after this
      Returns:
      the new validator, or this validator if other is null or equal to this