public class DotNotes extends Object
JsonNodes being passed in, either flattening, inflating
or processing recursively. Also provides access to several dot notation
utility methods, such as key parsing.| Modifier and Type | Method and Description |
|---|---|
static com.fasterxml.jackson.databind.JsonNode |
create(String path,
com.fasterxml.jackson.databind.JsonNode value)
A wrapper to $
create(String, JsonNode, JsonNode), simply passing
through parameters and appending `null` to the argument set. |
static com.fasterxml.jackson.databind.JsonNode |
create(String path,
com.fasterxml.jackson.databind.JsonNode value,
com.fasterxml.jackson.databind.JsonNode target)
Uses a dot-noted path in order to create a given value in the given leaf of a tree.
|
static com.fasterxml.jackson.databind.node.ObjectNode |
flatten(com.fasterxml.jackson.databind.JsonNode node)
Flattens a $
JsonNode down to a single level, using the $DotCursor
to iterate through the keys, setting the paths as keys in an $ObjectNode. |
static com.fasterxml.jackson.databind.JsonNode |
get(String path,
com.fasterxml.jackson.databind.JsonNode node)
Uses a String path to create a List of keys in order to move
through a nested $
JsonNode in order to find a specific
value. |
static com.fasterxml.jackson.databind.JsonNode |
inflate(com.fasterxml.jackson.databind.node.ObjectNode node)
A wrapper to $
inflate(ObjectNode, ObjectNode), simply passing
through parameters and appending `null` to the argument set. |
static com.fasterxml.jackson.databind.JsonNode |
inflate(com.fasterxml.jackson.databind.node.ObjectNode node,
com.fasterxml.jackson.databind.node.ObjectNode target)
Inflates an $
ObjectNode which has been flattened previously, returning a
$JsonNode. |
static List<NotedKey> |
keys(String s)
Takes a dot-noted String and converts it to a List of keys.
|
static void |
notedCursor(com.fasterxml.jackson.databind.JsonNode node,
NotedHandler handler)
Passes the $
JsonNode parameter and $NotedHandler to the
$DotCursor.recurse(JsonNode, NotedHandler, String) method to do
the heavy lifting. |
public static com.fasterxml.jackson.databind.JsonNode create(String path, com.fasterxml.jackson.databind.JsonNode value) throws ParseException
create(String, JsonNode, JsonNode), simply passing
through parameters and appending `null` to the argument set. It's a shorthand for lazy
programmers (myself included).path - the path to createvalue - the value to set the path toJsonNode after key creationParseException - if any parsing issues occurpublic static com.fasterxml.jackson.databind.JsonNode create(String path, com.fasterxml.jackson.databind.JsonNode value, com.fasterxml.jackson.databind.JsonNode target) throws ParseException
JsonNode from scratch, or be used to populate
a pre-existing one.path - the path to createvalue - the value to set the path totarget - the target $JsonNode to create intoJsonNode after key creationParseException - if any parsing issues occurpublic static com.fasterxml.jackson.databind.node.ObjectNode flatten(com.fasterxml.jackson.databind.JsonNode node)
JsonNode down to a single level, using the $DotCursor
to iterate through the keys, setting the paths as keys in an $ObjectNode.node - the $JsonNode to flattenObjectNodepublic static com.fasterxml.jackson.databind.JsonNode get(String path, com.fasterxml.jackson.databind.JsonNode node) throws ParseException
JsonNode in order to find a specific
value. If the value is found, it is returned. If it can not be
found, a $MissingNode will be returned.path - the path to find the value fornode - the node to use for the searchJsonNode if found, a $MissingNode if notParseException - if any parsing issues occurpublic static com.fasterxml.jackson.databind.JsonNode inflate(com.fasterxml.jackson.databind.node.ObjectNode node)
throws ParseException
inflate(ObjectNode, ObjectNode), simply passing
through parameters and appending `null` to the argument set. It's a shorthand for lazy
programmers (myself included).node - the $JsonNode to inflateJsonNode instanceParseException - if any parsing issues occurpublic static com.fasterxml.jackson.databind.JsonNode inflate(com.fasterxml.jackson.databind.node.ObjectNode node,
com.fasterxml.jackson.databind.node.ObjectNode target)
throws ParseException
ObjectNode which has been flattened previously, returning a
$JsonNode. Uses $create(String, JsonNode, JsonNode) in order to
take advantage of methods already available to us.node - the node being inflatedtarget - a potential target object to inflate intoJsonNodeParseException - if any parsing issues occurpublic static List<NotedKey> keys(String s) throws ParseException
NotedKeys
will be returned.s - the String to parseNotedKeysParseException - if any parsing issues occurpublic static void notedCursor(com.fasterxml.jackson.databind.JsonNode node,
NotedHandler handler)
JsonNode parameter and $NotedHandler to the
$DotCursor.recurse(JsonNode, NotedHandler, String) method to do
the heavy lifting. This method simply surfaces it to the outside world.node - the node to iterate throughhandler - the handler to use for processingCopyright © 2017. All rights reserved.