Interface ConstraintValidatorRegistry
- All Known Implementing Classes:
DefaultConstraintValidators
public interface ConstraintValidatorRegistry
Interface for a class that is a registry of contraint validator.
- Since:
- 1.2
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation,
T>
Optional<ConstraintValidator<A,T>> findConstraintValidator
(Class<A> constraintType, Class<T> targetType) Finds a constraint validator for the given type and target type.default <A extends Annotation,
T>
ConstraintValidator<A,T> getConstraintValidator
(Class<A> constraintType, Class<T> targetType) Finds a constraint validator for the given type and target type.
-
Method Details
-
findConstraintValidator
@NonNull <A extends Annotation,T> Optional<ConstraintValidator<A,T>> findConstraintValidator(@NonNull Class<A> constraintType, @NonNull Class<T> targetType) Finds a constraint validator for the given type and target type.- Type Parameters:
A
- The annotation typeT
- The target type- Parameters:
constraintType
- The annotation type of the constraint.targetType
- The type being validated.- Returns:
- The validator
-
getConstraintValidator
@NonNull default <A extends Annotation,T> ConstraintValidator<A,T> getConstraintValidator(@NonNull Class<A> constraintType, @NonNull Class<T> targetType) Finds a constraint validator for the given type and target type.- Type Parameters:
A
- The annotation typeT
- The target type- Parameters:
constraintType
- The annotation type of the constraint.targetType
- The type being validated.- Returns:
- The validator
- Throws:
jakarta.validation.ValidationException
- if no validator is present
-