[bv-dev] @ConvertGroup and inheritance

Emmanuel Bernard emmanuel at hibernate.org
Fri Nov 9 13:08:43 EST 2012


I like your first option too. Can you also add an issue at the spec level? Ideally do a pull request. 

On 9 nov. 2012, at 19:01, Gunnar Morling <gunnar at hibernate.org> wrote:

> Hi all,
> 
> I'm about to implement group conversion via @ConvertGroup in the RI.
> 
> I'm wondering how we should deal with situations where @ConvertGroup is given for a one property of a base class and again on a sub-class (same for interface and impl):
> 
> public class Foo {
> 
>     @Valid
>     @ConvertGroup(from=Default.class, to=AnotherGroup.class)
>     Bar getBar() { ... }
> }
> 
> public class Baz extends Foo {
> 
>     @Override
>     @Valid
>     @ConvertGroup(from=SomeGroup.class, to=YetAnotherGroup.class)
>     Bar getBar() { ... }
> }
> 
> AFAICS we've got the following options here (in descending order of my preference):
> 
> * Merge all the conversions for a property from the hierarchy (so behavior is the same as when all conversions would have been given in one place using @ConvertGroup.List)
> * Consider only the top/bottom most conversion rule from the inheritance hierarchy
> * Allow only one conversion for a property in the hierarchy, throw an exception if multiple conversions are given
> 
> Any thoughts?
> 
> --Gunnar
> 
> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/beanvalidation-dev/attachments/20121109/4d9b479b/attachment.html 


More information about the beanvalidation-dev mailing list