gpt4 book ai didi

org.springframework.ide.vscode.commons.yaml.path.YamlPathSegment.keyAt()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:06:15 33 4
gpt4 key购买 nike

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

YamlPathSegment.keyAt介绍

暂无

代码示例

代码示例来源:origin: spring-projects/sts4

private YamlPath keyAt(YamlPath path, String key) {
  if (path!=null && key!=null) {
    return path.append(YamlPathSegment.keyAt(key));
  }
  return null;
}

代码示例来源:origin: spring-projects/sts4

default YamlTraversal thenKeyAt(String key) {
  return then(YamlPathSegment.keyAt(key));
}
default YamlTraversal thenAnyChild() {

代码示例来源:origin: spring-projects/sts4

public static YamlPathSegment decode(String code) {
  switch (code.charAt(0)) {
  case '*':
    return anyChild();
  case '.':
    return valueAt(code.substring(1));
  case '&':
    return keyAt(code.substring(1));
  case '[':
    return valueAt(Integer.parseInt(code.substring(1)));
  default:
    throw new IllegalArgumentException("Can't decode YamlPathSegment from '"+code+"'");
  }
}

代码示例来源:origin: spring-projects/sts4

private static YamlTraversal getConflictingNodesTraversal(YamlPath path, String[] propertyIds) {
  Assert.isLegal(propertyIds.length > 0);
  YamlTraversal properties = null;
  for (String id : propertyIds) {
    properties = properties == null ? YamlPathSegment.keyAt(id) : properties.or(YamlPathSegment.keyAt(id));
  }
  YamlTraversal traversal = path.then(properties);
  if (path.size() > 2) {
    traversal = traversal.or(path.dropLast(2).then(properties));
  }
  return traversal;
}

代码示例来源:origin: spring-projects/sts4

public static Constraint mutuallyExclusive(String target, String... propertyIds) {
  return (dc, parent, node, type, problems) -> {
    Node targetNode = YamlPathSegment.keyAt(target).traverseNode(node);
    if (targetNode != null) {
      YamlTraversal conflictingTraversal = getConflictingNodesTraversal(dc.getPath(), propertyIds);
      List<Node> conflictingNodes = conflictingTraversal.traverseAmbiguously(dc.getAST()).collect(Collectors.toList());
      if (!conflictingNodes.isEmpty()) {
        Set<String> conflicts = conflictingNodes.stream().map(NodeUtil::asScalar).collect(Collectors.toCollection(TreeSet::new));
        problems.accept(YamlSchemaProblems.problem(
            ManifestYamlSchemaProblemsTypes.MUTUALLY_EXCLUSIVE_PROPERTY_PROBLEM,
            "Property cannot co-exist with properties " + conflicts, targetNode));
        for (Node cn : conflictingNodes) {
          problems.accept(YamlSchemaProblems.problem(
            ManifestYamlSchemaProblemsTypes.MUTUALLY_EXCLUSIVE_PROPERTY_PROBLEM,
            "Property cannot co-exist with property '" + target + "'", cn));
        }
      }
    }
  };
}

代码示例来源:origin: spring-projects/sts4

private void verify_heatth_check_http_end_point_constraint(DynamicSchemaContext dc, Node parent, Node node, YType type, IProblemCollector problems) {
  YamlFileAST ast = dc.getAST();
  if (ast!=null) {
    Node markerNode = YamlPathSegment.keyAt(HEALTH_CHECK_HTTP_ENDPOINT_PROP).traverseNode(node);
    if (markerNode != null) {
      String healthCheckType = getEffectiveHealthCheckType(ast, dc.getPath(), node);
      if (!"http".equals(healthCheckType)) {
        problems.accept(YamlSchemaProblems.problem(ManifestYamlSchemaProblemsTypes.IGNORED_PROPERTY,
            "This has no effect unless `"+HEALTH_CHECK_TYPE_PROP+"` is `http` (but it is currently set to `"+healthCheckType+"`)", markerNode));
      }
    }
  }
}

代码示例来源:origin: spring-projects/sts4

return null;
} else {
  segments.add(YamlPathSegment.keyAt(key));
} }
break;

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com