<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>I must admit I have not made my mind. 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</div><div><br></div><div>What do others think?<br><br>On 15 janv. 2013, at 15:14, Gunnar Morling <<a href="mailto:gunnar@hibernate.org">gunnar@hibernate.org</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div class="gmail_extra">2013/1/15 Emmanuel Bernard <span dir="ltr"><<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>I can live with that but we must make it crystal clear that in case of<br>
ambiguity, we raise an exception. Otherwise, someone changing the method<br>
sig might have some nasty surprises.</div></blockquote><div><br></div><div>And which of the options</div><div><br></div><div> @CrossParameterConstraint(validatedBy=MyCrossParameterValidator.class)</div>
<div> @Constraint(validatedBy=MyGenericValidator.class)</div><div> public @interface MyConstraint { ... }</div><div><br></div><div>vs.</div><div><br></div><div><div> @Constraint(</div>
<div> validatedBy=MyGenericValidator.class,</div><div> crossParameterValidatorType=MyCrossParameterValidator.class</div><div> )</div><div> public @interface MyConstraint { ... }</div><div><br></div>
<div>would you prefer?</div><div><br></div><div>Personally I'd lean towards the latter, since there would be exactly one meta-annotation denoting an annotation as constraint annotation type, with all attributes for the required configuration.</div>
<div><br></div><div>If following the 2nd approach, we should IMO add a default clause to validatedBy() (set to the empty array), allowing for the convenient definition of cross-parameter only constraints. According to [1] this change would be binary-compatible.</div>
<div><br></div><div>But this is no strong preference, I could also live with the two separate annotations.</div>
<div><br></div><div>--Gunnar</div><div><br></div><div>[1] <a href="http://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_interfaces_-_API_methods" target="_blank">http://wiki.eclipse.org/Evolving_Java-based_APIs_2#Evolving_API_interfaces_-_API_methods</a></div>
</div></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>beanvalidation-dev mailing list</span><br><span><a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a></span><br></div></blockquote></body></html>