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"><<a href="mailto:hardy@hibernate.org" target="_blank">hardy@hibernate.org</a>></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 <<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>> wrote:<br>
<br>
> I don't have any strong opinion. I slightly tend to like the existing<br>
> syntax which avoids some of the visual ugliness if one group rule is<br>
> defined but that's only a small advantage.<br>
><br>
> Emmanuel<br>
><br>
> On Thu 2012-11-22 16:45, Gunnar Morling wrote:<br>
>> Hi all,<br>
>><br>
>> I'm looking for some input on an idea I got regarding group translation.<br>
>><br>
>> When discussing the issue [1] we agreed that the groups to be converted<br>
>> should be specified with a new annotation instead of directly within<br>
>> @Valid. So that's what we have right now:<br>
>><br>
>> public class User {<br>
>><br>
>> @Valid<br>
>> @ConvertGroup(from = Default.class, to = BasicContact.class)<br>
>> private final Contact contact = new Contact();<br>
>> }<br>
>><br>
>> IIRC the primary reason was that this new annotation could be re-used in<br>
>> other places. IMO having a separate annotation is the right way, but WDYT<br>
>> about specifying this annotation within instead of next to @Valid:<br>
>><br>
>> @Valid(conversions=<br>
>> @ConvertGroup(from = Default.class, to = BasicContact.class<br>
>> )<br>
>> private final Contact contact = new Contact();<br>
>><br>
>> This would still allow to reuse the annotation, but avoids situations where<br>
>> @ConvertGroup is given without @Valid. It also makes very clear what's<br>
>> subject of the conversion (which might not be that obvious if the given<br>
>> element hosts some more annotations).<br>
>><br>
>> On the down-side the "inner" annotation syntax is not that elegant,<br>
>> although it's actually shorter when specifying multiple conversions:<br>
>><br>
>> @Valid(conversions={<br>
>> @ConvertGroup(from = Default.class, to = BasicContact.class),<br>
>> @ConvertGroup(from = Full.class, to = FullContact.class)<br>
>> })<br>
>> private final Contact contact = new Contact();<br>
>><br>
>> vs.<br>
>><br>
>> @Valid<br>
>> @ConvertGroup.List({<br>
>> @ConvertGroup(from = Default.class, to = BasicContact.class),<br>
>> @ConvertGroup(from = Full.class, to = FullContact.class)<br>
>> })<br>
>> private final Contact contact = new Contact();<br>
>><br>
>> This could be further mitigated by naming the attribute "value", although<br>
>> I'm a bit shy of allocating that default attribute.<br>
>><br>
>> If we already discussed (and rejected) this particular approach, please<br>
>> ignore this mail, otherwise any feedback is appreciated :)<br>
>><br>
>> --Gunnar<br>
>><br>
>> [1] <a href="https://hibernate.onjira.com/browse/BVAL-208" target="_blank">https://hibernate.onjira.com/browse/BVAL-208</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>
><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>
<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>