Package io.kjson.pointer
Class JSONRef
-
- All Implemented Interfaces:
public final class JSONRef<J extends JSONValue>A reference to a JSON value of a specified type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classJSONRef.Companion
-
Field Summary
Fields Modifier and Type Field Description private final JSONPointerpointerprivate final JSONValuebaseprivate final Jnodepublic final static JSONRef.CompanionCompanion
-
Method Summary
Modifier and Type Method Description final JSONPointergetPointer()The JSONPointer corresponding to this reference. final JSONValuegetBase()final JgetNode()final <T extends JSONStructure<?>> JSONRef<T>parent()Get the parent reference of this reference. final <T extends JSONStructure<?>> JSONRef<T>parent(Function1<JSONValue, T> checkType)Get the parent reference of this reference (using a supplied checking function to confirm the type). final <T extends JSONValue> JSONRef<T>createTypedChildRef(String token, JSONValue targetNode)Create a child reference, checking the type of the target node. final <T extends JSONValue> JSONRef<T>createChildRef(String token, T targetNode)Create a child reference. final <T extends JSONValue> JSONRef<T>locateChild(T target)Locate the specified target JSONValue in the structure below this reference and return a reference to it, or nullif not found.final <T extends JSONValue> JSONRef<T>asRef(String nodeName)"Downcast" a reference to a particular type, or throw an exception if the target is not of that type. final <T extends JSONValue> BooleanisRef()Test whether reference refers to a nominated type. Booleanequals(Object other)IntegerhashCode()StringtoString()-
-
Constructor Detail
-
JSONRef
JSONRef(J base)
-
-
Method Detail
-
getPointer
final JSONPointer getPointer()
The JSONPointer corresponding to this reference.
-
getBase
final JSONValue getBase()
-
parent
final <T extends JSONStructure<?>> JSONRef<T> parent()
Get the parent reference of this reference.
-
parent
final <T extends JSONStructure<?>> JSONRef<T> parent(Function1<JSONValue, T> checkType)
Get the parent reference of this reference (using a supplied checking function to confirm the type).
-
createTypedChildRef
final <T extends JSONValue> JSONRef<T> createTypedChildRef(String token, JSONValue targetNode)
Create a child reference, checking the type of the target node.
-
createChildRef
final <T extends JSONValue> JSONRef<T> createChildRef(String token, T targetNode)
Create a child reference.
-
locateChild
final <T extends JSONValue> JSONRef<T> locateChild(T target)
Locate the specified target JSONValue in the structure below this reference and return a reference to it, or
nullif not found.This will perform a depth-first search of the JSON structure.
-
asRef
final <T extends JSONValue> JSONRef<T> asRef(String nodeName)
"Downcast" a reference to a particular type, or throw an exception if the target is not of that type.
-
isRef
final <T extends JSONValue> Boolean isRef()
Test whether reference refers to a nominated type.
-
-
-
-