Class JSONPointer
-
- All Implemented Interfaces:
public final class JSONPointerJSON Pointer.
Peter Wall
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classJSONPointer.Companion
-
Constructor Summary
Constructors Constructor Description JSONPointer(String pointer)Construct a JSONPointerfrom the suppliedString, which must consist of zero or more tokens representing either an object property name or an array index, with each token preceded by a slash (/).
-
Method Summary
Modifier and Type Method Description final IntegergetDepth()final StringgetCurrent()final BooleanisRoot()final Array<String>tokensAsArray()Get the tokens that make up this pointer as an Array. final List<String>tokensAsList()Get the tokens that make up this pointer as a List. final JSONPointerparent()Return a new JSONPointerreferencing the parent object or array of the value referenced by this pointer.final JSONPointerchild(String string)Return a new JSONPointerreferencing the nominated child property of the object referenced by this pointer.final JSONPointerchild(Integer index)Return a new JSONPointerreferencing the nominated child item of the array referenced by this pointer.final JSONPointerchild(JSONPointer childPointer)Return a new JSONPointerconcatenating this pointer with a child pointer.final JSONPointerwithParent(String string)Return a new JSONPointerconcatenating a parent element name with this pointer.final JSONPointerwithParent(Integer index)Return a new JSONPointerconcatenating a parent array index with this pointer.final JSONPointerwithParent(JSONPointer parent)Return a new JSONPointerconcatenating a parent pointer with this pointer.final JSONPointerplus(String string)Return a new JSONPointerconcatenating this pointer with a child element name.final JSONPointerplus(Integer index)Return a new JSONPointerconcatenating this pointer with a child array index.final JSONPointerplus(JSONPointer childPointer)Return a new JSONPointerconcatenating this pointer with a child pointer.final JSONPointertruncate(Integer n)Truncate the pointer to the first n tokens. final StringtoURIFragment()Convert the JSONPointerto a form suitable for use in a URI fragment.final StringgetToken(Integer index)Get the token at the specified index. final VoidthrowPointerException(String text)Throw a JSONPointerException with this pointer as the key. final StringtoString(Integer numTokens)Create the string form of this pointer using the first n tokens. StringtoString()Booleanequals(Object other)IntegerhashCode()-
-
Constructor Detail
-
JSONPointer
JSONPointer(String pointer)
Construct aJSONPointerfrom the suppliedString, which must consist of zero or more tokens representing either an object property name or an array index, with each token preceded by a slash (/).
-
-
Method Detail
-
getCurrent
final String getCurrent()
-
tokensAsArray
final Array<String> tokensAsArray()
Get the tokens that make up this pointer as an Array.
-
tokensAsList
final List<String> tokensAsList()
Get the tokens that make up this pointer as a List.
-
parent
final JSONPointer parent()
Return a new
JSONPointerreferencing the parent object or array of the value referenced by this pointer.
-
child
final JSONPointer child(String string)
Return a new
JSONPointerreferencing the nominated child property of the object referenced by this pointer.
-
child
final JSONPointer child(Integer index)
Return a new
JSONPointerreferencing the nominated child item of the array referenced by this pointer.
-
child
final JSONPointer child(JSONPointer childPointer)
Return a new
JSONPointerconcatenating this pointer with a child pointer.
-
withParent
final JSONPointer withParent(String string)
Return a new
JSONPointerconcatenating a parent element name with this pointer.
-
withParent
final JSONPointer withParent(Integer index)
Return a new
JSONPointerconcatenating a parent array index with this pointer.
-
withParent
final JSONPointer withParent(JSONPointer parent)
Return a new
JSONPointerconcatenating a parent pointer with this pointer.
-
plus
final JSONPointer plus(String string)
Return a new
JSONPointerconcatenating this pointer with a child element name.
-
plus
final JSONPointer plus(Integer index)
Return a new
JSONPointerconcatenating this pointer with a child array index.
-
plus
final JSONPointer plus(JSONPointer childPointer)
Return a new
JSONPointerconcatenating this pointer with a child pointer.
-
truncate
final JSONPointer truncate(Integer n)
Truncate the pointer to the first n tokens.
-
toURIFragment
final String toURIFragment()
Convert the
JSONPointerto a form suitable for use in a URI fragment. This means applying not only the JSON Pointer escaping rules, but also encoding into UTF-8 and then applying URI percent encoding.
-
throwPointerException
final Void throwPointerException(String text)
Throw a JSONPointerException with this pointer as the key.
-
toString
final String toString(Integer numTokens)
Create the string form of this pointer using the first n tokens.
-
-
-
-