Hi,
I propose two enhancement for BV 1.1:
[*] what is described in issue BVAL-225
http://opensource.atlassian.com/projects/hibernate/browse/BVAL-225.
[*] ability to invoke the Validator for a single or multiple constraint annotations from within a constraint implementation.
I explain the latter better: I'd like to implement "generic" constraints such as @AtMostOne, @AtLeastOne, @AtMostOneNot, @AtLeastOneNot to be used like this:
@AtMostOne(properties={"foo", "bar", "baz"}, constraints=@Size(max=10))
This would mean "apply the @Size(max=10) constraint to all the properties foo, bar, baz, and succeed in case at most one of the properties satisfy the condition, fail otherwise.
I believe this can be already done, but it's not as straightforward as it could be.
I propose passing the instance of the current validator to constraint implementation, and adding convinient method to the Validator interface, such as:
Validator.validate (String propertyName, Annotation... annotations).
(this can be probably emulated with Validator.validateValue, but you cannot specify a new non-existant constraint, only select and existing one using groups.
Regards,
Gabriele