本文整理了Java中io.helidon.config.Config.value()
方法的一些代码示例,展示了Config.value()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.value()
方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:value
暂无
代码示例来源:origin: io.helidon.webserver/helidon-webserver-zipkin
/**
* Update this builder from configuration.
*
* @param config configuration that contains at least the key service (if using configuration only).
* @return updated builder instance
*/
public ZipkinTracerBuilder fromConfig(Config config) {
config.get("service").value().ifPresent(this::serviceName);
config.get("protocol").value().ifPresent(this::protocol);
config.get("host").value().ifPresent(this::zipkinHost);
config.get("port").asOptionalInt().ifPresent(this::port);
config.get("path").value().ifPresent(this::path);
config.get("api-version").value().ifPresent(this::configApiVersion);
return this;
}
代码示例来源:origin: io.helidon.webserver/helidon-webserver-zipkin
/**
* Create a new builder based on values in configuration.
* This requires at least a key "service" in the provided config.
*
* @param config configuration to load this builder from
* @return a new builder instance.
* @see ZipkinTracerBuilder#fromConfig(Config)
*/
public static ZipkinTracerBuilder from(Config config) {
String serviceName = config.get("service").value()
.orElseThrow(() -> new IllegalArgumentException("Configuration must at least contain the service key"));
return ZipkinTracerBuilder.forService(serviceName)
.fromConfig(config);
}
代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver
private void registerRouting(Routing.Rules routing) {
Config wsConfig = config.get("security.web-server");
SecurityHandler defaults = SecurityHandler.from(wsConfig.get("defaults"), defaultHandler);
wsConfig.get("paths").nodeList().ifPresent(configs -> {
for (Config pathConfig : configs) {
List<Http.RequestMethod> methods = pathConfig.get("methods").mapList(Http.RequestMethod::from, listOf());
String path = pathConfig.get("path")
.value()
.orElseThrow(() -> new SecurityException(pathConfig
.key() + " must contain path key with a path to "
+ "register to web server"));
if (methods.isEmpty()) {
routing.any(path, SecurityHandler.from(pathConfig, defaults));
} else {
routing.anyOf(methods, path, SecurityHandler.from(pathConfig, defaults));
}
}
});
}
}
代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver
builder.config(config);
OptionalHelper.from(config.get(KEY_AUTHENTICATOR).value()).or(() -> defaults.explicitAuthenticator).asOptional()
.ifPresent(builder::authenticator);
OptionalHelper.from(config.get(KEY_AUTHORIZER).value()).or(() -> defaults.explicitAuthorizer).asOptional()
.ifPresent(builder::authorizer);
OptionalHelper.from(config.get(KEY_AUTHENTICATE).asOptional(Boolean.class)).or(() -> defaults.authenticate).asOptional()
OptionalHelper.from(config.get(KEY_AUTHORIZE).asOptional(Boolean.class)).or(() -> defaults.authorize).asOptional()
.ifPresent(builder::authorize);
OptionalHelper.from(config.get(KEY_AUDIT_EVENT_TYPE).value()).or(() -> defaults.auditEventType).asOptional()
.ifPresent(builder::auditEventType);
OptionalHelper.from(config.get(KEY_AUDIT_MESSAGE_FORMAT).value()).or(() -> defaults.auditMessageFormat).asOptional()
.ifPresent(builder::auditMessageFormat);
config.get(KEY_QUERY_PARAM_HANDLERS).asOptionalList(QueryParamHandler.class)
config.get(KEY_AUTHENTICATOR).value().ifPresent(value -> {
if (!config.get(KEY_AUTHENTICATE).exists()) {
builder.authenticate(true);
config.get(KEY_AUTHORIZER).value().ifPresent(value -> {
if (!config.get(KEY_AUTHORIZE).exists()) {
builder.authorize(true);
内容来源于网络,如有侵权,请联系作者删除!