Java 类javax.validation.bootstrap.GenericBootstrap 实例源码

项目: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();
}
项目:packagedrone    文件:ValidationBundle.java   
private static Validator buildValidator ()
{
    final GenericBootstrap bootstrap = Validation.byDefaultProvider ();
    bootstrap.providerResolver ( tracker );

    final Configuration<?> cfg = bootstrap.configure ();
    final OsgiMessageInterpolator mi = getMessageInterpolator ();
    mi.setFallback ( cfg.getDefaultMessageInterpolator () );
    cfg.messageInterpolator ( mi );

    final ValidatorFactory factory = cfg.buildValidatorFactory ();
    return factory.getValidator ();
}
项目:package-drone    文件:ValidationBundle.java   
private static Validator buildValidator ()
{
    final GenericBootstrap bootstrap = Validation.byDefaultProvider ();
    bootstrap.providerResolver ( tracker );

    final Configuration<?> cfg = bootstrap.configure ();
    final OsgiMessageInterpolator mi = getMessageInterpolator ();
    mi.setFallback ( cfg.getDefaultMessageInterpolator () );
    cfg.messageInterpolator ( mi );

    final ValidatorFactory factory = cfg.buildValidatorFactory ();
    return factory.getValidator ();
}
项目:lastaflute    文件:ActionValidator.java   
protected GenericBootstrap newGenericBootstrap() {
    return Validation.byDefaultProvider();
}
项目: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");
}
项目:gwt-bean-validators    文件:Validation.java   
/**
 * Build a <code>Configuration</code>.
 *
 * <pre>
 * Configuration&lt?&gt; configuration = Validation
 *    .byDefaultProvider()
 *    .configure();
 * ValidatorFactory factory = configuration.buildValidatorFactory();
 * </pre>
 *
 * <p>
 * The first available provider will be returned.
 * </p>
 *
 * @return instance building a generic <code>Configuration</code> complaint with the bootstrap
 *         state provided.
 */
public static GenericBootstrap byDefaultProvider() {
  return new GenericGwtBootstrapImpl();
}