public interface JsonPointer
Modifier and Type | Method and Description |
---|---|
JsonPointer |
append(int index)
Append the
index as reference token to JsonPointer |
JsonPointer |
append(JsonPointer pointer)
Append all tokens of
pointer to this pointer Note: The base URI of this pointer will remain untouched |
JsonPointer |
append(List<String> tokens)
Append an unescaped list of
tokens to JsonPointer Note: If you provide escaped paths the behaviour is undefined |
JsonPointer |
append(String token)
Append an unescaped
token to this pointer Note: If you provide escaped path the behaviour is undefined |
JsonPointer |
copy()
Copy a JsonPointer
|
static JsonPointer |
create()
Build an empty JsonPointer
|
static JsonPointer |
from(String pointer)
Build a JsonPointer from a json pointer string
|
static JsonPointer |
fromURI(URI uri)
Build a JsonPointer from a URI.
|
URI |
getURIWithoutFragment()
Return the underlying URI without the fragment
|
boolean |
isLocalPointer()
Return
true if the pointer is local (URI with only fragment) |
boolean |
isParent(JsonPointer child)
Return
true if this pointer is a parent pointer of child . |
boolean |
isRootPointer()
Return
true if the pointer is a root pointer |
JsonPointer |
parent()
Remove last reference token of this pointer
|
default Object |
query(Object objectToQuery,
JsonPointerIterator iterator)
Query
objectToQuery using the provided JsonPointerIterator . |
default Object |
queryJson(Object jsonElement)
Query
jsonElement . |
default Object |
queryJsonOrDefault(Object jsonElement,
Object defaultValue)
Query
jsonElement . |
Object |
queryOrDefault(Object objectToQuery,
JsonPointerIterator iterator,
Object defaultValue)
Query
objectToQuery using the provided JsonPointerIterator . |
String |
toString()
Build a string representation of the JSON Pointer
|
URI |
toURI()
Build a URI representation of the JSON Pointer
|
List<Object> |
tracedQuery(Object objectToQuery,
JsonPointerIterator iterator)
Query
objectToQuery tracing each element walked during the query, including the first and the result (if any).The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered |
Object |
write(Object objectToWrite,
JsonPointerIterator iterator,
Object newElement,
boolean createOnMissing)
Write
newElement in objectToWrite using this pointer. |
default Object |
writeJson(Object jsonElement,
Object newElement)
Write
newElement in jsonElement using this pointer. |
default Object |
writeJson(Object jsonElement,
Object newElement,
boolean createOnMissing)
Write
newElement in jsonElement using this pointer. |
boolean isRootPointer()
true
if the pointer is a root pointerboolean isLocalPointer()
true
if the pointer is local (URI with only fragment)boolean isParent(JsonPointer child)
true
if this pointer is a parent pointer of child
.
"/properties"
pointer is parent pointer of "/properties/parent"
child
- String toString()
URI toURI()
URI getURIWithoutFragment()
JsonPointer append(String token)
token
to this pointer token
- the unescaped reference tokenJsonPointer append(int index)
index
as reference token to JsonPointerindex
- JsonPointer append(List<String> tokens)
tokens
to JsonPointer tokens
- unescaped reference tokensJsonPointer append(JsonPointer pointer)
pointer
to this pointer pointer
- other pointerJsonPointer parent()
default Object query(Object objectToQuery, JsonPointerIterator iterator)
objectToQuery
using the provided JsonPointerIterator
. queryJson(Object)
objectToQuery
- the object to queryiterator
- the json pointer iterator that provides the logic to access to the objectToQueryObject queryOrDefault(Object objectToQuery, JsonPointerIterator iterator, Object defaultValue)
objectToQuery
using the provided JsonPointerIterator
. If the query result is null, returns the default. queryJsonOrDefault(Object, Object)
objectToQuery
- the object to queryiterator
- the json pointer iterator that provides the logic to access to the objectToQuerydefaultValue
- default value if query result is nulldefault Object queryJson(Object jsonElement)
jsonElement
. jsonElement
- the json element to querydefault Object queryJsonOrDefault(Object jsonElement, Object defaultValue)
jsonElement
. If the query result is null, returns the default.jsonElement
- the json element to querydefaultValue
- default value if query result is nullList<Object> tracedQuery(Object objectToQuery, JsonPointerIterator iterator)
objectToQuery
tracing each element walked during the query, including the first and the result (if any).objectToQuery
- the object to queryiterator
- the json pointer iterator that provides the logic to access to the objectToQueryObject write(Object objectToWrite, JsonPointerIterator iterator, Object newElement, boolean createOnMissing)
newElement
in objectToWrite
using this pointer. The path token "-" is handled as append to end of array writeJson(Object, Object)
(Object)}objectToWrite
- object to writeiterator
- the json pointer iterator that provides the logic to access to the objectToMutatenewElement
- object to insertcreateOnMissing
- create objects when missing a object key or an array indexdefault Object writeJson(Object jsonElement, Object newElement)
newElement
in jsonElement
using this pointer. The path token "-" is handled as append to end of array.jsonElement
- json element to query and writenewElement
- json to insertdefault Object writeJson(Object jsonElement, Object newElement, boolean createOnMissing)
newElement
in jsonElement
using this pointer. The path token "-" is handled as append to end of array.jsonElement
- json to query and writenewElement
- json to insertcreateOnMissing
- create JsonObject when missing a object key or an array indexJsonPointer copy()
static JsonPointer create()
static JsonPointer from(String pointer)
pointer
- the string representing a pointerIllegalArgumentException
- if the pointer provided is not validstatic JsonPointer fromURI(URI uri)
uri
- uri representing a json pointerIllegalArgumentException
- if the pointer provided is not validCopyright © 2022 Eclipse. All rights reserved.