[bv-dev] Hosting of method validation methods

Gunnar Morling gunnar at hibernate.org
Wed Aug 1 02:20:56 EDT 2012


Hi,

What do you other guys think?

I'll go and create a branch to play around a bit with a separate
MethodValidator interface. Maybe it helps to have something more specific
which we then can compare and discuss.

--Gunnar
Am 26.07.2012 10:38 schrieb "Hardy Ferentschik" <hardy at hibernate.org>:

>
> On Jul 25, 2012, at 12:00 AM, Gunnar Morling wrote:
>
> > Hi,
> >
> > 2012/7/23 Hardy Ferentschik <hardy at hibernate.org>:
> >> Hi all,
> >>
> >> Let me pick up yet another TODO from the current spec.
> >>
> >> Section "5.1.2. Method-level validation methods" [1] still contains a
> TODO whether the methods for method validation should be hosted
> >> on a different interface (other than javax.validation.Validator).
> >>
> >> At the moment all validation methods are hosted on
> javax.validation.Validator. Personally I don't see a strong reason for
> introducing
> >> another indirection/interface. Does anyone have objections removing the
> todo?
> >
> > I guess Emmanuel does :)
> >
> > Personally, I also used to be of the opinion that a separate interface
> > doesn't really add much value. What made me pondering though was the
> > recent discussion about adding new bean validation methods such as
> > validateProperty(T object, Path property, Class<?>... groups);
> >
> > Following the interface segregation principle [1], it may indeed be a
> > good idea to have two separate interfaces, one for standard bean
> > validation and one for method validation. I think the main question
> > is, who the consumers of the individual methods are. I think there may
> > be a broader range of users of the bean validation methods
> > (validate(), validateProperty() etc.) than of the method validation
> > methods (validateParameters() etc.), which typically will only be
> > invoked by authors of integration/glue code. So for users of the first
> > group it would reduce complexity if the method validation stuff went
> > into a separate interface.
> >
> > With respect to retrieving method validators, instead of something
> > like Validator#forMethod(Method method) etc. I could also imagine
> > ValidatorFactory#getMethodValidator(). Then one doesn't have to
> > retrieve a new validator for each validated method/constructor.
>
> +1 for ValidatorFactory#getMethodValidator() in case we decide separate
> interfaces
>
>
> --Hardy
>
>
> _______________________________________________
> 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/20120801/a80fe222/attachment.html 


More information about the beanvalidation-dev mailing list