org.glassfish.jersey.server.validation.ValidationConfig Java Examples

The following examples show how to use org.glassfish.jersey.server.validation.ValidationConfig. 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: ValidationConfigurationContextResolver.java    From onedev with MIT License 5 votes vote down vote up
@Override
public ValidationConfig getContext(final Class<?> type) {
	ValidatorFactory factory = AppLoader.getInstance(ValidatorFactory.class);
    ValidationConfig config = new ValidationConfig();
    config.constraintValidatorFactory(factory.getConstraintValidatorFactory());
    config.messageInterpolator(factory.getMessageInterpolator());
    config.parameterNameProvider(factory.getParameterNameProvider());
    config.traversableResolver(factory.getTraversableResolver());
    return config;
}
 
Example #2
Source File: ValidationContextResolver.java    From azeroth with Apache License 2.0 5 votes vote down vote up
@Override
public ValidationConfig getContext(final Class<?> type) {
    final ValidationConfig config = new ValidationConfig();
    config.constraintValidatorFactory(
        resourceContext.getResource(InjectingConstraintValidatorFactory.class));
    config.parameterNameProvider(new CustomParameterNameProvider());
    return config;
}
 
Example #3
Source File: ValidationConfigurationContextResolver.java    From parsec-libraries with Apache License 2.0 5 votes vote down vote up
/** Get a context. */
@Override
public ValidationConfig getContext(Class<?> type) {
    final ValidationConfig config = new ValidationConfig();
    config.constraintValidatorFactory(resourceContext.getResource(InjectingConstraintValidatorFactory.class));
    CachingParanamer paranamer = new CachingParanamer(new CustomAnnotationParanamer());
    config.parameterNameProvider(new ParanamerParameterNameProvider(paranamer));
    return config;
}
 
Example #4
Source File: ValidationContextResolver.java    From jeesuite-libs with Apache License 2.0 5 votes vote down vote up
@Override
public ValidationConfig getContext(final Class<?> type) {
	final ValidationConfig config = new ValidationConfig();
	config.constraintValidatorFactory(resourceContext.getResource(InjectingConstraintValidatorFactory.class));
	config.parameterNameProvider(new CustomParameterNameProvider());
	return config;
}
 
Example #5
Source File: ValidationFeature.java    From ameba with MIT License 5 votes vote down vote up
@Override
public ValidationConfig getContext(final Class<?> type) {
    return new ValidationConfig()
            .constraintValidatorFactory(resourceContext.getResource(InjectingConstraintValidatorFactory.class))
            .parameterNameProvider(new ParanamerParameterNameProvider())
            .messageInterpolator(
                    new ResourceBundleMessageInterpolator(
                            buildBundleLocator(VALIDATION_MESSAGE_BUNDLE_NAME),
                            buildBundleLocator(Messages.BUNDLE_NAME),
                            mode.isProd()
                    )
            );
}
 
Example #6
Source File: ValidationConfigurationContextResolver.java    From sinavi-jfw with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public ValidationConfig getContext(final Class<?> type) {
    final ValidationConfig config = new ValidationConfig();
    config.constraintValidatorFactory(resourceContext.getResource(InjectingConstraintValidatorFactory.class));
    config.parameterNameProvider(new CustomParameterNameProvider());
    config.messageInterpolator(new DefaultMessageInterpolator(Validation.buildDefaultValidatorFactory().getMessageInterpolator()));
    return config;
}
 
Example #7
Source File: ValidationConfigurationContextResolver.java    From jaxrs-beanvalidation-javaee7 with Apache License 2.0 5 votes vote down vote up
/**
 * Get a context of type {@code ValidationConfig} that is applicable to the supplied type.
 *
 * @param type the class of object for which a context is desired
 * @return a context for the supplied type or {@code null} if a context for the supplied type is not available from
 *         this provider.
 */
@Override
public ValidationConfig getContext(Class<?> type) {
    final ValidationConfig config = new ValidationConfig();

    config.setMessageInterpolator(new LocaleSpecificMessageInterpolator(Validation.byDefaultProvider().configure()
            .getDefaultMessageInterpolator()));
    config.setParameterNameProvider(new CustomParameterNameProvider());

    return config;
}