[bv-dev] XML-based configuration of method constraints and group conversions

Emmanuel Bernard emmanuel at hibernate.org
Fri Jan 18 11:05:12 EST 2013


What concerns me is that with this situation, the <method /> approach
would lead to constraints being applied on the property when validating
the bean.
So either way, there is an awkward model.

On Fri 2013-01-18 16:28, Gunnar Morling wrote:
> 2013/1/18 Emmanuel Bernard <emmanuel at hibernate.org>
> 
> > Do you think it makes sense to force people to always use getter for
> > getters? My only concern is that it might feel awkward for what I call
> > action getters that people don't consider getters.
> >
> 
> Hum, I don't think it makes sense to enforce this. The idea is that you can
> chose to use either "getter":
> 
>     <getter name="foo">
>         <valid/>
>         <constraint annotation="javax.validation.constraints.NotNull"/>
>     </getter>
> 
> or "method" (e.g. for an "action getter"):
> 
>     <method name="getFoo">
>         <return-value>
>             <valid/>
>             <constraint annotation="javax.validation.constraints.NotNull"/>
>         </return-value>
>     </method>
> 
> as you like, but not both at the same time as they could conflict (similar
> to that you must not have two "getter" elements with the same name).

> _______________________________________________
> beanvalidation-dev mailing list
> beanvalidation-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/beanvalidation-dev



More information about the beanvalidation-dev mailing list