Constraint Validation
- by tanuja
I am using javax.validation.Validator and relevant classes for annotation based validation.
Configuration<?> configuration = Validation.byDefaultProvider().configure();
ValidatorFactory factory = configuration.buildValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<ValidatableObject>> constraintViolations = validator.validate(o);
for (ConstraintViolation<ValidatableObject> value : constraintViolations) {
List< Class< ? extends ConstraintValidator< ? extends Annotation,?>>> list =
value.getConstraintDescriptor().getConstraintValidatorClasses();
}
I get a compilation error stating:
Type mismatch: cannot convert from List< Class< ? extends ConstraintValidator< capture#4-of ?,? to List< Class< ? extends ConstraintValidator< ? extends Annotation,?
What am I missing?