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(); }
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 (); }
protected GenericBootstrap newGenericBootstrap() { return Validation.byDefaultProvider(); }
/** * 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"); }
/** * Build a <code>Configuration</code>. * * <pre> * Configuration<?> 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(); }