Java 类org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator 实例源码

项目:nest-old    文件:HibernateValidationConfigurationInitializer.java   
/**
 * 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;
}
项目:syndesis    文件:ValidatorContextResolver.java   
@Override
public GeneralValidator getContext(final Class<?> type) {
    final ResourceBundleLocator resourceBundleLocator = new PlatformResourceBundleLocator("messages");
    final MessageInterpolator messageInterpolator = new ResourceBundleMessageInterpolator(resourceBundleLocator);
    final Configuration<?> config = Validation.byDefaultProvider().configure()
        .messageInterpolator(messageInterpolator);
    final BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    final boolean isExecutableValidationEnabled = bootstrapConfiguration.isExecutableValidationEnabled();
    final Set<ExecutableType> defaultValidatedExecutableTypes = bootstrapConfiguration
        .getDefaultValidatedExecutableTypes();

    return new GeneralValidatorImpl(validatorFactory, isExecutableValidationEnabled,
        defaultValidatedExecutableTypes);
}
项目:syndesis-rest    文件:ValidatorContextResolver.java   
@Override
public GeneralValidator getContext(final Class<?> type) {
    final ResourceBundleLocator resourceBundleLocator = new PlatformResourceBundleLocator("messages");
    final MessageInterpolator messageInterpolator = new ResourceBundleMessageInterpolator(resourceBundleLocator);
    final Configuration<?> config = Validation.byDefaultProvider().configure()
        .messageInterpolator(messageInterpolator);
    final BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
    final boolean isExecutableValidationEnabled = bootstrapConfiguration.isExecutableValidationEnabled();
    final Set<ExecutableType> defaultValidatedExecutableTypes = bootstrapConfiguration
        .getDefaultValidatedExecutableTypes();

    return new GeneralValidatorImpl(validatorFactory, isExecutableValidationEnabled,
        defaultValidatedExecutableTypes);
}
项目:ameba    文件:ValidationFeature.java   
@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()
                    )
            );
}
项目:zekke-webapp    文件:WebServiceConfig.java   
/**
 * {@inheritDoc}
 */
@Override
public ValidationConfig getContext(Class<?> type) {
    return new ValidationConfig()
            .messageInterpolator(
                    // TODO: ResourceBundleMessageInterpolator always return default messages
                    new ResourceBundleMessageInterpolator(
                            new PlatformResourceBundleLocator(Messages.RESOURCE_BUNDLE_BASE_NAME)));
}
项目:lams    文件:LocalValidatorFactoryBean.java   
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
    return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
项目:spring4-understanding    文件:LocalValidatorFactoryBean.java   
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
    return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
项目:my-spring-cache-redis    文件:LocalValidatorFactoryBean.java   
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
    return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
项目:spring    文件:LocalValidatorFactoryBean.java   
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
    return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
项目:entelect-spring-webapp-template    文件:SpringMVCConfig.java   
@Bean
public LocalValidatorFactoryBean validator() {
    LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
    bean.setMessageInterpolator(new ResourceBundleMessageInterpolator());
    return bean;
}
项目:lastaflute    文件:ActionValidator.java   
protected ResourceBundleMessageInterpolator newResourceBundleMessageInterpolator() {
    return new ResourceBundleMessageInterpolator(newResourceBundleLocator());
}
项目:class-guard    文件:LocalValidatorFactoryBean.java   
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
    return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
项目:xlsmapper    文件:MessageResolverInterpolator.java   
public MessageResolverInterpolator(final MessageResolver messageResolver) {
    ArgUtils.notNull("messageResolver", "messageResolver");
    this.messageInterpolator = new ResourceBundleMessageInterpolator(
            new MessageResolverResourceBundleLocator(messageResolver));
}