| Constructor and Description |
|---|
JsonPointer()
Constructs a JSON pointer, identifying the root value of a JSON structure.
|
JsonPointer(Iterable<String> iterable)
Constructs a JSON pointer from an iterable collection of reference tokens.
|
JsonPointer(String... tokens)
Constructs a JSON pointer from an array of reference tokens.
|
JsonPointer(String pointer)
Constructs a JSON pointer, identifying the specified pointer value.
|
| Modifier and Type | Method and Description |
|---|---|
JsonPointer |
child(int child)
Returns a new JSON pointer, which identifies a specified child element of the
array identified by this pointer.
|
JsonPointer |
child(String child)
Returns a new JSON pointer, which identifies a specified child member of the
object identified by this pointer.
|
boolean |
equals(Object o)
Compares the specified object with this pointer for equality.
|
String |
get(int index)
Returns the reference token at the specified position.
|
int |
hashCode()
Returns the hash code value for this pointer.
|
boolean |
isEmpty()
Returns
true if this pointer identifies the root value of a JSON
structure. |
Iterator<String> |
iterator()
Returns an iterator over the pointer's reference tokens.
|
String |
leaf()
Returns the last (leaf) reference token of the JSON pointer, or
null if the
pointer contains no reference tokens (i.e. references document root). |
JsonPointer |
parent()
Returns a pointer to the parent of the JSON value identified by this JSON pointer,
or
null if the pointer has no parent JSON value (i.e. references document root). |
JsonPointer |
relativePointer()
Returns a pointer containing all but the first reference token contained
in this pointer, or
/ if this pointer contains less than 2
reference tokens. |
JsonPointer |
relativePointer(int sz)
Returns a pointer containing the last
sz reference tokens
contained in this pointer. |
int |
size()
Returns the number of reference tokens in the pointer.
|
String[] |
toArray()
Returns a newly allocated array of strings, containing the pointer's reference tokens.
|
String |
toString()
Returns the JSON pointer string value.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic JsonPointer()
public JsonPointer(String pointer)
pointer - a string containing the JSON pointer of the value to identify.JsonException - if the pointer is malformed.public JsonPointer(String... tokens)
tokens - an array of string reference tokens.public int size()
public String get(int index)
index - the index of the reference token to return.IndexOutOfBoundsException - if the index is out of range.public String[] toArray()
public JsonPointer parent()
null if the pointer has no parent JSON value (i.e. references document root).public JsonPointer relativePointer()
/ if this pointer contains less than 2
reference tokens.
This method yields the following results:
Input Output / / /a / /a/b /b /a/b/c /b/c
public JsonPointer relativePointer(int sz)
sz reference tokens
contained in this pointer.
This method yields the following results:
Input sz Output /a/b/c 0 / /a/b/c 1 /c /a/b/c 2 /b/c /a/b/c 3 /a/b/c
sz - The number of trailing reference tokens to retain.sz reference tokens
contained in this pointer.IndexOutOfBoundsException - If sz is negative or greater than size().public String leaf()
null if the
pointer contains no reference tokens (i.e. references document root).null otherwisepublic JsonPointer child(String child)
child - the name of the child member to identify.NullPointerException - if child is null.public JsonPointer child(int child)
child - the index of the child element to identify.IndexOutOfBoundsException - if child is less than zero.public boolean isEmpty()
true if this pointer identifies the root value of a JSON
structure. More specifically, it returns true if this pointer
does not contain any reference tokens (i.e. size() == 0).true if this pointer identifies the root value of a JSON
structure.public Iterator<String> iterator()
public String toString()
public boolean equals(Object o)
true if
and only if the specified object is also a JSON pointer, both pointers have the same
size, and all corresponding pairs of reference tokens in the two pointers are equal.Copyright © 2025 Open Identity Platform Community. All rights reserved.