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


Java Configuration.traversableResolver方法代码示例

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


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

示例1: createValidatorFactory

import javax.validation.Configuration; //导入方法依赖的package包/类
/**
 * Create a validator factory
 * @return The factory
 */
static ValidatorFactory createValidatorFactory()
{
   Configuration configuration = Validation.byDefaultProvider().configure();
   Configuration<?> conf = configuration.traversableResolver(new IronJacamarTraversableResolver());

   return conf.buildValidatorFactory();
}
 
开发者ID:ironjacamar,项目名称:ironjacamar,代码行数:12,代码来源:BeanValidationImpl.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: buildValidatorFactory

import javax.validation.Configuration; //导入方法依赖的package包/类
public static ValidatorFactory buildValidatorFactory(boolean osgi,
                                                     ValidationProviderResolver validationProviderResolver,
                                                     MessageInterpolator messageInterpolator,
                                                     TraversableResolver traversableResolver,
                                                     ConstraintValidatorFactory constraintValidatorFactory) {

    ValidationProviderResolver resolvedValidationProviderResolver =
            resolveValidationProviderResolver(osgi, validationProviderResolver);

    GenericBootstrap bootstrap = Validation.byDefaultProvider();
    if (resolvedValidationProviderResolver != null) {
        bootstrap.providerResolver(resolvedValidationProviderResolver);
    }
    Configuration<?> configuration = bootstrap.configure();

    if (messageInterpolator != null) {
        configuration.messageInterpolator(messageInterpolator);
    }

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

    if (constraintValidatorFactory != null) {
        configuration.constraintValidatorFactory(constraintValidatorFactory);
    }

    return configuration.buildValidatorFactory();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:30,代码来源:ValidatorFactories.java

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