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 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 type
        T - 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 type
        T - 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