Class AbstractJsonPointer

java.lang.Object
com.flipkart.zjsonpatch.AbstractJsonPointer
Direct Known Subclasses:
Jackson3JsonPointer, JsonPointer

public abstract sealed class AbstractJsonPointer extends Object permits JsonPointer, Jackson3JsonPointer
Since:
0.6.0
Author:
Mariusz Sondecki
  • Constructor Details

    • AbstractJsonPointer

      protected AbstractJsonPointer(RefToken[] tokens)
    • AbstractJsonPointer

      protected AbstractJsonPointer(List<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 Details

    • createInstance

      protected abstract AbstractJsonPointer createInstance(RefToken[] tokens)
    • 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.
    • getTokens

      protected RefToken[] getTokens()
    • parseTokens

      protected static List<RefToken> parseTokens(String path) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • 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<RefToken> decompose()
      Decomposes this JSON pointer into its reference tokens.
      Returns:
      A list of RefTokens. Modifications to this list do not affect this instance.
    • get

      public 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 RefToken.
      Throws:
      IndexOutOfBoundsException - The specified index is illegal.
    • last

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object