Class Field.RangeValidator

    • Constructor Detail

      • RangeValidator

        private RangeValidator​(Number min,
                               Number max)
    • 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 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)