Annotation Type PastOrPresent


  • @Target({METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE})
    @Retention(RUNTIME)
    @Repeatable(List.class)
    @Documented
    @Constraint(validatedBy={})
    public @interface PastOrPresent
    The annotated element must be an instant, date or time in the past or in the present.

    Now is defined by the ClockProvider attached to the Validator or ValidatorFactory. The default clockProvider defines the current time according to the virtual machine, applying the current default time zone if needed.

    The notion of present is defined relatively to the type on which the constraint is used. For instance, if the constraint is on a Year, present would mean the whole current year.

    Supported types are:

    • java.util.Date
    • java.util.Calendar
    • java.time.Instant
    • java.time.LocalDate
    • java.time.LocalDateTime
    • java.time.LocalTime
    • java.time.MonthDay
    • java.time.OffsetDateTime
    • java.time.OffsetTime
    • java.time.Year
    • java.time.YearMonth
    • java.time.ZonedDateTime
    • java.time.chrono.HijrahDate
    • java.time.chrono.JapaneseDate
    • java.time.chrono.MinguoDate
    • java.time.chrono.ThaiBuddhistDate

    null elements are considered valid.

    Since:
    2.0
    Author:
    Guillaume Smet
    • Element Detail

      • message

        String message
        Default:
        "{jakarta.validation.constraints.PastOrPresent.message}"
      • groups

        Class<?>[] groups
        Default:
        {}