@Immutable public final class JsonPointer extends TreePointer<JsonNode>
TreePointer
for JsonNode
This is the "original" JSON Pointer in that it addresses JSON documents.
It also has a lot of utility methods covering several usage scenarios.
BUNDLE, tokenResolvers
Constructor and Description |
---|
JsonPointer(List<TokenResolver<JsonNode>> tokenResolvers)
Alternate constructor
|
JsonPointer(String input)
The main constructor
|
Modifier and Type | Method and Description |
---|---|
JsonPointer |
append(int index)
Return a new pointer with a new integer token appended
|
JsonPointer |
append(JsonPointer other)
Return a new pointer with another pointer appended
|
JsonPointer |
append(String raw)
Return a new pointer with a new token appended
|
static JsonPointer |
empty()
Return an empty JSON Pointer
|
static JsonPointer |
of(Object first,
Object... other)
Build a JSON Pointer out of a series of reference tokens
|
JsonPointer |
parent()
Return the immediate parent of this JSON Pointer
|
equals, get, hashCode, isEmpty, iterator, path, tokensFromInput, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public JsonPointer(String input) throws JsonPointerException
input
- the input stringJsonPointerException
- malformed JSON PointerNullPointerException
- null inputpublic JsonPointer(List<TokenResolver<JsonNode>> tokenResolvers)
This calls TreePointer.TreePointer(TreeNode, List)
with a
MissingNode
as the missing tree node.
tokenResolvers
- the list of token resolverspublic static JsonPointer empty()
public static JsonPointer of(Object first, Object... other)
These tokens can be everything; be sure however that they implement
Object.toString()
correctly!
Each of these tokens are treated as raw tokens (ie, not encoded).
first
- the first tokenother
- other tokensNullPointerException
- one input token is nullpublic JsonPointer append(String raw)
raw
- the raw token to appendNullPointerException
- input is nullpublic JsonPointer append(int index)
index
- the integer token to appendpublic JsonPointer append(JsonPointer other)
other
- the other pointerNullPointerException
- other pointer is nullpublic JsonPointer parent()
The parent of the empty pointer is itself.