Class Field.RangeValidator

java.lang.Object
io.debezium.config.Field.RangeValidator
All Implemented Interfaces:
Field.Validator
Enclosing class:
Field

public static class Field.RangeValidator extends Object implements Field.Validator
Validation logic for numeric ranges
  • Field Details

    • min

      private final Number min
    • max

      private final Number max
  • Constructor Details

    • RangeValidator

      private RangeValidator(Number min, Number max)
  • Method Details

    • atLeast

      public static Field.RangeValidator atLeast(Number min)
      A validator that checks only the lower numerical bound.
      Parameters:
      min - the minimum acceptable value; may not be null
      Returns:
      the validator; never null
    • between

      public static Field.RangeValidator between(Number min, Number max)
      A validator that checks both the upper and lower bound.
      Parameters:
      min - the minimum acceptable value; may not be null
      max - the maximum acceptable value; may not be null
      Returns:
      the validator; never null
    • validate

      public int validate(Configuration config, Field field, Field.ValidationOutput problems)
      Description copied from interface: Field.Validator
      Validate the supplied value for the field, and report any problems to the designated consumer.
      Specified by:
      validate in interface Field.Validator
      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
    • ensureValid

      public void ensureValid(String name, Object o)
    • toString

      public String toString()
      Overrides:
      toString in class Object