@Documented @Constraint(validatedBy={YearMonthMaxBeforeValidator.ForDate.class,YearMonthMaxBeforeValidator.ForCalendar.class,YearMonthMaxBeforeValidator.ForInstant.class,YearMonthMaxBeforeValidator.ForLocalDate.class,YearMonthMaxBeforeValidator.ForLocalDateTime.class,YearMonthMaxBeforeValidator.ForOffsetDateTime.class,YearMonthMaxBeforeValidator.ForZonedDateTime.class}) @Target(value={METHOD,FIELD,ANNOTATION_TYPE,CONSTRUCTOR,PARAMETER,TYPE_USE}) @Retention(value=RUNTIME) @Repeatable(value=YearMonthMaxBefore.List.class) public @interface YearMonthMaxBefore
object
, validates that object.yearMonth >= moment - duration
.
Supported types are:
null
elements are considered valid.
Modifier and Type | Required Element and Description |
---|---|
String |
duration
The maximum amount of time, as an ISO 8601 duration, that the year-month
part of a date/time object can be before the value specified in
moment() . |
String |
moment
The moment against which to validate.
|
public abstract String duration
moment()
.
This duration may only have a year and/or month part.
public abstract String moment
YearMonth
, or now
to use the current moment in time as 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.public abstract String message
public abstract Class<?>[] groups
public abstract String zoneId
system
for the value returned by ZoneId.systemDefault()
, provided
for the zone id
from the actual value, or otherwise a value that is accepted by ZoneId.of(String)
for a specific zone id.
Calendar
, OffsetDateTime
and ZonedDateTime
, if the zone id is not
provided
, the value is converted to the given zone id before extracting the year-month.Date
and Instant
, no zone id is available, so provided
is not allowed.LocalDate
and LocalDateTime
, no zone id is applicable, so only the default value (system
)
is allowed.Copyright © 2021–2022. All rights reserved.