A - The annotation typeT - The supported validation types@Immutable @ThreadSafe @Indexed(value=ConstraintValidator.class) @FunctionalInterface public interface ConstraintValidator<A extends java.lang.annotation.Annotation,T> extends javax.validation.ConstraintValidator<A,T>
Constraint instances. Allows defining validators that work with both Hibernate validator and Micronaut's validator.
Unlike the specification's interface this one can uses as a functional interface. Implementor should not implement the ConstraintValidator.initialize(Annotation) method and should instead read the passed AnnotationValue.
| Modifier and Type | Field and Description |
|---|---|
static ConstraintValidator |
VALID
A constraint validator that just returns the object as being valid.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isValid(T value,
AnnotationValue<A> annotationMetadata,
ConstraintValidatorContext context)
Implements the validation logic.
|
default boolean |
isValid(T value,
javax.validation.ConstraintValidatorContext context) |
static final ConstraintValidator VALID
boolean isValid(@Nullable
T value,
@NonNull
AnnotationValue<A> annotationMetadata,
@NonNull
ConstraintValidatorContext context)
Implementations should be thread-safe and immutable.
value - object to validateannotationMetadata - The annotation metadatacontext - The context objectfalse if value does not pass the constraint