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

Emmanuel Bernard emmanuel at hibernate.org
Wed Jan 16 09:52:48 EST 2013


Yes I meant the former. I did not know the attribute values are also
shown on the JavaDoc of an annotated element.

On Wed 2013-01-16 12:39, Gunnar Morling wrote:
> 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

> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev



More information about the beanvalidation-dev mailing list