Interface JsonArray
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description JsonArrayadd(JsonNode jsonNode)Adds aJsonNodeto the end of this array.JsonArrayclear()Clears all values in the array.Stream<JsonNode>elements()JsonNodeget(int index)Gets theJsonNodeat the given index of the array.booleanhas(int index)Determines if the array contains a value for the given index.default booleanisArray()JsonNoderemove(int index)Removes theJsonNodeat the specified index of the array.JsonNodeset(int index, JsonNode jsonNode)Replaces theJsonNodeat the specified index with a new node.intsize()
-
-
-
Method Detail
-
isArray
default boolean isArray()
-
get
JsonNode get(int index)
Gets theJsonNodeat the given index of the array.- Parameters:
index- Index of the array.- Returns:
- The
JsonNodeat the given index of the array if set, otherwisenull. - Throws:
IndexOutOfBoundsException- Ifindexis less than0or greater thansize().
-
has
boolean has(int index)
Determines if the array contains a value for the given index.If
indexis less than0or greater than equal tosize()falseis returned.- Parameters:
index- Index of the array.- Returns:
- Whether the array contains a value for the index.
-
remove
JsonNode remove(int index)
Removes theJsonNodeat the specified index of the array.- Parameters:
index- Index of the array.- Returns:
- The
JsonNodeat the given index of the array. - Throws:
IndexOutOfBoundsException- Ifindexis less than0or greater thansize().
-
set
JsonNode set(int index, JsonNode jsonNode)
Replaces theJsonNodeat the specified index with a new node.- Parameters:
index- Index of the array.jsonNode- The newJsonNodevalue to set.- Returns:
- The old
JsonNodevalue at the given index of the array. - Throws:
IndexOutOfBoundsException- Ifindexis less than0or greater thansize().
-
size
int size()
- Returns:
- The size of the array.
-
-