Class LocalDateRangeFieldValidator

All Implemented Interfaces:
FieldValidator, ShortCircuitableValidator, Validator

public final class LocalDateRangeFieldValidator extends RangeValidatorSupport<LocalDate>
Field Validator that checks if a LocalDate is within a specific range, both bounds inclusive. Use DateRangeFieldValidator for a Date property.
  • fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required
  • min - the min date as an ISO date (yyyy-MM-dd). If not specified will not be checked.
  • max - the max date as an ISO date (yyyy-MM-dd). If not specified will not be checked.
  • minExpression - expression to calculate the minimum value (if none is specified, it will not be checked)
  • maxExpression - expression to calculate the maximum value (if none is specified, it will not be checked)
Do not use ${minExpression} and ${maxExpression} as an expression as this will turn into infinitive loop!
 
 <validators>
     <field name="birthday">
         <field-validator type="localdate">
             <param name="min">1990-01-01</param>
             <param name="max">2000-01-01</param>
             <message>Birthday must be within ${min} and ${max}</message>
         </field-validator>
     </field>

     <field name="birthday">
         <field-validator type="localdate">
             <param name="minExpression">${minValue}</param> <!-- will be evaluated as: LocalDate getMinValue() -->
             <param name="maxExpression">${maxValue}</param> <!-- will be evaluated as: LocalDate getMaxValue() -->
             <message>Birthday must be within ${min} and ${max}</message>
         </field-validator>
     </field>
 </validators>
 
 
Since:
7.5.0
  • Constructor Details

    • LocalDateRangeFieldValidator

      public LocalDateRangeFieldValidator()