Java 类javax.validation.ValidationProviderResolver 实例源码

项目:nest-old    文件:HibernateValidationConfigurationInitializer.java   
/**
 * create hibernate validation configuration
 * 
 * @return
 */
protected HibernateValidatorConfiguration createConfiguration() {
    HibernateValidatorConfiguration configuration = null;
    if (this.isIgnoreClassHierarchy()) {
        ValidationProviderResolver resolver = new ValidationProviderResolver() {
            /**
             * (non-Javadoc)
             * 
             * @see javax.validation.ValidationProviderResolver#getValidationProviders()
             */
            @Override
            public List<ValidationProvider<?>> getValidationProviders() {
                List<ValidationProvider<?>> providers = new ArrayList<ValidationProvider<?>>(1);
                providers.add(new HibernateValidator513());
                return providers;
            }
        };
        configuration = Validation.byProvider(HibernateValidator513.class).providerResolver(resolver).configure();
    } else {
        configuration = Validation.byProvider(HibernateValidator.class).configure();
    }
    configuration.messageInterpolator(new ResourceBundleMessageInterpolator(new PlatformResourceBundleLocator(
            MESSAGES)));
    return configuration;
}
项目:Camel    文件:ValidatorFactories.java   
public static ValidatorFactory buildValidatorFactory(boolean osgi,
                                                     ValidationProviderResolver validationProviderResolver,
                                                     MessageInterpolator messageInterpolator,
                                                     TraversableResolver traversableResolver,
                                                     ConstraintValidatorFactory constraintValidatorFactory) {

    ValidationProviderResolver resolvedValidationProviderResolver =
            resolveValidationProviderResolver(osgi, validationProviderResolver);

    GenericBootstrap bootstrap = Validation.byDefaultProvider();
    if (resolvedValidationProviderResolver != null) {
        bootstrap.providerResolver(resolvedValidationProviderResolver);
    }
    Configuration<?> configuration = bootstrap.configure();

    if (messageInterpolator != null) {
        configuration.messageInterpolator(messageInterpolator);
    }

    if (traversableResolver != null) {
        configuration.traversableResolver(traversableResolver);
    }

    if (constraintValidatorFactory != null) {
        configuration.constraintValidatorFactory(constraintValidatorFactory);
    }

    return configuration.buildValidatorFactory();
}
项目:gwt-bean-validators    文件:Validation.java   
@Override
public ValidationProviderResolver getDefaultValidationProviderResolver() {
  if (this.defaultResolver == null) {
    this.defaultResolver = GWT.create(ValidationProviderResolver.class);
  }
  return this.defaultResolver;
}
项目:Camel    文件:BeanValidatorEndpoint.java   
public ValidationProviderResolver getValidationProviderResolver() {
    return validationProviderResolver;
}
项目:Camel    文件:BeanValidatorEndpoint.java   
/**
 * To use a a custom {@link ValidationProviderResolver}
 */
public void setValidationProviderResolver(ValidationProviderResolver validationProviderResolver) {
    this.validationProviderResolver = validationProviderResolver;
}
项目:gwt-bean-validators    文件:Validation.java   
@Override
public ValidationProviderResolver getValidationProviderResolver() {
  return this.getDefaultValidationProviderResolver();
}
项目:gwt-bean-validators    文件:Validation.java   
/**
 * Unsupported. Always throws an {@link UnsupportedOperationException}.
 *
 * @throws UnsupportedOperationException not supported
 */
@Override
public GenericBootstrap providerResolver(final ValidationProviderResolver resolver) {
  throw new UnsupportedOperationException(
      "GWT Validation does not support custom validator " + "provider resolvers");
}
项目:Camel    文件:ValidatorFactories.java   
/**
 * Resolves optional custom {@code javax.validation.ValidationProviderResolver} to be used by the component. By
 * default component tries to use resolver instance bound to the Camel registry under name
 * {@code validationProviderResolver} . If there is no such resolver instance in the registry and component is
 * running in the OSGi environment, {@link HibernateValidationProviderResolver} will be used. In all the other
 * cases this method will return null.
 *
 * @param osgi specifies if validator factory should be OSGi-aware
 * @param validationProviderResolver predefined provider resolver. This parameter overrides the results of the
 *                                   resolution.
 * @return {@code javax.validation.ValidationProviderResolver} instance or null if no custom resolver should
 * be used by the component
 */
private static ValidationProviderResolver resolveValidationProviderResolver(
        boolean osgi,
        ValidationProviderResolver validationProviderResolver) {
    if (validationProviderResolver != null) {
        return validationProviderResolver;
    }
    if (osgi) {
        return new HibernateValidationProviderResolver();
    }
    return null;
}
项目:spring    文件:LocalValidatorFactoryBean.java   
/**
 * Specify a JSR-303 {@link ValidationProviderResolver} for bootstrapping the
 * provider of choice, as an alternative to {@code META-INF} driven resolution.
 * @since 4.3
 */
public void setValidationProviderResolver(ValidationProviderResolver validationProviderResolver) {
    this.validationProviderResolver = validationProviderResolver;
}