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

Emmanuel Bernard emmanuel at hibernate.org
Fri Jan 18 11:17:04 EST 2013


It's not the same in the sense that there is only one physical place to
put your annotation - String getFoo() - and not 2.

On Fri 2013-01-18 17:09, Gunnar Morling wrote:
> But isn't this is the same with putting a real annotation to a getter? At
> least as long as we don't have something like @ValidateOnCall in BV (for
> which we then again would need a way for specifying in XML I guess).
> 
> Maybe it's a good idea to wait with the XML stuff for the getter work being
> finished.
> 
> --Gunnar
> 
> 
> 
> 2013/1/18 Emmanuel Bernard <emmanuel at hibernate.org>
> 
> > 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
> >
> > _______________________________________________
> > beanvalidation-dev mailing list
> > beanvalidation-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/beanvalidation-dev
> >

> _______________________________________________
> 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