Class PathElement

    • Method Detail

      • index

        public final Integer index()

        Refers to an index in a JSON array.

        Returns:
        Refers to an index in a JSON array.
      • key

        public final String key()

        Refers to a key in a JSON object.

        Returns:
        Refers to a key in a JSON object.
      • substring

        public final Substring substring()

        Refers to a substring of a literal string in a JSON object.

        Returns:
        Refers to a substring of a literal string in a JSON object.
      • value

        public final String value()

        Refers to the value associated with a given key in a JSON object.

        Returns:
        Refers to the value associated with a given key in a JSON object.
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toString

        public final String toString()
        Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
      • getValueForField

        public final <T> Optional<T> getValueForField​(String fieldName,
                                                      Class<T> clazz)
      • fromIndex

        public static PathElement fromIndex​(Integer index)
        Create an instance of this class with index() initialized to the given value.

        Refers to an index in a JSON array.

        Parameters:
        index - Refers to an index in a JSON array.
      • fromKey

        public static PathElement fromKey​(String key)
        Create an instance of this class with key() initialized to the given value.

        Refers to a key in a JSON object.

        Parameters:
        key - Refers to a key in a JSON object.
      • fromSubstring

        public static PathElement fromSubstring​(Substring substring)
        Create an instance of this class with substring() initialized to the given value.

        Refers to a substring of a literal string in a JSON object.

        Parameters:
        substring - Refers to a substring of a literal string in a JSON object.
      • fromSubstring

        public static PathElement fromSubstring​(Consumer<Substring.Builder> substring)
        Create an instance of this class with substring() initialized to the given value.

        Refers to a substring of a literal string in a JSON object.

        Parameters:
        substring - Refers to a substring of a literal string in a JSON object.
      • fromValue

        public static PathElement fromValue​(String value)
        Create an instance of this class with value() initialized to the given value.

        Refers to the value associated with a given key in a JSON object.

        Parameters:
        value - Refers to the value associated with a given key in a JSON object.