2013/1/16 Emmanuel Bernard <emmanuel(a)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