/** * 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; }
/** * 线程安全的 * * @return {@link Validator} */ public static Validator getValidator ( Class< ? extends ValidationProvider > providerType ) { return Validation.byProvider( providerType ) .configure() .buildValidatorFactory() .getValidator(); }
@Override public List<ValidationProvider<?>> getValidationProviders() { return Collections.singletonList(new HibernateValidator()); }
@Override public List<ValidationProvider<?>> getValidationProviders() { return Collections.<ValidationProvider<?>>singletonList(new HibernateValidator()); }
public OsgiValidationProviderTracker () { final BundleContext context = FrameworkUtil.getBundle ( OsgiValidationProviderTracker.class ).getBundleContext (); this.tracker = new ServiceTracker<> ( context, ValidationProvider.class, null ); }
@Override public List<ValidationProvider<?>> getValidationProviders () { return new ArrayList<> ( this.tracker.getTracked ().values () ); }
private static ArrayList<ValidationProvider<?>> createValidationProviderList() { final ArrayList<ValidationProvider<?>> temp = new ArrayList<>(); final ValidationProvider<?> provider = GWT.create(ValidationProvider.class); temp.add(provider); return temp; }
@Override public List<ValidationProvider<?>> getValidationProviders() { return DEFAULT_LIST; }
public NullConfig(final BootstrapState aState, final ValidationProvider<?> aProvider) { super(aState, aProvider); }
@Override public List<ValidationProvider<?>> getValidationProviders() { return ImmutableList.<ValidationProvider<?>>of(new HibernateValidator()); }
/** * Unsupported. Always throws an {@link UnsupportedOperationException}. * * @param providerType * * @throws UnsupportedOperationException not supported */ public static <T extends Configuration<T>, U extends ValidationProvider<T>> // ProviderSpecificBootstrap<T> // byProvider(final Class<U> providerType) { throw new UnsupportedOperationException( "GWT Validation does not support custom validator " + "providers"); }