当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getDefaultMessageInterpolator方法代码示例

本文整理汇总了Java中javax.validation.Configuration.getDefaultMessageInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getDefaultMessageInterpolator方法的具体用法?Java Configuration.getDefaultMessageInterpolator怎么用?Java Configuration.getDefaultMessageInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.validation.Configuration的用法示例。


在下文中一共展示了Configuration.getDefaultMessageInterpolator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BeanMessageInterpolator

import javax.validation.Configuration; //导入方法依赖的package包/类
/**
 * Creates a new BeanMessageInterpolator object. The nested delegator is
 * pulled from the bootstrap of the validation provider
 *
 */
public BeanMessageInterpolator() {
    @SuppressWarnings("rawtypes")
    Configuration configuration = Validation.byDefaultProvider().configure();

    delegate = configuration.getDefaultMessageInterpolator();
}
 
开发者ID:cucina,项目名称:opencucina,代码行数:12,代码来源:BeanMessageInterpolator.java

示例2: afterPropertiesSet

import javax.validation.Configuration; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() {
	@SuppressWarnings({"rawtypes", "unchecked"})
	Configuration<?> configuration = (this.providerClass != null ?
			Validation.byProvider(this.providerClass).configure() :
			Validation.byDefaultProvider().configure());

	MessageInterpolator targetInterpolator = this.messageInterpolator;
	if (targetInterpolator == null) {
		targetInterpolator = configuration.getDefaultMessageInterpolator();
	}
	configuration.messageInterpolator(new LocaleContextMessageInterpolator(targetInterpolator));

	if (this.traversableResolver != null) {
		configuration.traversableResolver(this.traversableResolver);
	}

	ConstraintValidatorFactory targetConstraintValidatorFactory = this.constraintValidatorFactory;
	if (targetConstraintValidatorFactory == null && this.applicationContext != null) {
		targetConstraintValidatorFactory =
				new SpringConstraintValidatorFactory(this.applicationContext.getAutowireCapableBeanFactory());
	}
	if (targetConstraintValidatorFactory != null) {
		configuration.constraintValidatorFactory(targetConstraintValidatorFactory);
	}

	if (this.parameterNameDiscoverer != null) {
		configureParameterNameProviderIfPossible(configuration);
	}

	if (this.mappingLocations != null) {
		for (Resource location : this.mappingLocations) {
			try {
				configuration.addMapping(location.getInputStream());
			}
			catch (IOException ex) {
				throw new IllegalStateException("Cannot read mapping resource: " + location);
			}
		}
	}

	for (Map.Entry<String, String> entry : this.validationPropertyMap.entrySet()) {
		configuration.addProperty(entry.getKey(), entry.getValue());
	}

	// Allow for custom post-processing before we actually build the ValidatorFactory.
	postProcessConfiguration(configuration);

	this.validatorFactory = configuration.buildValidatorFactory();
	setTargetValidator(this.validatorFactory.getValidator());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:LocalValidatorFactoryBean.java

示例3: afterPropertiesSet

import javax.validation.Configuration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void afterPropertiesSet() {
	@SuppressWarnings("rawtypes")
	Configuration configuration = (this.providerClass != null ?
			Validation.byProvider(this.providerClass).configure() :
			Validation.byDefaultProvider().configure());

	MessageInterpolator targetInterpolator = this.messageInterpolator;
	if (targetInterpolator == null) {
		targetInterpolator = configuration.getDefaultMessageInterpolator();
	}
	configuration.messageInterpolator(new LocaleContextMessageInterpolator(targetInterpolator));

	if (this.traversableResolver != null) {
		configuration.traversableResolver(this.traversableResolver);
	}

	ConstraintValidatorFactory targetConstraintValidatorFactory = this.constraintValidatorFactory;
	if (targetConstraintValidatorFactory == null && this.applicationContext != null) {
		targetConstraintValidatorFactory =
				new SpringConstraintValidatorFactory(this.applicationContext.getAutowireCapableBeanFactory());
	}
	if (targetConstraintValidatorFactory != null) {
		configuration.constraintValidatorFactory(targetConstraintValidatorFactory);
	}

	if (this.mappingLocations != null) {
		for (Resource location : this.mappingLocations) {
			try {
				configuration.addMapping(location.getInputStream());
			}
			catch (IOException ex) {
				throw new IllegalStateException("Cannot read mapping resource: " + location);
			}
		}
	}

	for (Map.Entry<String, String> entry : this.validationPropertyMap.entrySet()) {
		configuration.addProperty(entry.getKey(), entry.getValue());
	}

	// Allow for custom post-processing before we actually build the ValidatorFactory.
	postProcessConfiguration(configuration);

	this.validatorFactory = configuration.buildValidatorFactory();
	setTargetValidator(this.validatorFactory.getValidator());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:48,代码来源:LocalValidatorFactoryBean.java


注:本文中的javax.validation.Configuration.getDefaultMessageInterpolator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。