javax.validation.ConstraintValidatorFactory Java Examples
The following examples show how to use
javax.validation.ConstraintValidatorFactory.
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: ValidationModule.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override protected void configure() { final MethodInterceptor interceptor = new ValidationInterceptor(); bindInterceptor(Matchers.any(), Matchers.annotatedWith(Validate.class), interceptor); requestInjection(interceptor); bind(ConstraintValidatorFactory.class).to(GuiceConstraintValidatorFactory.class); }
Example #2
Source File: ValidationModule.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Provides @Singleton ValidatorFactory validatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(HibernateValidator.class.getClassLoader()); ValidatorFactory factory = Validation.byDefaultProvider().configure() .constraintValidatorFactory(constraintValidatorFactory) .parameterNameProvider(new AopAwareParanamerParameterNameProvider()) .traversableResolver(new AlwaysTraversableResolver()) .messageInterpolator(new ParameterMessageInterpolator()) .buildValidatorFactory(); // FIXME: Install custom MessageInterpolator that can properly find/merge ValidationMessages.properties for bundles // exercise interpolator to preload elements (avoids issues later when TCCL might be different) factory.getValidator().validate(new Object() { // minimal token message @NotNull(message = "{org.sonatype.nexus.validation.constraint.notnull}") String empty; }); return factory; } finally { Thread.currentThread().setContextClassLoader(tccl); } }
Example #3
Source File: InjectingValidationFeature.java From pay-publicapi with MIT License | 5 votes |
@Override public boolean configure(FeatureContext context) { context.register(new AbstractBinder() { @Override protected void configure() { bindFactory(ValidatorFactory.class).to(Validator.class).in(Singleton.class); bind(InjectingConfiguredValidator.class).to(ConfiguredValidator.class).in(Singleton.class); bind(new InjectingConstraintValidatorFactory(injector)).to(ConstraintValidatorFactory.class); } }); return true; }
Example #4
Source File: CustomValidatorProvider.java From tomee with Apache License 2.0 | 4 votes |
@Override public ValidatorContext constraintValidatorFactory(final ConstraintValidatorFactory factory) { return null; }
Example #5
Source File: CustomValidatorProvider.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { return null; }
Example #6
Source File: CustomValidatorProvider.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getDefaultConstraintValidatorFactory() { return null; }
Example #7
Source File: ValidatorBuilder.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { return delegate().getConstraintValidatorFactory(); }
Example #8
Source File: ValidatorBuilder.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getDefaultConstraintValidatorFactory() { return delegate.getDefaultConstraintValidatorFactory(); }
Example #9
Source File: SingleValidatorFactoryWrapper.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { return factory().getConstraintValidatorFactory(); }
Example #10
Source File: ValidatorFactoryWrapper.java From tomee with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { return factory().getConstraintValidatorFactory(); }
Example #11
Source File: IronJacamarValidatorFactory.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * {@inheritDoc} */ public ConstraintValidatorFactory getConstraintValidatorFactory() { return validatorFactory.getConstraintValidatorFactory(); }
Example #12
Source File: SerializableValidatorFactory.java From ironjacamar with Eclipse Public License 1.0 | 4 votes |
/** * {@inheritDoc} */ public ConstraintValidatorFactory getConstraintValidatorFactory() { return validatorFactory.getConstraintValidatorFactory(); }
Example #13
Source File: ValidationConfiguration.java From cxf with Apache License 2.0 | 4 votes |
public void setConstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }
Example #14
Source File: ValidationConfiguration.java From cxf with Apache License 2.0 | 4 votes |
public ConstraintValidatorFactory getConstraintValidatorFactory() { return constraintValidatorFactory; }
Example #15
Source File: ValidatorFactory.java From pay-publicapi with MIT License | 4 votes |
@Inject public ValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }
Example #16
Source File: LocalValidatorFactoryBean.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { Assert.notNull(this.validatorFactory, "No target ValidatorFactory set"); return this.validatorFactory.getConstraintValidatorFactory(); }
Example #17
Source File: SerializableValidatorFactory.java From lams with GNU General Public License v2.0 | 4 votes |
/** * {@inheritDoc} */ public ConstraintValidatorFactory getConstraintValidatorFactory() { return validatorFactory.getConstraintValidatorFactory(); }
Example #18
Source File: LocalValidatorFactoryBean.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { Assert.notNull(this.validatorFactory, "No target ValidatorFactory set"); return this.validatorFactory.getConstraintValidatorFactory(); }
Example #19
Source File: LocalValidatorFactoryBean.java From java-technology-stack with MIT License | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { Assert.notNull(this.validatorFactory, "No target ValidatorFactory set"); return this.validatorFactory.getConstraintValidatorFactory(); }
Example #20
Source File: LocalValidatorFactoryBean.java From spring-analysis-note with MIT License | 4 votes |
@Override public ConstraintValidatorFactory getConstraintValidatorFactory() { Assert.notNull(this.validatorFactory, "No target ValidatorFactory set"); return this.validatorFactory.getConstraintValidatorFactory(); }
Example #21
Source File: LocalValidatorFactoryBean.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory. * <p>Default is a {@link SpringConstraintValidatorFactory}, delegating to the * containing ApplicationContext for creating autowired ConstraintValidator instances. */ public void setConstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }
Example #22
Source File: LocalValidatorFactoryBean.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory. * <p>Default is a {@link SpringConstraintValidatorFactory}, delegating to the * containing ApplicationContext for creating autowired ConstraintValidator instances. */ public void setConstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }
Example #23
Source File: LocalValidatorFactoryBean.java From java-technology-stack with MIT License | 2 votes |
/** * Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory. * <p>Default is a {@link SpringConstraintValidatorFactory}, delegating to the * containing ApplicationContext for creating autowired ConstraintValidator instances. */ public void setConstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }
Example #24
Source File: LocalValidatorFactoryBean.java From spring-analysis-note with MIT License | 2 votes |
/** * Specify a custom ConstraintValidatorFactory to use for this ValidatorFactory. * <p>Default is a {@link SpringConstraintValidatorFactory}, delegating to the * containing ApplicationContext for creating autowired ConstraintValidator instances. */ public void setConstraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory) { this.constraintValidatorFactory = constraintValidatorFactory; }