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

Gunnar Morling gunnar at hibernate.org
Wed Jan 16 06:39:17 EST 2013


2013/1/16 Emmanuel Bernard <emmanuel at hibernate.org>

> The small advantage I find in having two annotations is that it is
> readable at a glance what the constraint is even just by reading its
> javadoc (assuming @Documented). In the second approach, you need to
> explicitly put it in the javadoc or have your users access to the source
> code and parse the @Constraint


Which JavaDoc do you mean, the JavaDoc for the definition a constraint
annotation type or the JavaDoc for an element annotated with a constraint
annotation?

The former contains all meta annotations, including their members, so the
type would be recognizable either way. The latter only contains the actual
constraint annotation itself (i.e. no meta-annotations) if the constraint
is annotated with @Documented. So afaics, from the JavaDoc of a constraint
usage site it's not recognizable whether the constraint is generic or
cross-parameter (if it's not encoded into the name).

Or did you mean something else?

--Gunnar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20130116/3a264ba0/attachment.html 


More information about the beanvalidation-dev mailing list