Interface JsonKey

  • All Superinterfaces:
    CharSequence

    public interface JsonKey
    extends CharSequence
    Represents a JSON key. A JSON key can be used to access values of a JSON document. For example, in the following JSON document
        {
           "foo": 1,
           "bar": 1337,
           "baz": "Some other value"
        }
     

    "foo", "bar" and "baz" are JSON keys which can be represented by this interface.

    Implementations of this interface are required to be immutable.

    • Method Detail

      • of

        static JsonKey of​(CharSequence keyValue)
        Returns JSON key for the given character sequence. If the given key value is already a JSON key, this is immediately properly cast and returned.
        Parameters:
        keyValue - the character sequence value of the JSON key to be created.
        Returns:
        a new JSON key with keyValue as its value.
        Throws:
        NullPointerException - if keyValue is null.
        IllegalArgumentException - if keyValue is empty.
      • asPointer

        JsonPointer asPointer()
        Returns this key as JsonPointer with one level. If, for example, this key is "foo" the returned pointer is "/foo".
        Returns:
        this key as JSON pointer.