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

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

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

Config.isLeaf介绍

[英]Returns true if this node exists and is a leaf node (has no children).

A leaf node has no nested configuration subtree and has a single value.
[中]如果此节点存在并且是叶节点(没有子节点),则返回true。
叶节点没有嵌套的配置子树,只有一个值。

代码示例

代码示例来源:origin: oracle/helidon

private Object findArrayValue(String propertyName, Class<?> element) {
  // there should not be io.helidon.Config[]
  return findInMpSources(propertyName)
      .map(value -> asArray(value, element))
      .orElseGet(() -> {
        Config arrayConfig = config.get().get(propertyName);
        if (arrayConfig.isLeaf()) {
          return asArray(arrayConfig.asString().get(), element);
        }
        List<?> objects = arrayConfig.asList(element).get();
        Object array = Array.newInstance(element, objects.size());
        for (int i = 0; i < objects.size(); i++) {
          Array.set(array, i, objects.get(i));
        }
        return array;
      });
}

代码示例来源:origin: oracle/helidon

private static boolean notEqual(Config left, Config right) {
  if (left.type() != right.type()) {
    return true;
  }
  if (left.isLeaf()) {
    return !value(left).equals(value(right));
  }
  return false;
}

代码示例来源:origin: oracle/helidon

if (config.isLeaf()) {
  return new StringMap(config.key().toString(), config.asString().get());
} else {

代码示例来源:origin: oracle/helidon

/**
 * Update this builder from configuration.
 * @param config configuration to read, located on the node of the http basic authentication provider
 * @return updated builder instance
 */
public Builder config(Config config) {
  config.get("realm").asString().ifPresent(this::realm);
  config.get("principal-type").asString().as(SubjectType::valueOf).ifPresent(this::subjectType);
  // now users may not be configured at all
  Config usersConfig = config.get("users");
  if (usersConfig.exists()) {
    // or it may be jst an empty list (e.g. users: with no subnodes).
    if (!usersConfig.isLeaf()) {
      userStore(usersConfig.as(ConfigUserStore::create)
                   .orElseThrow(() -> new HttpAuthException(
                       "No users configured! Key \"users\" must be in configuration")));
    }
  }
  return this;
}

代码示例来源:origin: io.helidon.microprofile.config/helidon-microprofile-config

private Object findArrayValue(String propertyName, Class<?> element) {
  // there should not be io.helidon.Config[]
  return findInMpSources(propertyName)
      .map(value -> asArray(value, element))
      .orElseGet(() -> {
        Config arrayConfig = config.get().get(propertyName);
        if (arrayConfig.isLeaf()) {
          return asArray(arrayConfig.asString().get(), element);
        }
        List<?> objects = arrayConfig.asList(element).get();
        Object array = Array.newInstance(element, objects.size());
        for (int i = 0; i < objects.size(); i++) {
          Array.set(array, i, objects.get(i));
        }
        return array;
      });
}

代码示例来源:origin: io.helidon.config/helidon-config

private static boolean notEqual(Config left, Config right) {
  if (left.type() != right.type()) {
    return true;
  }
  if (left.isLeaf()) {
    return !value(left).equals(value(right));
  }
  return false;
}

代码示例来源:origin: io.helidon.config/helidon-config

if (config.isLeaf()) {
  return new StringMap(config.key().toString(), config.asString().get());
} else {

相关文章