Interface ConstraintDefinitionContext<A extends Annotation>

Type Parameters:
A - The annotation type represented by this context.
All Superinterfaces:
ConstraintDefinitionTarget, ConstraintMappingTarget, TypeTarget

public interface ConstraintDefinitionContext<A extends Annotation> extends ConstraintMappingTarget
Constraint mapping creational context representing a constraint (i.e. annotation type). Allows to define which validators should validate this constraint.
Author:
Yoann Rodiere
  • Method Details

    • includeExistingValidators

      ConstraintDefinitionContext<A> includeExistingValidators(boolean includeExistingValidators)
      Specifies whether validators already mapped to this constraint (i.e. defined in the annotation declaration through Constraint.validatedBy() or the validation engine defaults) should be included or not.
      Parameters:
      includeExistingValidators - Whether or not to use already-mapped validators when validating this constraint.
      Returns:
      This context for method chaining.
    • validatedBy

      ConstraintDefinitionContext<A> validatedBy(Class<? extends ConstraintValidator<A,?>> validator)
      Adds a new validator to validate this constraint.
      Parameters:
      validator - The validator to add.
      Returns:
      This context for method chaining.
    • validateType

      Allows to configure a validation implementation using a Lambda expression or method reference. Useful for simple validations without the need for accessing constraint properties or customization of error messages etc.
      Parameters:
      type - The type of the value to validate
      Returns:
      This context for method chaining