本文整理了Java中io.helidon.config.Config.mapList()
方法的一些代码示例,展示了Config.mapList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.mapList()
方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:mapList
暂无
代码示例来源:origin: io.helidon.security/helidon-security-providers-common
static OutboundConfig from(Config providerConfig, OutboundTarget[] defaults) {
Config config = providerConfig.get(CONFIG_OUTBOUND);
List<OutboundTarget> configuredTargets = config.mapList(OutboundTarget::from, CollectionsHelper.listOf());
boolean useDefaults = configuredTargets.stream().noneMatch(targetConfig -> "default".equals(targetConfig.getName()))
&& (null != defaults);
Builder builder = OutboundConfig.builder();
if (useDefaults) {
//first add default values
Arrays.stream(defaults).forEach(builder::addTarget);
}
//then add configured values
configuredTargets.forEach(builder::addTarget);
return builder.build();
}
代码示例来源: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));
}
}
});
}
}
内容来源于网络,如有侵权,请联系作者删除!