A
- The constraint annotation type.T
- The TemporalAccessor
type to validate.public abstract class FieldValidator<A extends Annotation,T extends TemporalAccessor> extends BaseValidator<A,T>
TemporalAccessor
validators that validate only a specific field of the value.Modifier and Type | Class and Description |
---|---|
static class |
FieldValidator.ForInstant<A extends Annotation>
The base for all
Instant validators that validate only a specific field of the value. |
static class |
FieldValidator.ForOffsetTime<A extends Annotation>
The base for all
OffsetTime validators that validate only a specific field of the value. |
static class |
FieldValidator.ForZonedDateTime<A extends Annotation>
The base for all
ZonedDateTime validators that validate only a specific field of the value. |
static class |
FieldValidator.WithoutZoneId<A extends Annotation,T extends TemporalAccessor>
The base for all
TemporalAccessor validators that validate only a specific field of the value. |
Modifier | Constructor and Description |
---|---|
protected |
FieldValidator(Function<A,TemporalField> fieldExtractor,
Function<A,String> zoneIdExtractor,
BiFunction<T,ZoneId,TemporalAccessor> zoneIdApplier,
Function<A,BiPredicate<Integer,ClockProvider>> fieldPredicateExtractor)
Creates a new validator.
|
protected |
FieldValidator(TemporalField field,
Function<A,String> zoneIdExtractor,
BiFunction<T,ZoneId,TemporalAccessor> zoneIdApplier,
Function<A,BiPredicate<Integer,ClockProvider>> fieldPredicateExtractor)
Creates a new validator.
|
initialize, isValid, minus, not, plus, useReplacementMessageTemplate
protected FieldValidator(Function<A,TemporalField> fieldExtractor, Function<A,String> zoneIdExtractor, BiFunction<T,ZoneId,TemporalAccessor> zoneIdApplier, Function<A,BiPredicate<Integer,ClockProvider>> fieldPredicateExtractor)
If a ZoneId
is available, the field will be extracted from the result of applying the given zoneIdApplier
function to the value
to validate. Otherwise it will be extracted from the value itself.
fieldExtractor
- A function that extracts the field to validate from a constraint annotation.zoneIdExtractor
- A function that extracts the zone id from a constraint annotation.zoneIdApplier
- A function that applies a zone id to a TemporalAccessor
, resulting in a TemporalAccessor
with the zone id
applied. The result is usually a ZonedDateTime
but doesn't have to be.
The result should represent the same instant.fieldPredicateExtractor
- A function that extracts a field predicate from a constraint annotation.
This predicate will be called in BaseValidator.isValid(Object, ConstraintValidatorContext)
,
with as arguments the field extracted from the value to validate and the ClockProvider
returned by
ConstraintValidatorContext.getClockProvider()
.protected FieldValidator(TemporalField field, Function<A,String> zoneIdExtractor, BiFunction<T,ZoneId,TemporalAccessor> zoneIdApplier, Function<A,BiPredicate<Integer,ClockProvider>> fieldPredicateExtractor)
If a ZoneId
is available, the field will be extracted from the result of applying the given zoneIdApplier
function to the value
to validate. Otherwise it will be extracted from the value itself.
field
- The field to validate.zoneIdExtractor
- A function that extracts the zone id from a constraint annotation.zoneIdApplier
- A function that applies a zone id to a TemporalAccessor
, resulting in a TemporalAccessor
with the zone id
applied. The result is usually a ZonedDateTime
but doesn't have to be.
The result should represent the same instant.fieldPredicateExtractor
- A function that extracts a field predicate from a constraint annotation.
This predicate will be called in BaseValidator.isValid(Object, ConstraintValidatorContext)
,
with as arguments the field extracted from the value to validate and the ClockProvider
returned by
ConstraintValidatorContext.getClockProvider()
.Copyright © 2021–2022. All rights reserved.