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.
On Jul 25, 2012, at 12:00 AM, Gunnar Morling wrote:
> 2012/7/23 Hardy Ferentschik <firstname.lastname@example.org>:
>> Hi all,
>> Let me pick up yet another TODO from the current spec.
>> Section "5.1.2. Method-level validation methods"  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 , 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
beanvalidation-dev mailing list