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 | Class and Description |
|---|---|
static class |
DotNotes.NodeIterator
A very small interface used for processing the iteration
through a set of path and key tuples.
|
| 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.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 List<NotedKey> |
keys(String s)
Takes a dot-noted String and converts it to a List of keys.
|
static void |
recurse(com.fasterxml.jackson.databind.JsonNode node,
DotNotes.NodeIterator handler)
A small wrapper to $
recurse(JsonNode, NodeIterator, String) to allow omitting
a third parameter, passing null instead. |
static void |
recurse(com.fasterxml.jackson.databind.JsonNode node,
DotNotes.NodeIterator handler,
String start)
Moves through the provided JsonNode, emitting values to the $
DotNotes.NodeIterator.execute(NotedKey, JsonNode, String)
method of a provided handler. |
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.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 List<NotedKey> keys(String s) throws ParseException
NotedKeys
will be returned.s - the String to parseNotedKeysParseException - if any parsing issues occurpublic static void recurse(com.fasterxml.jackson.databind.JsonNode node,
DotNotes.NodeIterator handler)
recurse(JsonNode, NodeIterator, String) to allow omitting
a third parameter, passing null instead.node - the node to passhandler - the handler to passpublic static void recurse(com.fasterxml.jackson.databind.JsonNode node,
DotNotes.NodeIterator handler,
String start)
DotNotes.NodeIterator.execute(NotedKey, JsonNode, String)
method of a provided handler. A prefix can be provided in order to start all paths with a custom prefix. Paths will
not be generated if $DotNotes.NodeIterator.requirePathGeneration() returns false.node - the node to iterate throughhandler - the handler to emit tostart - the starting prefix String, if anyCopyright © 2017. All rights reserved.