javax.validation.spi.ValidationProvider Java Examples

The following examples show how to use javax.validation.spi.ValidationProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HibernateValidatorPro.java    From spring-boot-start-current with Apache License 2.0 5 votes vote down vote up
/**
 * 线程安全的
 *
 * @return {@link Validator}
 */
public static Validator getValidator ( Class< ? extends ValidationProvider > providerType ) {
    return Validation.byProvider( providerType )
		 .configure()
		 .buildValidatorFactory()
		 .getValidator();
}
 
Example #2
Source File: BeanValidationProvider.java    From cxf with Apache License 2.0 5 votes vote down vote up
public <T extends Configuration<T>, U extends ValidationProvider<T>> BeanValidationProvider(
    ValidationProviderResolver resolver,
    Class<U> providerType,
    ValidationConfiguration cfg) {
    try {
        Configuration<?> factoryCfg = providerType != null
            ? Validation.byProvider(providerType).providerResolver(resolver).configure()
            : Validation.byDefaultProvider().providerResolver(resolver).configure();
        initFactoryConfig(factoryCfg, cfg);
        factory = factoryCfg.buildValidatorFactory();
    } catch (final ValidationException ex) {
        LOG.severe("Bean Validation provider can not be found, no validation will be performed");
        throw ex;
    }
}
 
Example #3
Source File: SingleValidationProviderResolver.java    From g-suite-identity-sync with Apache License 2.0 4 votes vote down vote up
public SingleValidationProviderResolver(ValidationProvider<?> provider) {
    this.provider = provider;
}
 
Example #4
Source File: SingleValidationProviderResolver.java    From g-suite-identity-sync with Apache License 2.0 4 votes vote down vote up
@Override
public List<ValidationProvider<?>> getValidationProviders() {
    return singletonList(provider);
}
 
Example #5
Source File: OsgiValidationProviderTracker.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
public OsgiValidationProviderTracker ()
{
    final BundleContext context = FrameworkUtil.getBundle ( OsgiValidationProviderTracker.class ).getBundleContext ();

    this.tracker = new ServiceTracker<> ( context, ValidationProvider.class, null );
}
 
Example #6
Source File: OsgiValidationProviderTracker.java    From packagedrone with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public List<ValidationProvider<?>> getValidationProviders ()
{
    return new ArrayList<> ( this.tracker.getTracked ().values () );
}
 
Example #7
Source File: BeanValidationProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
public <T extends Configuration<T>, U extends ValidationProvider<T>> BeanValidationProvider(
    ValidationProviderResolver resolver,
    Class<U> providerType) {
    this(resolver, providerType, null);
}
 
Example #8
Source File: CustomValidatorProvider.java    From tomee with Apache License 2.0 4 votes vote down vote up
public NullConfig(final BootstrapState aState, final ValidationProvider<ApacheValidatorConfiguration> aProvider) {
    super(aState, aProvider);
}
 
Example #9
Source File: HibernateValidationProviderResolver.java    From wisdom with Apache License 2.0 4 votes vote down vote up
@Override
public List<ValidationProvider<?>> getValidationProviders() {
    return ImmutableList.<ValidationProvider<?>>of(new HibernateValidator());
}