本文整理汇总了Java中javax.validation.Configuration.getBootstrapConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getBootstrapConfiguration方法的具体用法?Java Configuration.getBootstrapConfiguration怎么用?Java Configuration.getBootstrapConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.validation.Configuration
的用法示例。
在下文中一共展示了Configuration.getBootstrapConfiguration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContext
import javax.validation.Configuration; //导入方法依赖的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);
}
示例2: getContext
import javax.validation.Configuration; //导入方法依赖的package包/类
/**
* Get a context of type {@code GeneralValidator} 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 GeneralValidator getContext(Class<?> type) {
Configuration<?> config = Validation.byDefaultProvider().configure();
BootstrapConfiguration bootstrapConfiguration = config.getBootstrapConfiguration();
config.messageInterpolator(new LocaleSpecificMessageInterpolator(Validation.byDefaultProvider().configure()
.getDefaultMessageInterpolator()));
config.parameterNameProvider(new CustomParameterNameProvider());
return new GeneralValidatorImpl(config.buildValidatorFactory(),
bootstrapConfiguration.isExecutableValidationEnabled(),
bootstrapConfiguration.getDefaultValidatedExecutableTypes());
}
开发者ID:samaxes,项目名称:jaxrs-beanvalidation-javaee7,代码行数:21,代码来源:ValidationConfigurationContextResolver.java