/** * Returns a cursor that iterates all the nodes under the given root, where * the root is an intermediate node in a Json document accessed by path 'p'. * Path can be empty, meaning the 'root' is the real document root. */ public static JsonNodeCursor cursor(JsonNode root, Path p) { return new JsonNodeCursor(p, root); }
/** * Returns a cursor that iterates all the nodes under the given root, where * the root is an intermediate node in a Json document accessed by path 'p'. * Path can be empty, meaning the 'root' is the real document root. */ public static JsonNodeCursor cursor(JsonNode root, Path p) { return new JsonNodeCursor(p, root); }
public static JsonNodeCursor cursor(JsonNode root, Path p) { return new JsonNodeCursor(p, root); }
private void flatten(String prefix, JsonNode node, List<PathAndValue> entityData) { if (node.size() == 0) { return; } JsonNodeCursor cursor = new JsonNodeCursor(Path.EMPTY, node); while(cursor.next()) { String p=cursor.getCurrentPath().toString(); JsonNode value=cursor.getCurrentNode(); if(value.isValueNode()) { String path = prefix.isEmpty() ? p : (prefix + "." + p); PathAndValue data = new PathAndValue(path, value.asText(null)); // TODO(ahenning): Consider using Set instead of List for entityData if (!entityData.contains(data)) { entityData.add(data); } } } }
protected void translate(final ObjectArrayElement objectArrayElement, JsonNode node, Object target) { JsonNodeCursor cursor = new JsonNodeCursor(objectArrayElement.getFullPath(), node); if(!cursor.firstChild()){ throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, cursor.getCurrentPath().toString()); } do { translate(cursor, target); } while (cursor.nextSibling()); }
protected void translate(final ObjectArrayElement objectArrayElement, JsonNode node, Object target) { JsonNodeCursor cursor = new JsonNodeCursor(objectArrayElement.getFullPath(), node); if(!cursor.firstChild()){ throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, cursor.getCurrentPath().toString()); } do { translate(cursor, target); } while (cursor.nextSibling()); }