Class JsonPointer
- java.lang.Object
-
- io.vertx.reactivex.core.json.pointer.JsonPointer
-
- All Implemented Interfaces:
io.vertx.lang.rx.RxDelegate
public class JsonPointer extends Object implements io.vertx.lang.rx.RxDelegate
Implementation of RFC6901 Json Pointers.NOTE: This class has been automatically generated from the
originalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static io.vertx.lang.rx.TypeArg<JsonPointer>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description JsonPointer(JsonPointer delegate)JsonPointer(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonPointerappend(int index)Append theindexas reference token to JsonPointerJsonPointerappend(JsonPointer pointer)Append all tokens ofpointerto this pointer
Note: The base URI of this pointer will remain untouchedJsonPointerappend(String token)Append an unescapedtokento this pointer
Note: If you provide escaped path the behaviour is undefinedJsonPointerappend(List<String> tokens)Append an unescaped list oftokensto JsonPointer
Note: If you provide escaped paths the behaviour is undefinedJsonPointercopy()Copy a JsonPointerstatic JsonPointercreate()Build an empty JsonPointerbooleanequals(Object o)static JsonPointerfrom(String pointer)Build a JsonPointer from a json pointer stringstatic JsonPointerfromURI(URI uri)Build a JsonPointer from a URI.JsonPointergetDelegate()URIgetURIWithoutFragment()Return the underlying URI without the fragmentinthashCode()booleanisLocalPointer()Returntrueif the pointer is local (URI with only fragment)booleanisParent(JsonPointer child)Returntrueif this pointer is a parent pointer ofchild.booleanisRootPointer()Returntrueif the pointer is a root pointerstatic JsonPointernewInstance(JsonPointer arg)JsonPointerparent()Remove last reference token of this pointerObjectquery(Object objectToQuery, JsonPointerIterator iterator)QueryobjectToQueryusing the providedJsonPointerIterator.ObjectqueryJson(Object jsonElement)QueryjsonElement.ObjectqueryJsonOrDefault(Object jsonElement, Object defaultValue)QueryjsonElement.ObjectqueryOrDefault(Object objectToQuery, JsonPointerIterator iterator, Object defaultValue)QueryobjectToQueryusing the providedJsonPointerIterator.StringtoString()Build a string representation of the JSON PointerURItoURI()Build a URI representation of the JSON PointerList<Object>tracedQuery(Object objectToQuery, JsonPointerIterator iterator)QueryobjectToQuerytracing 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 encounteredObjectwrite(Object objectToWrite, JsonPointerIterator iterator, Object newElement, boolean createOnMissing)WritenewElementinobjectToWriteusing this pointer.ObjectwriteJson(Object jsonElement, Object newElement)WritenewElementinjsonElementusing this pointer.ObjectwriteJson(Object jsonElement, Object newElement, boolean createOnMissing)WritenewElementinjsonElementusing this pointer.
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<JsonPointer> __TYPE_ARG
-
-
Constructor Detail
-
JsonPointer
public JsonPointer(JsonPointer delegate)
-
JsonPointer
public JsonPointer(Object delegate)
-
-
Method Detail
-
getDelegate
public JsonPointer getDelegate()
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate
-
isRootPointer
public boolean isRootPointer()
Returntrueif the pointer is a root pointer- Returns:
-
isLocalPointer
public boolean isLocalPointer()
Returntrueif the pointer is local (URI with only fragment)- Returns:
-
isParent
public boolean isParent(JsonPointer child)
Returntrueif this pointer is a parent pointer ofchild.
For instance"/properties"pointer is parent pointer of"/properties/parent"- Parameters:
child-- Returns:
-
toString
public String toString()
Build a string representation of the JSON Pointer
-
append
public JsonPointer append(String token)
Append an unescapedtokento this pointer
Note: If you provide escaped path the behaviour is undefined- Parameters:
token- the unescaped reference token- Returns:
- a reference to this, so the API can be used fluently
-
append
public JsonPointer append(int index)
Append theindexas reference token to JsonPointer- Parameters:
index-- Returns:
- a reference to this, so the API can be used fluently
-
append
public JsonPointer append(List<String> tokens)
Append an unescaped list oftokensto JsonPointer
Note: If you provide escaped paths the behaviour is undefined- Parameters:
tokens- unescaped reference tokens- Returns:
- a reference to this, so the API can be used fluently
-
append
public JsonPointer append(JsonPointer pointer)
Append all tokens ofpointerto this pointer
Note: The base URI of this pointer will remain untouched- Parameters:
pointer- other pointer- Returns:
- a reference to this, so the API can be used fluently
-
parent
public JsonPointer parent()
Remove last reference token of this pointer- Returns:
- a reference to this, so the API can be used fluently
-
query
public Object query(Object objectToQuery, JsonPointerIterator iterator)
QueryobjectToQueryusing the providedJsonPointerIterator.
If you need to query Vert.x json data structures, usequeryJson(java.lang.Object)
Note: if this pointer is a root pointer, this function returns the provided object- Parameters:
objectToQuery- the object to queryiterator- the json pointer iterator that provides the logic to access to the objectToQuery- Returns:
- null if pointer points to not existing value, otherwise the requested value
-
queryOrDefault
public Object queryOrDefault(Object objectToQuery, JsonPointerIterator iterator, Object defaultValue)
QueryobjectToQueryusing the providedJsonPointerIterator. If the query result is null, returns the default.
If you need to query Vert.x json data structures, usequeryJsonOrDefault(java.lang.Object, java.lang.Object)
Note: if this pointer is a root pointer, this function returns the provided object- Parameters:
objectToQuery- the object to queryiterator- the json pointer iterator that provides the logic to access to the objectToQuerydefaultValue- default value if query result is null- Returns:
- null if pointer points to not existing value, otherwise the requested value
-
queryJson
public Object queryJson(Object jsonElement)
QueryjsonElement.
Note: if this pointer is a root pointer, this function returns the provided json element- Parameters:
jsonElement- the json element to query- Returns:
- null if pointer points to not existing value, otherwise the requested value
-
queryJsonOrDefault
public Object queryJsonOrDefault(Object jsonElement, Object defaultValue)
QueryjsonElement. If the query result is null, returns the default.
Note: if this pointer is a root pointer, this function returns the provided object- Parameters:
jsonElement- the json element to querydefaultValue- default value if query result is null- Returns:
- null if pointer points to not existing value, otherwise the requested value
-
tracedQuery
public List<Object> tracedQuery(Object objectToQuery, JsonPointerIterator iterator)
QueryobjectToQuerytracing 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- Parameters:
objectToQuery- the object to queryiterator- the json pointer iterator that provides the logic to access to the objectToQuery- Returns:
- the stream of walked elements
-
write
public Object write(Object objectToWrite, JsonPointerIterator iterator, Object newElement, boolean createOnMissing)
WritenewElementinobjectToWriteusing this pointer. The path token "-" is handled as append to end of array
If you need to write in Vert.x json data structures, usewriteJson(java.lang.Object, java.lang.Object)(Object)}- Parameters:
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 index- Returns:
- a reference to objectToWrite if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed
-
writeJson
public Object writeJson(Object jsonElement, Object newElement)
WritenewElementinjsonElementusing this pointer. The path token "-" is handled as append to end of array.- Parameters:
jsonElement- json element to query and writenewElement- json to insert- Returns:
- a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed
-
writeJson
public Object writeJson(Object jsonElement, Object newElement, boolean createOnMissing)
WritenewElementinjsonElementusing this pointer. The path token "-" is handled as append to end of array.- Parameters:
jsonElement- json to query and writenewElement- json to insertcreateOnMissing- create JsonObject when missing a object key or an array index- Returns:
- a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed
-
copy
public JsonPointer copy()
Copy a JsonPointer- Returns:
- a copy of this pointer
-
create
public static JsonPointer create()
Build an empty JsonPointer- Returns:
- a new empty JsonPointer
-
from
public static JsonPointer from(String pointer)
Build a JsonPointer from a json pointer string- Parameters:
pointer- the string representing a pointer- Returns:
- new instance of JsonPointer
-
toURI
public URI toURI()
Build a URI representation of the JSON Pointer- Returns:
-
getURIWithoutFragment
public URI getURIWithoutFragment()
Return the underlying URI without the fragment- Returns:
-
fromURI
public static JsonPointer fromURI(URI uri)
Build a JsonPointer from a URI.- Parameters:
uri- uri representing a json pointer- Returns:
- new instance of JsonPointer
-
newInstance
public static JsonPointer newInstance(JsonPointer arg)
-
-