本文整理了Java中javax.validation.Configuration.addProperty()
方法的一些代码示例,展示了Configuration.addProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.addProperty()
方法的具体详情如下:
包路径:javax.validation.Configuration
类名称:Configuration
方法名:addProperty
[英]Adds a provider specific property. This property is equivalent to XML configuration properties. If the underlying provider does not know how to handle the property, it must silently ignore it.
Note: Using this non type-safe method is generally not recommended.
It is more appropriate to use, if available, the type-safe equivalent provided by a specific provider via its Configuration subclass.
ValidatorFactory factory = Validation.byProvider(ACMEProvider.class)
.configure()
.providerSpecificProperty(ACMEState.FAST)
.buildValidatorFactory();
This method is typically used by containers parsing META-INF/validation.xmlthemselves and injecting the state to the Configuration object.
If a property with a given name is defined both via this method and in the XML configuration, the value set programmatically has priority.
If null is passed as a value, the value defined in XML is used. If no value is defined in XML, the property is considered unset.
[中]添加特定于提供程序的属性。此属性相当于XML配置属性。如果基础提供程序不知道如何处理该属性,则必须以静默方式忽略该属性。
注:通常不建议使用这种非类型安全方法。
如果可用,则更适合使用特定提供程序通过其配置子类提供的类型安全等效项。
ValidatorFactory factory = Validation.byProvider(ACMEProvider.class)
.configure()
.providerSpecificProperty(ACMEState.FAST)
.buildValidatorFactory();
此方法通常由解析META-INF/验证的容器使用。并将状态注入配置对象。
如果通过此方法和XML配置定义了具有给定名称的属性,则以编程方式设置的值具有优先级。
如果null作为值传递,则使用XML中定义的值。如果XML中未定义任何值,则认为该属性未设置。
代码示例来源:origin: org.graniteds/granite-client-java-advanced
@SuppressWarnings("unchecked")
@Override
public T addProperty(String name, String value) {
configuration = configuration.addProperty(name, value);
return (T)this;
}
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public T addProperty(final String name, final String value) {
return delegate.addProperty(name, value);
}
代码示例来源:origin: io.micronaut.configuration/micronaut-hibernate-validator
Object value = entry.getValue();
if (value != null) {
validatorConfiguration.addProperty(
"hibernate.validator." + entry.getKey(),
value.toString()
代码示例来源:origin: apache/cxf
private static void initFactoryConfig(Configuration<?> factoryCfg, ValidationConfiguration cfg) {
if (cfg != null) {
factoryCfg.parameterNameProvider(cfg.getParameterNameProvider());
factoryCfg.messageInterpolator(cfg.getMessageInterpolator());
factoryCfg.traversableResolver(cfg.getTraversableResolver());
factoryCfg.constraintValidatorFactory(cfg.getConstraintValidatorFactory());
for (Map.Entry<String, String> entry : cfg.getProperties().entrySet()) {
factoryCfg.addProperty(entry.getKey(), entry.getValue());
}
}
}
代码示例来源:origin: org.apache.cxf/cxf-core
private static void initFactoryConfig(Configuration<?> factoryCfg, ValidationConfiguration cfg) {
if (cfg != null) {
factoryCfg.parameterNameProvider(cfg.getParameterNameProvider());
factoryCfg.messageInterpolator(cfg.getMessageInterpolator());
factoryCfg.traversableResolver(cfg.getTraversableResolver());
factoryCfg.constraintValidatorFactory(cfg.getConstraintValidatorFactory());
for (Map.Entry<String, String> entry : cfg.getProperties().entrySet()) {
factoryCfg.addProperty(entry.getKey(), entry.getValue());
}
}
}
代码示例来源:origin: org.apache.openejb/openejb-core
logger.debug("Found property '" + property.getName() + "' with value '" + property.getValue());
target.addProperty(property.getName(), property.getValue());
代码示例来源:origin: org.apache.tomee/openejb-core
logger.debug("Found property '" + property.getName() + "' with value '" + property.getValue());
target.addProperty(property.getName(), property.getValue());
内容来源于网络,如有侵权,请联系作者删除!