io.vertx.core.json.pointer

## Interface JsonPointer

-     public interface JsonPointer

  Implementation of RFC6901 Json Pointers.
  Author:
    Francesco Guardiani @slinkydeveloper

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `JsonPointer` | `append(int index)` Append the `index` as reference token to JsonPointer
    `JsonPointer` | `append(JsonPointer pointer)` Append all tokens of `pointer` to this pointer Note: The base URI of this pointer will remain untouched
    `JsonPointer` | `append(List<String> tokens)` Append an unescaped list of `tokens` to JsonPointer Note: If you provide escaped paths the behaviour is undefined
    `JsonPointer` | `append(String token)` Append an unescaped `token` to this pointer Note: If you provide escaped path the behaviour is undefined
    `JsonPointer` | `copy()` Copy a JsonPointer
    `static JsonPointer` | `create()` Build an empty JsonPointer
    `static JsonPointer` | `from(String pointer)` Build a JsonPointer from a json pointer string
    `static JsonPointer` | `fromURI(URI uri)` Build a JsonPointer from a URI.
    `URI` | `getURIWithoutFragment()` Return the underlying URI without the fragment
    `boolean` | `isLocalPointer()` Return `true` if the pointer is local (URI with only fragment)
    `boolean` | `isParent(JsonPointer child)` Return `true` if this pointer is a parent pointer of `child`.
    `boolean` | `isRootPointer()` Return `true` if the pointer is a root pointer
    `JsonPointer` | `parent()` Remove last reference token of this pointer
    `default Object` | `query(Object objectToQuery, JsonPointerIterator iterator)` Query `objectToQuery` using the provided `JsonPointerIterator`.
    `default Object` | `queryJson(Object jsonElement)` Query `jsonElement`.
    `default Object` | `queryJsonOrDefault(Object jsonElement, Object defaultValue)` Query `jsonElement`.
    `Object` | `queryOrDefault(Object objectToQuery, JsonPointerIterator iterator, Object defaultValue)` Query `objectToQuery` using the provided `JsonPointerIterator`.
    `String` | `toString()` Build a string representation of the JSON Pointer
    `URI` | `toURI()` Build a URI representation of the JSON Pointer
    `List<Object>` | `tracedQuery(Object objectToQuery, JsonPointerIterator iterator)` Query `objectToQuery` tracing each element walked during the query, including the first and the result (if any). The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered
    `Object` | `write(Object objectToWrite, JsonPointerIterator iterator, Object newElement, boolean createOnMissing)` Write `newElement` in `objectToWrite` using this pointer.
    `default Object` | `writeJson(Object jsonElement, Object newElement)` Write `newElement` in `jsonElement` using this pointer.
    `default Object` | `writeJson(Object jsonElement, Object newElement, boolean createOnMissing)` Write `newElement` in `jsonElement` using this pointer.

