2012/12/4 Umesh Awasthi <[email protected]>:
> Thanks for the inputs
> I have this BeanValidationManagerProvider interface with a method public
> Validator getValidator() which will return Validator based on the actual
> provider.
>
> Any Bean Validator in reference to JSR303 will implement
> javax.validation.Validator
>
> So in my BeanValidationManagerProvider Impl class i was thinking to
> providing a way to let user inject actual provider with this setter method
> protected Class providerClass;
> public void setProviderClass( Class<? extends ValidationProvider>
> providerClass)
> {
> this.providerClass = providerClass;
> }
>
> and than i will be able to get Validator by a simple call
> Validation.byProvider(this.providerClass).configure().buildValidatorFactory();
>
> May be i am wrong in my process, but i was wondering how best we can let
> user decide which provider they want to inject
I thought there should be a common way to load ValidationProvider,
like you just check Class.forName("javax....ValidationProvider") and
then throws exception that the user must add missing dependency. In
Maven you can define given implementation as an optional and user will
have to define a concrete implementation when he will try to use the
plugin.
Regards
--
Ćukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]