public interface JsonTree extends AsJson
This is a JsonNode
with an internal, modifiable path represented
as a JsonPointer
. The current path and node are retrievable.
There are two operations to modify the current path:
append(JsonPointer)
will append a pointer to the current
path (like a relative cd
);pop()
will get back to the previous path.An initialized tree always starts at the root of the wrapped JSON
document. If the current pointer points to a non existent path in the
document, the retrieved node is a MissingNode
.
Finally, remember that JSON Pointers are always absolute, which
means that appending ..
over /a/b
will not lead to /a
, but /a/b/..
. ..
is a perfectly valid member name for
a JSON Object!
JsonPointer
Modifier and Type | Method and Description |
---|---|
void |
append(JsonPointer ptr)
Append a JSON Pointer to the current path
|
JsonNode |
getCurrentNode()
Get the node at the current path
|
JsonPointer |
getCurrentPointer()
Get the current path into the document
|
void |
pop()
Reverts the last append
|
void append(JsonPointer ptr)
ptr
- the pointer to appendJsonPointer.append(JsonPointer)
void pop()
Note: this operation will fail badly if you haven't appended anything, so use with care!
JsonPointer getCurrentPointer()
JsonNode getCurrentNode()
MissingNode
if there is no matching
node at that pointer)Copyright © 2013. All Rights Reserved.