- - ### Method Detail

    - #### isRootPointer

          boolean isRootPointer()

      Return `true` if the pointer is a root pointer

    - #### isLocalPointer

          boolean isLocalPointer()

      Return `true` if the pointer is local (URI with only fragment)

    - #### isParent

          boolean isParent(JsonPointer child)

      Return `true` if this pointer is a parent pointer of `child`.
      For instance `"/properties"` pointer is parent pointer of `"/properties/parent"`
      Parameters:
        `child` -

    - #### toString

          String toString()

      Build a string representation of the JSON Pointer
      Overrides:
        `toString` in class `Object`

    - #### toURI

          URI toURI()

      Build a URI representation of the JSON Pointer

    - #### getURIWithoutFragment

          URI getURIWithoutFragment()

      Return the underlying URI without the fragment

    - #### append

          JsonPointer append(String token)

      Append an unescaped `token` to this pointer
      Note: If you provide escaped path the behaviour is undefined
      Parameters:
        `token` - the unescaped reference token
      Returns:
        a reference to this, so the API can be used fluently

    - #### append

          JsonPointer append(int index)

      Append the `index` as reference token to JsonPointer
      Parameters:
        `index` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### append

          JsonPointer append(List<String> tokens)

      Append an unescaped list of `tokens` to JsonPointer
      Note: If you provide escaped paths the behaviour is undefined
      Parameters:
        `tokens` - unescaped reference tokens
      Returns:
        a reference to this, so the API can be used fluently

    - #### append

          JsonPointer append(JsonPointer pointer)

      Append all tokens of `pointer` to this pointer
      Note: The base URI of this pointer will remain untouched
      Parameters:
        `pointer` - other pointer
      Returns:
        a reference to this, so the API can be used fluently

    - #### parent

          JsonPointer parent()

      Remove last reference token of this pointer
      Returns:
        a reference to this, so the API can be used fluently

    - #### query

          default Object query(Object objectToQuery,
                               JsonPointerIterator iterator)

      Query `objectToQuery` using the provided `JsonPointerIterator`.
      If you need to query Vert.x json data structures, use `queryJson(Object)`
      Note: if this pointer is a root pointer, this function returns the provided object
      Parameters:
        `objectToQuery` - the object to query
        `iterator` - the json pointer iterator that provides the logic to access to the objectToQuery
      Returns:
        null if pointer points to not existing value, otherwise the requested value

    - #### queryOrDefault

          Object queryOrDefault(Object objectToQuery,
                                JsonPointerIterator iterator,
                                Object defaultValue)

      Query `objectToQuery` using the provided `JsonPointerIterator`. If the query result is null, returns the default.
      If you need to query Vert.x json data structures, use `queryJsonOrDefault(Object, Object)`
      Note: if this pointer is a root pointer, this function returns the provided object
      Parameters:
        `objectToQuery` - the object to query
        `iterator` - the json pointer iterator that provides the logic to access to the objectToQuery
        `defaultValue` - default value if query result is null
      Returns:
        null if pointer points to not existing value, otherwise the requested value

    - #### queryJson

          default Object queryJson(Object jsonElement)

      Query `jsonElement`.
      Note: if this pointer is a root pointer, this function returns the provided json element
      Parameters:
        `jsonElement` - the json element to query
      Returns:
        null if pointer points to not existing value, otherwise the requested value

    - #### queryJsonOrDefault

          default Object queryJsonOrDefault(Object jsonElement,
                                            Object defaultValue)

      Query `jsonElement`. If the query result is null, returns the default.
      Note: if this pointer is a root pointer, this function returns the provided object
      Parameters:
        `jsonElement` - the json element to query
        `defaultValue` - default value if query result is null
      Returns:
        null if pointer points to not existing value, otherwise the requested value

    - #### tracedQuery

          List<Object> tracedQuery(Object objectToQuery,
                                   JsonPointerIterator iterator)

      Query `objectToQuery` tracing each element walked during the query, including the first and the result (if any).
      The first element of the list is objectToQuery and the last is the result, or the element before the first null was encountered
      Parameters:
        `objectToQuery` - the object to query
        `iterator` - the json pointer iterator that provides the logic to access to the objectToQuery
      Returns:
        the stream of walked elements

    - #### write

          Object write(Object objectToWrite,
                       JsonPointerIterator iterator,
                       Object newElement,
                       boolean createOnMissing)

      Write `newElement` in `objectToWrite` using this pointer. The path token "-" is handled as append to end of array
      If you need to write in Vert.x json data structures, use `writeJson(Object, Object)` (Object)}
      Parameters:
        `objectToWrite` - object to write
        `iterator` - the json pointer iterator that provides the logic to access to the objectToMutate
        `newElement` - object to insert
        `createOnMissing` - create objects when missing a object key or an array index
      Returns:
        a reference to objectToWrite if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed

    - #### writeJson

          default Object writeJson(Object jsonElement,
                                   Object newElement)

      Write `newElement` in `jsonElement` using this pointer. The path token "-" is handled as append to end of array.
      Parameters:
        `jsonElement` - json element to query and write
        `newElement` - json to insert
      Returns:
        a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed

    - #### writeJson

          default Object writeJson(Object jsonElement,
                                   Object newElement,
                                   boolean createOnMissing)

      Write `newElement` in `jsonElement` using this pointer. The path token "-" is handled as append to end of array.
      Parameters:
        `jsonElement` - json to query and write
        `newElement` - json to insert
        `createOnMissing` - create JsonObject when missing a object key or an array index
      Returns:
        a reference to json if the write was completed, a reference to newElement if the pointer is a root pointer, null if the write failed

    - #### copy

          JsonPointer copy()

      Copy a JsonPointer
      Returns:
        a copy of this pointer

    - #### create

          static JsonPointer create()

      Build an empty JsonPointer
      Returns:
        a new empty JsonPointer

    - #### from

          static JsonPointer from(String pointer)

      Build a JsonPointer from a json pointer string
      Parameters:
        `pointer` - the string representing a pointer
      Returns:
        new instance of JsonPointer
      Throws:
        `IllegalArgumentException` - if the pointer provided is not valid

    - #### fromURI

          static JsonPointer fromURI(URI uri)

      Build a JsonPointer from a URI.
      Parameters:
        `uri` - uri representing a json pointer
      Returns:
        new instance of JsonPointer
      Throws:
        `IllegalArgumentException` - if the pointer provided is not valid

Copyright © 2021 Eclipse. All rights reserved.