[bv-dev] Distinguishing cross-parameter and generic constraints

Emmanuel Bernard emmanuel at hibernate.org
Mon Jan 21 13:06:00 EST 2013


On Mon 2013-01-21 11:52, Matt Benson wrote:
> > ## Thoughts
> >
> > I think I like @CrossParametersConstraints more than @Constraint for
> > both as it makes things explicit and keep the simple use case as is.
> >
> > But I am intrigued by the @Validates option. In many ways, it's similar
> > to how we resolve the right constraint validator based on the type. The
> > only difference is that the @Validates annotation refines how Object[]
> > should be interpreted. It "fits better" in my opinion.
> >
> > My concern around the latest option is that it forces us to be a
> > subclass of ConstraintViolation for the foreseeable future including
> > when we reopen the type-safe options we explored in
> > http://beanvalidation.org/proposals/BVAL-232/
> >
> > Thoughts and comments?
> >
> >
> So you're saying @Validates would eliminate the need for a separate
> CrossParameterConstraintValidator interface?  FWIW, it seems to me that the
> separate interface just feels more straightforward.
> 

It would eliminate the need for a separate @CrossParametersConstraint
annotation. There is no CrossParameterConstraintValidator interface
in the current proposals. We explored that briefly with Gunnar today too
but this approach cannot cover all cases.

Emmanuel


More information about the beanvalidation-dev mailing list