How can I get all constraints for a class. For instance I have
class A {
@NotNull
private SomeBean field;
}
When I call:
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintDescriptor<?>> descriptor = validator.getConstraintsForClass(formClass).getConstraintDescriptors();
The set is empty. I would assume there is already some functionality in Hibernate Validator that would give me all the information about constraints in a neat way , without me having to resort to the reflection api.