Package io.debezium.config
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
-
-
Constructor Summary
Constructors Modifier Constructor Description private
RangeValidator(Number min, Number max)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Field.RangeValidator
atLeast(Number min)
A validator that checks only the lower numerical bound.static Field.RangeValidator
between(Number min, Number max)
A validator that checks both the upper and lower bound.void
ensureValid(String name, Object o)
String
toString()
int
validate(Configuration config, Field field, Field.ValidationOutput problems)
Validate the supplied value for the field, and report any problems to the designated consumer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.debezium.config.Field.Validator
and
-
-
-
-
Method Detail
-
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 nullmax
- 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 interfaceField.Validator
- Parameters:
config
- the configuration containing the field to be validated; may not be nullfield
- theField
being validated; never nullproblems
- 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
-
-