Class JsonArray
java.lang.Object
io.helidon.json.JsonValue
io.helidon.json.JsonArray
Represents a JSON array value containing an ordered list of non-null JSON values.
-
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()intsize()Return the number of values in this array.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.Methods inherited from class JsonValue
asArray, asBoolean, asNumber, asObject, asString, objectBuilder, toStringModifier and TypeMethodDescriptionasArray()Cast this value to a JsonArray if it is of array type.Cast this value to a JsonBoolean if it is of boolean type.asNumber()Cast this value to a JsonNumber if it is of number type.asObject()Cast this value to a JsonObject if it is of object type.asString()Cast this value to a JsonString if it is of string type.static JsonObject.BuilderA new fluent API builder to construct anJsonObject.toString()
-
Method Details
-
create
-
create
-
createStrings
-
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
-
empty
Returns the shared empty JSON array instance.- Returns:
- the empty JSON array
-
size
public int size()Return the number of values in this array.- Returns:
- array size
-
get
-
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
-
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
-