@ForUseOnly public interface JsonObject extends JsonElement<JsonObject>
CAUTION:
This class is still in development and may change drastically without any further notice.JsonOutput
Modifier and Type | Field and Description |
---|---|
static char |
DELIMITER
The default delimiter of an object in json ','.
|
static char |
PREFIX
The default prefix of an object in json '{'.
|
static char |
SUFFIX
The default suffix of an object in json '}'.
|
Modifier and Type | Method and Description |
---|---|
static JsonObject |
create()
Create a new empty
JsonObject . |
JsonElement<?> |
get(String key)
Get the value with the specified key.
|
boolean |
hasAttribute(String name)
Checks if this
object contains an attribute with the given name. |
boolean |
isEmpty()
Returns
true if this json object contains no elements. |
Collection<JsonPair> |
pairs()
This method can be used to get all currently pairs that are part of the object.
|
JsonObject |
put(Collection<? extends JsonPair> pairs)
This methods adds any kind of collection of
JsonPair s to the object. |
JsonObject |
put(JsonPair pair)
This method adds one pair to the object.
|
JsonObject |
put(String key,
JsonElement<?> value)
This method adds one pair to the object.
|
JsonObject |
remove(JsonPair pair)
This methods removes the pair with the specified key.
|
JsonObject |
remove(String key)
This methods removes the pair with the specified key.
|
JsonElement<?> |
resolve(String path)
Get the value for the specified path.
|
getValue
static final char PREFIX
static final char DELIMITER
static final char SUFFIX
static JsonObject create()
JsonObject
.JsonObject
boolean hasAttribute(@NotNull String name)
object
contains an attribute with the given name.name
- the name to checktrue
if this attribute is present, otherwise false
@NotNull Collection<JsonPair> pairs()
List
of all the pairs.@NotNull JsonObject put(@NotNull JsonPair pair)
pair
- The pair that should be added (must not be null
).@NotNull JsonObject put(@NotNull String key, @NotNull JsonElement<?> value)
key
- The key of the pair that should be added.value
- The value of the pair that should be added.@NotNull JsonObject put(@NotNull Collection<? extends JsonPair> pairs)
JsonPair
s to the object.pairs
- The pairs that should be added (must not be null
).JsonObject remove(@NotNull String key)
key
- The key to removeJsonObject remove(@NotNull JsonPair pair)
pair
- The Pair to remove@Nullable JsonElement<?> get(@NotNull String key)
key
- The key of the value which is requested.null
if the key is unknown.@Nullable JsonElement<?> resolve(@NotNull String path)
{ "a" : { "b": { "c": "x" }}}the path "a/b/c" specifies the value "x".
path
- The path of the requested valuenull
if any key in the path is unknown.boolean isEmpty()
true
if this json object contains no elements.true
if this json object contains no elements, else false
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210