Package org.eclipse.ditto.json
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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description JsonPointer
asPointer()
Returns this key asJsonPointer
with one level.static JsonKey
of(CharSequence keyValue)
Returns JSON key for the given character sequence.-
Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, length, subSequence, toString
-
-
-
-
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
- ifkeyValue
isnull
.IllegalArgumentException
- ifkeyValue
is empty.
-
asPointer
JsonPointer asPointer()
Returns this key asJsonPointer
with one level. If, for example, this key is"foo"
the returned pointer is"/foo"
.- Returns:
- this key as JSON pointer.
-
-