本文整理汇总了Java中org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator类的典型用法代码示例。如果您正苦于以下问题:Java ResourceBundleMessageInterpolator类的具体用法?Java ResourceBundleMessageInterpolator怎么用?Java ResourceBundleMessageInterpolator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceBundleMessageInterpolator类属于org.hibernate.validator.messageinterpolation包,在下文中一共展示了ResourceBundleMessageInterpolator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConfiguration
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
/**
* 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;
}
示例2: getContext
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
@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);
}
示例3: getContext
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
@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()
)
);
}
示例4: getContext
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
/**
* {@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)));
}
示例5: buildMessageInterpolator
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
public static MessageInterpolator buildMessageInterpolator(MessageSource messageSource) {
return new ResourceBundleMessageInterpolator(new MessageSourceResourceBundleLocator(messageSource));
}
示例6: validator
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
@Bean
public LocalValidatorFactoryBean validator() {
LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
bean.setMessageInterpolator(new ResourceBundleMessageInterpolator());
return bean;
}
示例7: newResourceBundleMessageInterpolator
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
protected ResourceBundleMessageInterpolator newResourceBundleMessageInterpolator() {
return new ResourceBundleMessageInterpolator(newResourceBundleLocator());
}
示例8: MessageResolverInterpolator
import org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator; //导入依赖的package包/类
public MessageResolverInterpolator(final MessageResolver messageResolver) {
ArgUtils.notNull("messageResolver", "messageResolver");
this.messageInterpolator = new ResourceBundleMessageInterpolator(
new MessageResolverResourceBundleLocator(messageResolver));
}