public interface JsonArray extends JsonObjectOrArray, Iterable<Object>
Json
array, "[]".Modifier and Type | Method and Description |
---|---|
JsonArray |
add(int index,
Object value)
Inserts an object at the specified index in the array.
|
JsonArray |
add(int index,
Object value,
boolean clone)
Adds an object at the specified index.
|
JsonArray |
add(Object value)
Adds an object at the end of the array.
|
JsonArray |
add(Object value,
boolean clone)
Adds an object at the end of the array.
|
JsonArray |
addAll(Collection<?> values)
Adds all elements at the end of the array.
|
JsonArray |
addAll(Collection<?> values,
boolean clone)
Adds all elements at the end of the array.
|
JsonArray |
addAll(JsonArray values)
Adds all elements at the end of the array.
|
JsonArray |
addAll(JsonArray values,
boolean clone)
Adds elements at the end of the array.
|
JsonArray |
addAll(Object[] values)
Adds all elements at the end of the array.
|
JsonArray |
addAll(Object[] values,
boolean clone)
Adds elements at the end of the array.
|
JsonArray |
clone(boolean mutable)
Deep copy of the
JsonArray , so any
modification to the original won't affect the
clone, and vice-versa. |
List<Object> |
convertToPlainList()
Converts the
JsonArray to a plain List<Object> . |
List<String> |
convertToStringList()
Converts the JsonArray to a
List<String> . |
BigDecimal |
getArrayFirstBigDecimal(int index)
Gets the first element (as BigDecimal) of a
JsonArray element. |
BigDecimal |
getArrayFirstBigDecimal(int index,
BigDecimal defaultValue)
Gets the first element (as BigDecimal) of a
JsonArray element. |
Boolean |
getArrayFirstBoolean(int index)
Gets the first element (as Boolean) of a
JsonArray element. |
Boolean |
getArrayFirstBoolean(int index,
Boolean defaultValue)
Gets the first element (as Boolean) of a
JsonArray element. |
byte[] |
getArrayFirstBytesFromBase64String(int index)
Gets the first element (as byte[]) of a
JsonArray element. |
byte[] |
getArrayFirstBytesFromBase64String(int index,
byte[] defaultValue)
Gets the first element (as byte[]) of a
JsonArray element. |
Date |
getArrayFirstDate(int index)
Gets the first element (as Date) of a
JsonArray element. |
Date |
getArrayFirstDate(int index,
Date defaultValue)
Gets the first element (as Date) of a
JsonArray element. |
Double |
getArrayFirstDouble(int index)
Gets the first element (as Double) of a
JsonArray element. |
Double |
getArrayFirstDouble(int index,
Double defaultValue)
Gets the first element (as Double) of a
JsonArray element. |
Float |
getArrayFirstFloat(int index)
Gets the first element (as Float) of a
JsonArray element. |
Float |
getArrayFirstFloat(int index,
Float defaultValue)
Gets the first element (as Float) of a
JsonArray element. |
Instant |
getArrayFirstInstant(int index)
Gets the first element (as Instant) of a
JsonArray element. |
Instant |
getArrayFirstInstant(int index,
Instant defaultValue)
Gets the first element (as Instant) of a
JsonArray element. |
Integer |
getArrayFirstInteger(int index)
Gets the first element (as Integer) of a
JsonArray element. |
Integer |
getArrayFirstInteger(int index,
Integer defaultValue)
Gets the first element (as Integer) of a
JsonArray element. |
JsonArray |
getArrayFirstJsonArray(int index)
Gets the first element (as JsonArray) of a
JsonArray element. |
JsonArray |
getArrayFirstJsonArray(int index,
JsonArray defaultValue)
Gets the first element (as JsonArray) of a
JsonArray element. |
JsonObject |
getArrayFirstJsonObject(int index)
Gets the first element (as JsonObject) of a
JsonArray element. |
JsonObject |
getArrayFirstJsonObject(int index,
JsonObject defaultValue)
Gets the first element (as JsonObject) of a
JsonArray element. |
Long |
getArrayFirstLong(int index)
Gets the first element (as Long) of a
JsonArray element. |
Long |
getArrayFirstLong(int index,
Long defaultValue)
Gets the first element (as Long) of a
JsonArray element. |
String |
getArrayFirstString(int index)
Gets the first element (as String) of a
JsonArray element. |
String |
getArrayFirstString(int index,
String defaultValue)
Gets the first element (as String) of a
JsonArray element. |
BigDecimal |
getBigDecimal(int index)
Gets an element as
BigDecimal . |
BigDecimal |
getBigDecimal(int index,
BigDecimal defaultValue)
Gets an element as
BigDecimal . |
Boolean |
getBoolean(int index)
Gets an element as
Boolean . |
Boolean |
getBoolean(int index,
Boolean defaultValue)
Gets an element as
Boolean . |
byte[] |
getBytesFromBase64String(int index)
Gets a byte array, from a base 64 encoded element.
|
byte[] |
getBytesFromBase64String(int index,
byte[] defaultValue)
Gets a byte array, from a base 64 encoded element.
|
Date |
getDate(int index)
Gets a UTC timezoned date from a
ISO 8601 date element. |
Date |
getDate(int index,
Date defaultValue)
Gets a UTC timezoned date from a
ISO 8601 date element. |
Double |
getDouble(int index)
Gets an element as
Double . |
Double |
getDouble(int index,
Double defaultValue)
Gets an element as
Double . |
Float |
getFloat(int index)
Gets an element as
Float . |
Float |
getFloat(int index,
Float defaultValue)
Gets an element as
Float . |
Instant |
getInstant(int index)
Gets an Instant from a
ISO 8601 date element. |
Instant |
getInstant(int index,
Instant defaultValue)
Gets an Instant from a
ISO 8601 date element. |
Integer |
getInteger(int index)
Gets an element as
Integer . |
Integer |
getInteger(int index,
Integer defaultValue)
Gets an element as
Integer . |
JsonArray |
getJsonArray(int index)
Gets an element as
JsonArray . |
JsonArray |
getJsonArray(int index,
JsonArray defaultValue)
Gets an element as
JsonArray . |
JsonArray |
getJsonArrayOrEmpty(int index)
Gets an element as
JsonArray . |
JsonObject |
getJsonObject(int index)
Gets an element as
JsonObject . |
JsonObject |
getJsonObject(int index,
JsonObject defaultValue)
Gets an element as
JsonObject . |
JsonObject |
getJsonObjectOrEmpty(int index)
Gets an element as
JsonObject . |
Long |
getLong(int index)
Gets an element as
Long . |
Long |
getLong(int index,
Long defaultValue)
Gets an element as
Long . |
Object |
getObject(int index)
Gets an element, untyped.
|
Object |
getObject(int index,
Object defaultValue)
Gets an element, untyped.
|
String |
getString(int index)
Gets an element as
String . |
String |
getString(int index,
String defaultValue)
Gets an element as
String . |
boolean |
isCanBeConvertedToBigDecimal(int index)
Validates that the element at the specified
index exists and
is currently null , of type BigDecimal , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToBoolean(int index)
Validates that the element at the specified
index exists and
is currently null , of type Boolean , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToByteArray(int index)
Validates that the element at the specified
index exists and
is currently null , of type base 64 String representing
a byte array, or can be converted and retrieved as one. |
boolean |
isCanBeConvertedToDate(int index)
Validates that the element at the specified
index exists and
is currently null , of type Date , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToDouble(int index)
Validates that the element at the specified
index exists and
is currently null , of type Double , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToFloat(int index)
Validates that the element at the specified
index exists and
is currently null , of type Float , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToInteger(int index)
Validates that the element at the specified
index exists and
is currently null , of type Integer , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToJsonArray(int index)
Validates that the element at the specified
index exists and
is currently null , of type JsonArray , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToJsonObject(int index)
Validates that the element at the specified
index exists and
is currently null , of type JsonObject , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToLong(int index)
Validates that the element at the specified
index exists and
is currently null , of type Long , or can be
converted and retrieved as one. |
boolean |
isCanBeConvertedToString(int index)
Validates that the element at the specified
index exists and
is currently null , of type String , or can be
converted and retrieved as one. |
boolean |
isElementExists(int index)
Is there an element at the specified index? This returns
true even if the element is null . |
boolean |
isEquivalentTo(JsonArray other)
Compares the current
JsonArray to the specified one
and returns true if they are equivalent. |
boolean |
isNull(int index)
Validates that there is an element at the specified
index and
it is null . |
boolean |
isOfTypeBigDecimal(int index)
Validates that the element at the specified
index exists and
is currently null or of type BigDecimal , without requiring
any conversion. |
boolean |
isOfTypeBoolean(int index)
Validates that the element at the specified
index exists and
is currently null or of type Boolean , without requiring
any conversion. |
boolean |
isOfTypeByteArray(int index,
boolean acceptBase64StringToo)
Validates that the element at the specified
JsonPath exists and
is currently null or of type byte[] , without requiring
any conversion. |
boolean |
isOfTypeDate(int index)
Validates that the element at the specified
index exists and
is currently null or of type Date , without requiring
any conversion. |
boolean |
isOfTypeDouble(int index)
Validates that the element at the specified
index exists and
is currently null or of type Double , without requiring
any conversion. |
boolean |
isOfTypeFloat(int index)
Validates that the element at the specified
index exists and
is currently null or of type Float , without requiring
any conversion. |
boolean |
isOfTypeInteger(int index)
Validates that the element at the specified
index exists and
is currently null or of type Integer , without requiring
any conversion. |
boolean |
isOfTypeJsonArray(int index)
Validates that the element at the specified
index exists and
is currently null or of type JsonArray , without requiring
any conversion. |
boolean |
isOfTypeJsonObject(int index)
Validates that the element at the specified
index exists and
is currently null or of type JsonObject , without requiring
any conversion. |
boolean |
isOfTypeLong(int index)
Validates that the element at the specified
index exists and
is currently null or of type Long , without requiring
any conversion. |
boolean |
isOfTypeString(int index)
Validates that the element at the specified
index exists and
is currently null or of type String , without requiring
any conversion. |
JsonArray |
remove(int index)
Removes an element at the specified index.
|
JsonArray |
set(int index,
Object value)
Sets an object at the specified index.
|
JsonArray |
set(int index,
Object value,
boolean clone)
Sets an object at the specified index.
|
void |
transform(int index,
ElementTransformer transformer)
Transforms the element at the given index, using the
specified
ElementTransformer . |
void |
trim(int index)
Trims the element, if it's of type
String . |
clear, contains, getArrayFirstBigDecimal, getArrayFirstBigDecimal, getArrayFirstBoolean, getArrayFirstBoolean, getArrayFirstBytesFromBase64String, getArrayFirstBytesFromBase64String, getArrayFirstDate, getArrayFirstDate, getArrayFirstDouble, getArrayFirstDouble, getArrayFirstFloat, getArrayFirstFloat, getArrayFirstInstant, getArrayFirstInstant, getArrayFirstInteger, getArrayFirstInteger, getArrayFirstJsonArray, getArrayFirstJsonArray, getArrayFirstJsonObject, getArrayFirstJsonObject, getArrayFirstLong, getArrayFirstLong, getArrayFirstString, getArrayFirstString, getBigDecimal, getBigDecimal, getBoolean, getBoolean, getBytesFromBase64String, getBytesFromBase64String, getDate, getDate, getDouble, getDouble, getFloat, getFloat, getInstant, getInstant, getInteger, getInteger, getJsonArray, getJsonArray, getJsonArrayOrEmpty, getJsonArrayOrEmpty, getJsonObject, getJsonObject, getJsonObjectOrEmpty, getJsonObjectOrEmpty, getLong, getLong, getObject, getObject, getString, getString, isCanBeConvertedToBigDecimal, isCanBeConvertedToBoolean, isCanBeConvertedToByteArray, isCanBeConvertedToDate, isCanBeConvertedToDouble, isCanBeConvertedToFloat, isCanBeConvertedToInteger, isCanBeConvertedToJsonArray, isCanBeConvertedToJsonObject, isCanBeConvertedToLong, isCanBeConvertedToString, isMutable, isNull, isOfTypeBigDecimal, isOfTypeBoolean, isOfTypeByteArray, isOfTypeDate, isOfTypeDouble, isOfTypeFloat, isOfTypeInteger, isOfTypeJsonArray, isOfTypeJsonObject, isOfTypeLong, isOfTypeString, remove, set, set, size, toJsonString, toJsonString, transform, transformAll, transformAll, trim, trimAll, trimAll
forEach, iterator, spliterator
JsonArray add(Object value)
If the object to add is not of a native type, then the object is converted before being added. Once the object is converted and added, a modification of the original object won't affect this element, and vice-versa.
If the element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray add(int index, Object value)
If the specified index is greater than the current
end of the array, null
elements are
added to fill up positionss up to the specified index!
Use set
instead if you want
to replace the element at the specified index.
If the object to add is not of a native type, then the object is converted before being added. Once the object is converted and added, a modification of the original object won't affect this element, and vice-versa.
If the element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray add(Object value, boolean clone)
If the object to add is not of a native type, then the object is converted before being added. Once the object is converted and added, a modification of the original object won't affect this element, and vice-versa.
If the element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray add(int index, Object value, boolean clone)
Any existing elements starting at this index are pushed to the right.
If the specified index is greater than the current
end of the array, null
elements are
added to fill positions up to the specified index!
Use set
instead if you want
to replace the element at the specified index.
If the object to add is not of a native type, then the object is converted before being added. Once the object is converted and added, a modification of the original object won't affect this element, and vice-versa.
If the element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray addAll(Collection<?> values)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray addAll(Collection<?> values, boolean clone)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray addAll(Object[] values)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray addAll(Object[] values, boolean clone)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray addAll(JsonArray values)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray addAll(JsonArray values, boolean clone)
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray set(int index, Object value)
If the specified index is greater than the current
end of the array, null
elements are
added to fill positions up to the specified index.
Use add
instead if you want
to insert the element at the specified index without
overwritting any existing element.
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
JsonArray set(int index, Object value, boolean clone)
If the specified index is greater than the current
end of the array, null
elements are
added to fill positions up to the specified index.
Use add
instead if you want
to insert the element at the specified index without
overwritting any existing element.
If an element to add is not of a native type, then the element is converted before being added. Once the element is converted and added, a modification of the original object won't affect this element, and vice-versa.
If an element to add is a JsonObject
or
a JsonArray
and is immutable, it will be cloned.
Doing so, we can make sure the JsonArray
is always
fully mutable or fully immutable.
If the element implements ToJsonObjectConvertible
, it
will be converted to a JsonObject
using the associated
conversion method. If it implements ToJsonArrayConvertible
, it
will be converted to an JsonArray
using the associated
conversion method.
Those are the types of objects that will be converted to a
JsonArray
instead of a JsonObject
, if
no conversion interface is implemented :
clone
- if true
, and the element to add is a
JsonObject
or JsonArray
, a clone will be made
before being added. If that case, any modification to the
original element won't affect the added one,
and vice-versa. If the element is immutable then it will
always be cloned. Doing so, we can make sure a
JsonArray
is always
fully mutable or fully immutable.JsonArray remove(int index)
boolean isElementExists(int index)
true
even if the element is null
.
This is a synonym of index >= 0 && index < size()
JsonObject getJsonObject(int index) throws CantConvertException
JsonObject
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonObject getJsonObject(int index, JsonObject defaultValue) throws CantConvertException
JsonObject
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonObject getJsonObjectOrEmpty(int index) throws CantConvertException
JsonObject
.JsonObject
if not found
or if null
.CantConvertException
- if an existing element can't be converted to the
required type.JsonArray getJsonArray(int index) throws CantConvertException
JsonArray
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonArray getJsonArray(int index, JsonArray defaultValue) throws CantConvertException
JsonArray
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonArray getJsonArrayOrEmpty(int index) throws CantConvertException
JsonArray
.JsonArray
if not found or if null
.CantConvertException
- if an existing element can't be converted to the
required type.String getString(int index)
String
.null
if not found.String getString(int index, String defaultValue)
String
.defaultValue
if not found.Integer getInteger(int index) throws CantConvertException
Integer
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Integer getInteger(int index, Integer defaultValue) throws CantConvertException
Integer
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Long getLong(int index) throws CantConvertException
Long
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Long getLong(int index, Long defaultValue) throws CantConvertException
Long
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Float getFloat(int index) throws CantConvertException
Float
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Float getFloat(int index, Float defaultValue) throws CantConvertException
Float
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Double getDouble(int index) throws CantConvertException
Double
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Double getDouble(int index, Double defaultValue) throws CantConvertException
Double
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Boolean getBoolean(int index) throws CantConvertException
Boolean
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Boolean getBoolean(int index, Boolean defaultValue) throws CantConvertException
Boolean
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.BigDecimal getBigDecimal(int index) throws CantConvertException
BigDecimal
.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.BigDecimal getBigDecimal(int index, BigDecimal defaultValue) throws CantConvertException
BigDecimal
.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.byte[] getBytesFromBase64String(int index) throws CantConvertException
null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.byte[] getBytesFromBase64String(int index, byte[] defaultValue) throws CantConvertException
defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Date getDate(int index) throws CantConvertException
ISO 8601
date element.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Date getDate(int index, Date defaultValue) throws CantConvertException
ISO 8601
date element.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Instant getInstant(int index) throws CantConvertException
ISO 8601
date element.null
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Instant getInstant(int index, Instant defaultValue) throws CantConvertException
ISO 8601
date element.defaultValue
if not found.CantConvertException
- if an existing element can't be converted to the
required type.Object getObject(int index)
null
if not found. This object
will necessarly be of a type managed by JsonArray
, since
an object of any other type is automatically converted when added.Object getObject(int index, Object defaultValue)
defaultValue
if not found. This object
will necessarly be of a type managed by JsonArray
, since
an object of any other type is automatically converted when added.JsonObject getArrayFirstJsonObject(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonObject getArrayFirstJsonObject(int index, JsonObject defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonArray getArrayFirstJsonArray(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.JsonArray getArrayFirstJsonArray(int index, JsonArray defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.String getArrayFirstString(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.String getArrayFirstString(int index, String defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Integer getArrayFirstInteger(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Integer getArrayFirstInteger(int index, Integer defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Long getArrayFirstLong(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Long getArrayFirstLong(int index, Long defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Double getArrayFirstDouble(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Double getArrayFirstDouble(int index, Double defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Float getArrayFirstFloat(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Float getArrayFirstFloat(int index, Float defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Boolean getArrayFirstBoolean(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Boolean getArrayFirstBoolean(int index, Boolean defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.BigDecimal getArrayFirstBigDecimal(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.BigDecimal getArrayFirstBigDecimal(int index, BigDecimal defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.byte[] getArrayFirstBytesFromBase64String(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.byte[] getArrayFirstBytesFromBase64String(int index, byte[] defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Date getArrayFirstDate(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Date getArrayFirstDate(int index, Date defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Instant getArrayFirstInstant(int index) throws CantConvertException
JsonArray
element.null
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.Instant getArrayFirstInstant(int index, Instant defaultValue) throws CantConvertException
JsonArray
element.defaultValue
if the array or
the first element are not found.CantConvertException
- if an existing element can't be converted to the
required type.boolean isCanBeConvertedToString(int index)
index
exists and
is currently null
, of type String
, or can be
converted and retrieved as one.boolean isCanBeConvertedToInteger(int index)
index
exists and
is currently null
, of type Integer
, or can be
converted and retrieved as one.boolean isCanBeConvertedToLong(int index)
index
exists and
is currently null
, of type Long
, or can be
converted and retrieved as one.boolean isCanBeConvertedToFloat(int index)
index
exists and
is currently null
, of type Float
, or can be
converted and retrieved as one.boolean isCanBeConvertedToDouble(int index)
index
exists and
is currently null
, of type Double
, or can be
converted and retrieved as one.boolean isCanBeConvertedToBoolean(int index)
index
exists and
is currently null
, of type Boolean
, or can be
converted and retrieved as one.boolean isCanBeConvertedToBigDecimal(int index)
index
exists and
is currently null
, of type BigDecimal
, or can be
converted and retrieved as one.boolean isCanBeConvertedToByteArray(int index)
index
exists and
is currently null
, of type base 64 String
representing
a byte array, or can be converted and retrieved as one.boolean isCanBeConvertedToDate(int index)
index
exists and
is currently null
, of type Date
, or can be
converted and retrieved as one.boolean isCanBeConvertedToJsonObject(int index)
index
exists and
is currently null
, of type JsonObject
, or can be
converted and retrieved as one.boolean isCanBeConvertedToJsonArray(int index)
index
exists and
is currently null
, of type JsonArray
, or can be
converted and retrieved as one.boolean isOfTypeString(int index)
index
exists and
is currently null
or of type String
, without requiring
any conversion.boolean isOfTypeInteger(int index)
index
exists and
is currently null
or of type Integer
, without requiring
any conversion.boolean isOfTypeLong(int index)
index
exists and
is currently null
or of type Long
, without requiring
any conversion.boolean isOfTypeFloat(int index)
index
exists and
is currently null
or of type Float
, without requiring
any conversion.boolean isOfTypeDouble(int index)
index
exists and
is currently null
or of type Double
, without requiring
any conversion.boolean isOfTypeBoolean(int index)
index
exists and
is currently null
or of type Boolean
, without requiring
any conversion.boolean isOfTypeBigDecimal(int index)
index
exists and
is currently null
or of type BigDecimal
, without requiring
any conversion.boolean isOfTypeByteArray(int index, boolean acceptBase64StringToo)
JsonPath
exists and
is currently null
or of type byte[]
, without requiring
any conversion.acceptBase64StringToo
- if true
, then a valid base 64 String
will also be accepted.boolean isOfTypeDate(int index)
index
exists and
is currently null
or of type Date
, without requiring
any conversion.boolean isOfTypeJsonObject(int index)
index
exists and
is currently null
or of type JsonObject
, without requiring
any conversion.boolean isOfTypeJsonArray(int index)
index
exists and
is currently null
or of type JsonArray
, without requiring
any conversion.boolean isNull(int index)
index
and
it is null
.boolean isEquivalentTo(JsonArray other)
JsonArray
to the specified one
and returns true
if they are equivalent. To be equivalent,
all their elements must be so too.
An element is equivalent to the other if they can be converted to the¸ same type, and then if they are equals.
For example, the String
"123" is equivalent to
new BigDecimal("123")
or to 123L
.
JsonArray clone(boolean mutable)
JsonArray
, so any
modification to the original won't affect the
clone, and vice-versa.
Note that if the current array is immutable and
the mutable
parameter is set to false
,
then the current array will be returned as is since no
cloning is then required.
clone
in interface JsonObjectOrArray
mutable
- if true
the resulting
array and all its children will be mutable, otherwise
they will all be immutable.void transform(int index, ElementTransformer transformer)
ElementTransformer
.void trim(int index)
String
.List<String> convertToStringList()
List<String>
.
To do so, the toString()
method will be called
on any non null element.
This list is always a new instance and is mutable.
Copyright © 2019. All rights reserved.