本文整理了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
暂无
代码示例来源: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;
内容来源于网络,如有侵权,请联系作者删除!