/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode addObject() { ObjectNode n = objectNode(); _add(n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode insertObject(int index) { ObjectNode n = objectNode(); _insert(index, n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode addObject() { ObjectNode n = objectNode(); _add(n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode insertObject(int index) { ObjectNode n = objectNode(); _insert(index, n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode insertObject(int index) { ObjectNode n = objectNode(); _insert(index, n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode addObject() { ObjectNode n = objectNode(); _add(n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode addObject() { ObjectNode n = objectNode(); _add(n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode addObject() { ObjectNode n = objectNode(); _add(n); return n; }
public JsonConfig(String json) throws Exception { ObjectMapper mapper = new ObjectMapper(); JsonNode nodex = mapper.readValue(json, JsonNode.class); if (nodex instanceof ObjectNode) node = (ObjectNode) nodex; else { node = ((ArrayNode)nodex).objectNode(); node.put("default", nodex); } }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode insertObject(int index) { ObjectNode n = objectNode(); _insert(index, n); return n; }
/** * Method that will construct an ObjectNode and add it at the end * of this array node. * * @return Newly constructed ObjectNode */ public ObjectNode insertObject(int index) { ObjectNode n = objectNode(); _insert(index, n); return n; }
public ArrayNode toJSON(Iterable<Map<String, Object>> result) { ArrayNode root = mapper.createArrayNode(); for (Map<String, Object> stringObjectMap : result) { ObjectNode entry = root.objectNode(); for (Map.Entry<String, Object> stringObjectEntry : stringObjectMap.entrySet()) { if (stringObjectEntry.getValue() instanceof Path) { entry.put(stringObjectEntry.getKey(), stringObjectEntry.getValue().toString()); } else if (stringObjectEntry.getValue() instanceof Node) { Node node = (Node) stringObjectEntry.getValue(); ObjectNode nodeNode = entry.objectNode(); nodeNode.put("_id", node.getId()); for (String propertyName : node.getPropertyKeys()) { addProperty(nodeNode, propertyName, node.getProperty(propertyName)); } entry.put(stringObjectEntry.getKey(), nodeNode); } else { addProperty(entry, stringObjectEntry.getKey(), stringObjectEntry.getValue()); } } root.add(entry); } return root; }
ObjectNode entry = root.objectNode();
ObjectNode obj = to.objectNode(); to.add(obj); for (Map.Entry<Object, Object> entry : ((Map<Object,Object>)value).entrySet()) { ObjectNode too = to.objectNode(); to.add(too); pojoToJson(value, too, factory, usePublic, level+1);
@Override public WritableResourceNode<IConfig> createConfig(String key) throws MException { // find array node, to append new config if (node.get(key) != null && !node.get(key).isArray()) { node.remove(key); } ArrayNode array = (ArrayNode) node.get(key); if (array == null) { // if not, create one array = node.arrayNode(); node.put(key, array); } if (! (array instanceof ArrayNode) ) { throw new MException(key + " is not an array"); } // create new object node in array ObjectNode out = array.objectNode(); array.add(out); return new JsonConfig(key, this, out); }