java.lang.Object
io.helidon.json.JsonValue
io.helidon.json.JsonArray
Represents a JSON array value containing an ordered list of JSON values.
This module is incubating. These APIs may change in any version of Helidon, including backward incompatible changes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic JsonArrayCreate a JsonArray from an array of JsonValue instances.static JsonArrayCreate a JsonArray from a list of JsonValue instances.static JsonArraycreateBooleans(List<Boolean> values) Create a JsonArray from a list of booleans.static JsonArraycreateNumbers(List<BigDecimal> values) Create a JsonArray from a list of BigDecimal numbers.static JsonArraycreateStrings(List<String> values) Create a JsonArray from a list of strings.static JsonArrayempty()Returns the shared empty JSON array instance.booleanget(int index) Return the JsonValue at the specified index as an Optional.Return the JsonValue at the specified index, or the default value if the index is out of bounds.inthashCode()voidtoJson(JsonGenerator generator) Write this JSON value to the provided generator.type()Return the type of this JSON value.values()Return an unmodifiable list of all values in this array.
-
Method Details
-
create
Create a JsonArray from a list of JsonValue instances.- Parameters:
jsonValues- the list of JSON values- Returns:
- a new JsonArray
-
create
Create a JsonArray from an array of JsonValue instances.- Parameters:
jsonValues- the array of JSON values- Returns:
- a new JsonArray
-
createStrings
Create a JsonArray from a list of strings.- Parameters:
values- the list of string values- Returns:
- a new JsonArray containing JsonString values
-
createNumbers
Create a JsonArray from a list of BigDecimal numbers.- Parameters:
values- the list of BigDecimal values- Returns:
- a new JsonArray containing JsonNumber values
-
createBooleans
Create a JsonArray from a list of booleans.- Parameters:
values- the list of boolean values- Returns:
- a new JsonArray containing JsonBoolean values
-
empty
Returns the shared empty JSON array instance.- Returns:
- the empty JSON array
-
get
Return the JsonValue at the specified index as an Optional.- Parameters:
index- the index of the element to return- Returns:
- an Optional containing the element at the specified position, or empty if out of bounds
-
get
Return the JsonValue at the specified index, or the default value if the index is out of bounds.- Parameters:
index- the index of the element to returndefaultValue- the value to return if the index is out of bounds- Returns:
- the element at the specified position, or the default value
-
values
Return an unmodifiable list of all values in this array.- Returns:
- an unmodifiable list of JsonValue instances
-
type
Description copied from class:JsonValueReturn the type of this JSON value. -
toJson
Description copied from class:JsonValueWrite this JSON value to the provided generator. -
equals
-
hashCode
public int hashCode()
-