/** * Returns a cursor that iterates all nodes of the document in a depth-first * manner */ public JsonNodeCursor cursor() { return cursor(Path.EMPTY); }
/** * Returns a cursor that iterates all nodes of the document in a depth first * manner, but uses <code>p</code> as a prefix to all the paths during * iteration. This method is meant to be used for a JsonDoc rooted at an * intermediate node in a Json node tree. */ public JsonNodeCursor cursor(Path p) { return cursor(docRoot, p); }
/** * Returns a cursor that iterates all nodes of the document in a depth first * manner, but uses <code>p</code> as a prefix to all the paths during * iteration. This method is meant to be used for a JsonDoc rooted at an * intermediate node in a Json node tree. */ public JsonNodeCursor cursor(Path p) { return cursor(docRoot, p); }
/** * Returns a cursor that iterates all nodes of the document in a depth-first * manner */ public JsonNodeCursor cursor() { return cursor(Path.EMPTY); }
public JsonNodeCursor cursor() { return cursor(Path.EMPTY); }
public JsonNodeCursor cursor(Path p) { return cursor(docRoot, p); }
private BasicDBObject toBson(JsonDoc doc, EntityMetadata md,ResultMetadata rmd) { LOGGER.debug("Entity: {}", md.getName()); BasicDBObject ret = null; JsonNodeCursor cursor = doc.cursor(); if (cursor.firstChild()) { ret = objectToBson(cursor, md,rmd); } return ret; }
private BasicDBObject toBson(JsonDoc doc, EntityMetadata md) { LOGGER.debug("Entity: {}", md.getName()); BasicDBObject ret = null; JsonNodeCursor cursor = doc.cursor(); if (cursor.firstChild()) { ret = objectToBson(cursor, md); } return ret; }
/** * Projects a document */ public JsonDoc project(JsonDoc doc, JsonNodeFactory factory) { JsonNodeCursor cursor = doc.cursor(); cursor.firstChild(); ObjectNode root = (ObjectNode) project(factory, rootMdPath, cursor, new QueryEvaluationContext(doc.getRoot()), false); if (root == null) { root = factory.objectNode(); } return new JsonDoc(root); }
/** * Projects a document */ public JsonDoc project(JsonDoc doc, JsonNodeFactory factory) { JsonNodeCursor cursor = doc.cursor(); cursor.firstChild(); ObjectNode root = (ObjectNode) project(factory, rootMdPath, cursor, new QueryEvaluationContext(doc.getRoot()), false); if (root == null) { root = factory.objectNode(); } return new JsonDoc(root); }
/** * Projects a document */ public JsonDoc project(JsonDoc doc, JsonNodeFactory factory) { JsonNodeCursor cursor = doc.cursor(); cursor.firstChild(); ObjectNode root = projectObject(this, factory, rootMdNode, rootMdPath, cursor, new QueryEvaluationContext(doc.getRoot())); return new JsonDoc(root); }
/** * Translates an entire {@link JsonDoc} to T. * @param document - {@link JsonDoc} * @param target - T */ public void translate(JsonDoc document, T target){ Error.push("translating from json"); try{ JsonNodeCursor cursor = document.cursor(); if (!cursor.firstChild()) { //TODO throw exception? return; } do { translate(cursor, target); } while (cursor.nextSibling()); } finally{ Error.pop(); } }
/** * Translates an entire {@link JsonDoc} to T. * @param document - {@link JsonDoc} * @param target - T */ public void translate(JsonDoc document, T target){ Error.push("translating from json"); try{ JsonNodeCursor cursor = document.cursor(); if (!cursor.firstChild()) { //TODO throw exception? return; } do { translate(cursor, target); } while (cursor.nextSibling()); } finally{ Error.pop(); } }