On 3 Jan 2013, at 4:10 PM, Emmanuel Bernard <emman...@hibernate.org> wrote:

> Something like c makes sense.
> It similar to the notion of converter in JPA.
> 
> But why not the following style of interfaces
> 
>    interface Convert<From,To> {
>        To convert(From);
>    }


Going back to Emmanuel mentioning @Convert.  I am wondering whether using 
explicit annotations would not be more appropriate than an SPI?
It would of course be more verbose, but maybe the "converter" annotation could 
be applied on class level as well. The concern for me is really the
ambiguity 

 @Size(min=3, max=10)
  UIInput<String> name;

introduces. What if @Null or @NotNull is used. Does it apply to the String or 
the UIInput instance. It is not apparent anymore from the annotations what
is targeted. We already started introducing ambiguous cases in Bean Validation 
with method validation (cross parameter constraints, exclusion from getters
from validated methods), I am not sure we should continue on this path. 

Does the gain we achieve via the proposed SPI outweigh introducing even more 
border cases?

--Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to