2 * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.sal.rest.doc.util;
11 import com.fasterxml.jackson.databind.JsonNode;
12 import com.fasterxml.jackson.databind.node.ArrayNode;
13 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
14 import com.fasterxml.jackson.databind.node.ObjectNode;
15 import java.util.Iterator;
18 public final class JsonUtil {
23 public static ArrayNode copy(ArrayNode source) {
24 ArrayNode result = JsonNodeFactory.instance.arrayNode();
25 for (JsonNode jsonNode : source) {
31 public static void addFields(final ObjectNode node, final Iterator<Map.Entry<String, JsonNode>> fields) {
32 while (fields.hasNext()) {
33 final Map.Entry<String, JsonNode> field = fields.next();
34 node.set(field.getKey(), field.getValue());