Annotation Type DateRange


  • @Target({TYPE,ANNOTATION_TYPE})
    @Retention(RUNTIME)
    @Constraint(validatedBy=DateRangeValidator.class)
    @Documented
    public @interface DateRange

    Annotation for JSR-303 validator. It validates the range of dates/date times are coherent:

    • In the case of date: the start date must be either before or equal the end date
    • In the case of datetime: the start datetime must be before the end datetime
    It is expected that the dates/date times are Temporal objects of the same concrete type.
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String end
      The name of the field representing the temporal ending a range.
      String start
      The name of the field representing the temporal starting a range.
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?>[] groups  
      String message  
      Class<? extends javax.validation.Payload>[] payload  
    • Element Detail

      • start

        String start
        The name of the field representing the temporal starting a range.
        Returns:
        the field name of the range start temporal.
      • end

        String end
        The name of the field representing the temporal ending a range.
        Returns:
        the field name of the range end temporal.
      • message

        String message
        Default:
        "Either the end and start date aren\'t of the same type or the end date isn\'t after the start date"
      • groups

        Class<?>[] groups
        Default:
        {}
      • payload

        Class<? extends javax.validation.Payload>[] payload
        Default:
        {}