As no one else expressed an opinion on this, it seems like the final result is 2:1 for specifying @ConvertGroup next to @Valid instead of within. I guess I can live with that :)<div><br><div class="gmail_extra"><br><div class="gmail_quote">
2012/11/22 Hardy Ferentschik <span dir="ltr">&lt;<a href="mailto:hardy@hibernate.org" target="_blank">hardy@hibernate.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I agree with Emmanuel. I prefer the current syntax slightly more. Partly because we wanted to keep @Valid unchanged which I still like.<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--hardy<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 22 Nov 2012, at 18:11, Emmanuel Bernard &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt; wrote:<br>
<br>
&gt; I don&#39;t have any strong opinion. I slightly tend to like the existing<br>
&gt; syntax which avoids some of the visual ugliness if one group rule is<br>
&gt; defined but that&#39;s only a small advantage.<br>
&gt;<br>
&gt; Emmanuel<br>
&gt;<br>
&gt; On Thu 2012-11-22 16:45, Gunnar Morling wrote:<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; I&#39;m looking for some input on an idea I got regarding group translation.<br>
&gt;&gt;<br>
&gt;&gt; When discussing the issue [1] we agreed that the groups to be converted<br>
&gt;&gt; should be specified with a new annotation instead of directly within<br>
&gt;&gt; @Valid. So that&#39;s what we have right now:<br>
&gt;&gt;<br>
&gt;&gt; public class User {<br>
&gt;&gt;<br>
&gt;&gt;  @Valid<br>
&gt;&gt;  @ConvertGroup(from = Default.class, to = BasicContact.class)<br>
&gt;&gt;  private final Contact contact = new Contact();<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt; IIRC the primary reason was that this new annotation could be re-used in<br>
&gt;&gt; other places. IMO having a separate annotation is the right way, but WDYT<br>
&gt;&gt; about specifying this annotation within instead of next to @Valid:<br>
&gt;&gt;<br>
&gt;&gt;  @Valid(conversions=<br>
&gt;&gt;    @ConvertGroup(from = Default.class, to = BasicContact.class<br>
&gt;&gt;  )<br>
&gt;&gt;  private final Contact contact = new Contact();<br>
&gt;&gt;<br>
&gt;&gt; This would still allow to reuse the annotation, but avoids situations where<br>
&gt;&gt; @ConvertGroup is given without @Valid. It also makes very clear what&#39;s<br>
&gt;&gt; subject of the conversion (which might not be that obvious if the given<br>
&gt;&gt; element hosts some more annotations).<br>
&gt;&gt;<br>
&gt;&gt; On the down-side the &quot;inner&quot; annotation syntax is not that elegant,<br>
&gt;&gt; although it&#39;s actually shorter when specifying multiple conversions:<br>
&gt;&gt;<br>
&gt;&gt;  @Valid(conversions={<br>
&gt;&gt;    @ConvertGroup(from = Default.class, to = BasicContact.class),<br>
&gt;&gt;    @ConvertGroup(from = Full.class, to = FullContact.class)<br>
&gt;&gt;  })<br>
&gt;&gt;  private final Contact contact = new Contact();<br>
&gt;&gt;<br>
&gt;&gt; vs.<br>
&gt;&gt;<br>
&gt;&gt;  @Valid<br>
&gt;&gt;  @ConvertGroup.List({<br>
&gt;&gt;    @ConvertGroup(from = Default.class, to = BasicContact.class),<br>
&gt;&gt;    @ConvertGroup(from = Full.class, to = FullContact.class)<br>
&gt;&gt;  })<br>
&gt;&gt;  private final Contact contact = new Contact();<br>
&gt;&gt;<br>
&gt;&gt; This could be further mitigated by naming the attribute &quot;value&quot;, although<br>
&gt;&gt; I&#39;m a bit shy of allocating that default attribute.<br>
&gt;&gt;<br>
&gt;&gt; If we already discussed (and rejected) this particular approach, please<br>
&gt;&gt; ignore this mail, otherwise any feedback is appreciated :)<br>
&gt;&gt;<br>
&gt;&gt; --Gunnar<br>
&gt;&gt;<br>
&gt;&gt; [1] <a href="https://hibernate.onjira.com/browse/BVAL-208" target="_blank">https://hibernate.onjira.com/browse/BVAL-208</a><br>
&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; beanvalidation-dev mailing list<br>
&gt;&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; beanvalidation-dev mailing list<br>
&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
</div></div></blockquote></div><br></div></div>