hi gunnar,

we had a similar discussion for bv v1.
i suggested to allow e.g. a convention and/or to provide an api to map the constraint validators to a constraint (such features are available e.g. in myfaces extval).

+1 for re-visiting this topic.

regards,
gerhard



2011/10/23 Gunnar Morling <gunnar.morling@googlemail.com>
Hello experts,

one thing about BV I'm somewhat uncomfortable with is the (cyclic)
dependency between constraint annotation types and their validators.
This is, validators are referenced from constraints within the
@Constraint meta-annotation, while constraint types are referenced by
the type parameter in validator impl's.

In particular this makes it impossible to clearly distinguish between
the public API of a constraint library (the annotation types) and its
implementation (the validators), e.g. by creating two distinct JARs.

Therefore I'd personally prefer if there was only a reference from the
validators to the constraints, but not the other way around. This of
course raises the question how it would be determined which validators
exist for a given constraint. One could think of using XML descriptors
or some scanning-based approach. I guess from a technical POV this
problem is somewhat related to what's to be done in CDI (finding bean
implementations, processing qualifier annotations etc.).

That said, I'd be very interested in your opinion on this topic. Do
you think this is something we should address or do you think this
sort of cycle is acceptable?

Thanks,

--Gunnar
_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev