Class DateTimeRangeValidator

  • All Implemented Interfaces:
    Validator<java.time.LocalDateTime>, java.io.Serializable, java.util.function.BiFunction<java.time.LocalDateTime,​ValueContext,​ValidationResult>

    public class DateTimeRangeValidator
    extends RangeValidator<java.time.LocalDateTime>
    Validator for validating that a LocalDateTime is inside a given range.
    Since:
    8.0
    Author:
    Vaadin Ltd.
    See Also:
    Serialized Form
    • Constructor Detail

      • DateTimeRangeValidator

        public DateTimeRangeValidator​(java.lang.String errorMessage,
                                      java.time.LocalDateTime minValue,
                                      java.time.LocalDateTime maxValue)
        Creates a validator for checking that a LocalDateTime is within a given range.

        By default the range is inclusive i.e. both minValue and maxValue are valid values. Use RangeValidator.setMinValueIncluded(boolean) or RangeValidator.setMaxValueIncluded(boolean) to change it.

        Parameters:
        errorMessage - the message to display in case the value does not validate.
        minValue - The minimum value to accept or null for no limit
        maxValue - The maximum value to accept or null for no limit