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 class JSONRef.Companion
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONRef(J base)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final JSONPointer getPointer() The JSONPointer corresponding to this reference.
      final JSONValue getBase()
      final J getNode()
      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 null if 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> Boolean isRef() Test whether reference refers to a nominated type.
      Boolean equals(Object other)
      Integer hashCode()
      String toString()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JSONRef

        JSONRef(J base)
    • Method Detail

      • 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.

      • 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 null if 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.