List of usage examples for com.fasterxml.jackson.databind.node ArrayNode ArrayNode
public ArrayNode(JsonNodeFactory paramJsonNodeFactory)
From source file:io.fabric8.kubernetes.api.KubernetesHelper.java
/** * Combines the JSON objects into a config object *//*w w w. j a v a2 s . c o m*/ public static JsonNode combineJson(Object... objects) throws IOException { JsonNode config = findOrCreateConfig(objects); JsonNode items = config.get("items"); ArrayNode itemArray; if (items instanceof ArrayNode) { itemArray = (ArrayNode) items; } else { itemArray = new ArrayNode(createNodeFactory()); if (config instanceof ObjectNode) { ObjectNode objectNode = (ObjectNode) config; objectNode.set("items", itemArray); } else { throw new IllegalArgumentException("config " + config + " is not a ObjectNode"); } } for (Object object : objects) { if (object != config) { addObjectsToItemArray(itemArray, object); } } return config; }