Interface ConstraintValidatorRegistry
-
- All Known Implementing Classes:
DefaultConstraintValidators
public interface ConstraintValidatorRegistry
Interface for a class that is a registry of contraint validator.- Since:
- 1.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <A extends java.lang.annotation.Annotation,T>
java.util.Optional<ConstraintValidator<A,T>>findConstraintValidator(java.lang.Class<A> constraintType, java.lang.Class<T> targetType)
Finds a constraint validator for the given type and target type.default <A extends java.lang.annotation.Annotation,T>
ConstraintValidator<A,T>getConstraintValidator(java.lang.Class<A> constraintType, java.lang.Class<T> targetType)
Finds a constraint validator for the given type and target type.
-
-
-
Method Detail
-
findConstraintValidator
@NonNull <A extends java.lang.annotation.Annotation,T> java.util.Optional<ConstraintValidator<A,T>> findConstraintValidator(@NonNull java.lang.Class<A> constraintType, @NonNull java.lang.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 java.lang.annotation.Annotation,T> ConstraintValidator<A,T> getConstraintValidator(@NonNull java.lang.Class<A> constraintType, @NonNull java.lang.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:
javax.validation.ValidationException
- if no validator is present
-
-