[bv-dev] support for non-standard Java beans

Emmanuel Bernard emmanuel at hibernate.org
Tue Jun 20 12:53:22 EDT 2017


The main problem is to differentiate a method from a getter in such universe where you throw the convention out the window.

> On 14 Jun 2017, at 06:12, Andrei Sereda <andrei at sereda.cc> wrote:
> 
> Hello,
> 
> Apologies  if I hijack this mailing list. Please redirect me to right DL / forum, if it is the case.
> 
> I would like to inquire if custom method resolution is within the scope of the spec (or exists already) for beans which don't exactly follow JavaBean convention. By custom, I mean name() vs getName(). 
> 
> I've noticed, lately, the trend to use code generators (Immutables <https://immutables.github.io/>, FreeBuilder <http://freebuilder.inferred.org/>, AutoValue <https://github.com/google/auto/blob/master/value/userguide/index.md> etc.) for domain entities. By default they all use name() for getters (instead of getName()) :
> 
> @FreeBuilder
> public interface Person {
> 
>   @NotBlank
>   String name();
>  
>   @Min(16) 
>   int age();
> 
>   ....
> }
> 
> It would be nice if BeanValidation could support such use-case via pluggable (getter / setter) method resolver (for example).
> 
> Associated JIRA  ticket HV-1363 <https://hibernate.atlassian.net/browse/HV-1363>
> 
> Thanks in advance,
> Andrei.
> _______________________________________________
> 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/20170620/eaa5589a/attachment-0001.html 


More information about the beanvalidation-dev mailing list