com.linecorp.centraldogma.internal.Jackson.mergeTree()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(128)

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

Jackson.mergeTree介绍

暂无

代码示例

代码示例来源:origin: line/centraldogma

public static JsonNode mergeTree(JsonNode... jsonNodes) {
  return mergeTree(ImmutableList.copyOf(requireNonNull(jsonNodes, "jsonNodes")));
}

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-common

public static JsonNode mergeTree(JsonNode... jsonNodes) {
  return mergeTree(ImmutableList.copyOf(requireNonNull(jsonNodes, "jsonNodes")));
}

代码示例来源:origin: line/centraldogma

result = Jackson.mergeTree(jsonNodes);
final List<String> expressions = query.expressions();
if (!Iterables.isEmpty(expressions)) {

代码示例来源:origin: com.linecorp.centraldogma/centraldogma-server

result = Jackson.mergeTree(jsonNodes);
final List<String> expressions = query.expressions();
if (!Iterables.isEmpty(expressions)) {

代码示例来源:origin: line/centraldogma

@Test
public void rootShouldBeObjectNode() throws IOException {
  final JsonNode arrayJson1 = readTree("[1, 2, 3]");
  final JsonNode arrayJson2 = readTree("[3, 4, 5]");
  assertThatThrownBy(() -> Jackson.mergeTree(arrayJson1, arrayJson2))
      .isExactlyInstanceOf(QueryExecutionException.class)
      .hasMessageContaining("/ type: ARRAY (expected: OBJECT)");
}

代码示例来源:origin: line/centraldogma

'}');
final JsonNode arrayJson = readTree("[1, 2, 3]");
assertThatThrownBy(() -> Jackson.mergeTree(baseJson, arrayJson))
    .isExactlyInstanceOf(QueryExecutionException.class)
    .hasMessageContaining("/ type: ARRAY (expected: OBJECT)");
                   "   }" +
                   '}');
assertThatThrownBy(() -> Jackson.mergeTree(baseJson, numberJson))
    .isExactlyInstanceOf(QueryExecutionException.class)
    .hasMessageContaining("/a/b/ type: NUMBER (expected: STRING)");
                     "   \"a\": [\"b\", \"c\"]" +
                     '}');
assertThatThrownBy(() -> Jackson.mergeTree(baseJson, objectArrayJson))
    .isExactlyInstanceOf(QueryExecutionException.class)
    .hasMessageContaining("/a/ type: ARRAY (expected: OBJECT)");
                  "   \"a\": null" +
                  '}');
assertThatThrownBy(() -> Jackson.mergeTree(baseJson, nullJson, numberJson))
    .isExactlyInstanceOf(QueryExecutionException.class)
    .hasMessageContaining("/a/b/ type: NUMBER (expected: STRING)");

代码示例来源:origin: line/centraldogma

@Test
public void nullCanBeAnyTypeWhileMerging() throws IOException {
  final JsonNode nullNode = readTree("{\"a\": null}");
  final JsonNode numberNode = readTree("{\"a\": 1}");
  JsonNode merged = Jackson.mergeTree(nullNode, numberNode);
  assertThatJson(merged).isEqualTo("{\"a\": 1}");
  final JsonNode stringNode = readTree("{\"a\": \"foo\"}");
  merged = Jackson.mergeTree(nullNode, stringNode);
  assertThatJson(merged).isEqualTo("{\"a\": \"foo\"}");
  final JsonNode arrayNode = readTree("{\"a\": [1, 2, 3]}");
  merged = Jackson.mergeTree(nullNode, arrayNode);
  assertThatJson(merged).isEqualTo("{\"a\": [1, 2, 3]}");
  final JsonNode objectNode = readTree('{' +
                     "   \"a\": {" +
                     "      \"b\": \"foo\"" +
                     "   }" +
                     '}');
  merged = Jackson.mergeTree(nullNode, objectNode);
  assertThatJson(merged).isEqualTo('{' +
                   "   \"a\": {" +
                   "      \"b\": \"foo\"" +
                   "   }" +
                   '}');
}

代码示例来源:origin: line/centraldogma

'}');
final JsonNode merged = Jackson.mergeTree(baseJson, additionalJson, additionalJson1);
final String expectedJson = '{' +
              "   \"a\": \"foo3\"," +

相关文章