Constraint Validation

Posted by tanuja on Stack Overflow See other posts from Stack Overflow or by tanuja
Published on 2010-04-26T03:54:41Z Indexed on 2010/04/26 4:03 UTC
Read the original article Hit count: 273

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about generics