io.helidon.config.Config.mapList()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中io.helidon.config.Config.mapList()方法的一些代码示例,展示了Config.mapList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.mapList()方法的具体详情如下:
包路径:io.helidon.config.Config
类名称:Config
方法名:mapList

Config.mapList介绍

暂无

代码示例

代码示例来源:origin: io.helidon.security/helidon-security-providers-common

  1. static OutboundConfig from(Config providerConfig, OutboundTarget[] defaults) {
  2. Config config = providerConfig.get(CONFIG_OUTBOUND);
  3. List<OutboundTarget> configuredTargets = config.mapList(OutboundTarget::from, CollectionsHelper.listOf());
  4. boolean useDefaults = configuredTargets.stream().noneMatch(targetConfig -> "default".equals(targetConfig.getName()))
  5. && (null != defaults);
  6. Builder builder = OutboundConfig.builder();
  7. if (useDefaults) {
  8. //first add default values
  9. Arrays.stream(defaults).forEach(builder::addTarget);
  10. }
  11. //then add configured values
  12. configuredTargets.forEach(builder::addTarget);
  13. return builder.build();
  14. }

代码示例来源:origin: io.helidon.security/helidon-security-integration-webserver

  1. private void registerRouting(Routing.Rules routing) {
  2. Config wsConfig = config.get("security.web-server");
  3. SecurityHandler defaults = SecurityHandler.from(wsConfig.get("defaults"), defaultHandler);
  4. wsConfig.get("paths").nodeList().ifPresent(configs -> {
  5. for (Config pathConfig : configs) {
  6. List<Http.RequestMethod> methods = pathConfig.get("methods").mapList(Http.RequestMethod::from, listOf());
  7. String path = pathConfig.get("path")
  8. .value()
  9. .orElseThrow(() -> new SecurityException(pathConfig
  10. .key() + " must contain path key with a path to "
  11. + "register to web server"));
  12. if (methods.isEmpty()) {
  13. routing.any(path, SecurityHandler.from(pathConfig, defaults));
  14. } else {
  15. routing.anyOf(methods, path, SecurityHandler.from(pathConfig, defaults));
  16. }
  17. }
  18. });
  19. }
  20. }

相关文章