Class JsonPointer

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static JsonPointer ROOT
      A JSON pointer representing the root node of a JSON document
    • Constructor Summary

      Constructors 
      Constructor Description
      JsonPointer​(List<io.fabric8.zjsonpatch.JsonPointer.RefToken> tokens)
      Constructs a new pointer from a list of reference tokens.
    • Field Detail

      • ROOT

        public static final JsonPointer ROOT
        A JSON pointer representing the root node of a JSON document
    • Constructor Detail

      • JsonPointer

        public JsonPointer​(List<io.fabric8.zjsonpatch.JsonPointer.RefToken> tokens)
        Constructs a new pointer from a list of reference tokens.
        Parameters:
        tokens - The list of reference tokens from which to construct the new pointer. This list is not modified.
    • Method Detail

      • isRoot

        public boolean isRoot()
        Indicates whether or not this instance points to the root of a JSON document.
        Returns:
        true if this pointer represents the root node, false otherwise.
      • toString

        public String toString()
        Returns a string representation of this instance
        Overrides:
        toString in class Object
        Returns:
        An RFC 6901 compliant string representation of this JSON pointer.
      • decompose

        public List<io.fabric8.zjsonpatch.JsonPointer.RefToken> decompose()
        Decomposes this JSON pointer into its reference tokens.
        Returns:
        A list of JsonPointer.RefTokens. Modifications to this list do not affect this instance.
      • get

        public io.fabric8.zjsonpatch.JsonPointer.RefToken get​(int index)
                                                       throws IndexOutOfBoundsException
        Retrieves the reference token at the specified index.
        Parameters:
        index - The desired reference token index.
        Returns:
        The specified instance of JsonPointer.RefToken.
        Throws:
        IndexOutOfBoundsException - The specified index is illegal.
      • last

        public io.fabric8.zjsonpatch.JsonPointer.RefToken last()
        Retrieves the last reference token for this JSON pointer.
        Returns:
        The last JsonPointer.RefToken comprising this instance.
        Throws:
        IllegalStateException - Last cannot be called on root pointers.
      • getParent

        public JsonPointer getParent()
        Creates a JSON pointer to the parent of the node represented by this instance. The parent of the root pointer is the root pointer itself.
        Returns:
        A JsonPointer to the parent node.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object