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

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

本文整理了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

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));
        }
      }
    });
  }
}

相关文章