Class JsonArrayDefault
- All Implemented Interfaces:
Iterable<Object>
,JsonArray
,JsonObjectOrArray
JsonArray
implementation.-
Nested Class Summary
Nested classes/interfaces inherited from class org.spincast.core.json.JsonObjectArrayBase
JsonObjectArrayBase.JsonPathCachingItem
-
Field Summary
Fields inherited from class org.spincast.core.json.JsonObjectArrayBase
defaultElementValidator
-
Constructor Summary
ConstructorDescriptionJsonArrayDefault
(List<Object> initialElements, boolean mutable, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) ConstructorJsonArrayDefault
(List<Object> initialElements, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) ConstructorJsonArrayDefault
(JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor -
Method Summary
Modifier and TypeMethodDescriptionInserts an object at the specified index in the array.Adds an object at the specified index.Adds an object at the end of the array.Adds an object at the end of the array.Adds all elements at the end of the array.Adds elements at the end of the array.addAll
(Collection<?> values) Adds all elements at the end of the array.addAll
(Collection<?> values, boolean clone) Adds all elements at the end of the array.Adds all elements at the end of the array.Adds elements at the end of the array.protected JsonArray
protected JsonArray
clear()
Clears all elements.clone
(boolean mutable) Clone the object.Converts theJsonArray
to a plainList<Object>
.Converts the JsonArray to aList<String>
.protected <T> T
getArrayFirst
(int index, boolean hasDefaultValue, T defaultValue, JsonObjectDefault.IFirstElementGetter<T> firstElementGetter) getArrayFirstBigDecimal
(int index) Gets the first element (as BigDecimal) of aJsonArray
element.getArrayFirstBigDecimal
(int index, BigDecimal defaultValue) Gets the first element (as BigDecimal) of aJsonArray
element.getArrayFirstBoolean
(int index) Gets the first element (as Boolean) of aJsonArray
element.getArrayFirstBoolean
(int index, Boolean defaultValue) Gets the first element (as Boolean) of aJsonArray
element.byte[]
getArrayFirstBytesFromBase64String
(int index) Gets the first element (as byte[]) of aJsonArray
element.byte[]
getArrayFirstBytesFromBase64String
(int index, byte[] defaultValue) Gets the first element (as byte[]) of aJsonArray
element.getArrayFirstDate
(int index) Gets the first element (as Date) of aJsonArray
element.getArrayFirstDate
(int index, Date defaultValue) Gets the first element (as Date) of aJsonArray
element.getArrayFirstDouble
(int index) Gets the first element (as Double) of aJsonArray
element.getArrayFirstDouble
(int index, Double defaultValue) Gets the first element (as Double) of aJsonArray
element.getArrayFirstFloat
(int index) Gets the first element (as Float) of aJsonArray
element.getArrayFirstFloat
(int index, Float defaultValue) Gets the first element (as Float) of aJsonArray
element.getArrayFirstInstant
(int index) Gets the first element (as Instant) of aJsonArray
element.getArrayFirstInstant
(int index, Instant defaultValue) Gets the first element (as Instant) of aJsonArray
element.getArrayFirstInteger
(int index) Gets the first element (as Integer) of aJsonArray
element.getArrayFirstInteger
(int index, Integer defaultValue) Gets the first element (as Integer) of aJsonArray
element.getArrayFirstJsonArray
(int index) Gets the first element (as JsonArray) of aJsonArray
element.getArrayFirstJsonArray
(int index, JsonArray defaultValue) Gets the first element (as JsonArray) of aJsonArray
element.getArrayFirstJsonObject
(int index) Gets the first element (as JsonObject) of aJsonArray
element.getArrayFirstJsonObject
(int index, JsonObject defaultValue) Gets the first element (as JsonObject) of aJsonArray
element.getArrayFirstLong
(int index) Gets the first element (as Long) of aJsonArray
element.getArrayFirstLong
(int index, Long defaultValue) Gets the first element (as Long) of aJsonArray
element.getArrayFirstString
(int index) Gets the first element (as String) of aJsonArray
element.getArrayFirstString
(int index, String defaultValue) Gets the first element (as String) of aJsonArray
element.getBigDecimal
(int index) Gets an element asBigDecimal
.getBigDecimal
(int index, BigDecimal defaultValue) Gets an element asBigDecimal
.getBoolean
(int index) Gets an element asBoolean
.getBoolean
(int index, Boolean defaultValue) Gets an element asBoolean
.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.getDate
(int index) Gets a UTC timezoned date from aISO 8601
date element.Gets a UTC timezoned date from aISO 8601
date element.getDouble
(int index) Gets an element asDouble
.Gets an element asDouble
.protected Object
getElement
(int index) protected Object
getElementNoKeyParsing
(String jsonPath, boolean hasDefaultValue, Object defaultValue) Gets the element at this key/index, without key parsing.getFloat
(int index) Gets an element asFloat
.Gets an element asFloat
.getInstant
(int index) Gets an Instant from aISO 8601
date element.getInstant
(int index, Instant defaultValue) Gets an Instant from aISO 8601
date element.getInteger
(int index) Gets an element asInteger
.getInteger
(int index, Integer defaultValue) Gets an element asInteger
.getJsonArray
(int index) Gets an element asJsonArray
.getJsonArray
(int index, JsonArray defaultValue) Gets an element asJsonArray
.getJsonArrayOrEmpty
(int index) Gets an element asJsonArray
.getJsonObject
(int index) Gets an element asJsonObject
.getJsonObject
(int index, JsonObject defaultValue) Gets an element asJsonObject
.getJsonObjectOrEmpty
(int index) Gets an element asJsonObject
.getLong
(int index) Gets an element asLong
.Gets an element asLong
.getObject
(int index) Gets an element, untyped.Gets an element, untyped.getString
(int index) Gets an element asString
.Gets an element asString
.boolean
isCanBeConvertedToBigDecimal
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeBigDecimal
, or can be converted and retrieved as one.boolean
isCanBeConvertedToBoolean
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeBoolean
, or can be converted and retrieved as one.boolean
isCanBeConvertedToByteArray
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typebase 64 String
representing a byte array, or can be converted and retrieved as one.boolean
isCanBeConvertedToDate
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeDate
, or can be converted and retrieved as one.boolean
isCanBeConvertedToDouble
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeDouble
, or can be converted and retrieved as one.boolean
isCanBeConvertedToFloat
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeFloat
, or can be converted and retrieved as one.boolean
isCanBeConvertedToInteger
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeInteger
, or can be converted and retrieved as one.boolean
isCanBeConvertedToJsonArray
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeJsonArray
, or can be converted and retrieved as one.boolean
isCanBeConvertedToJsonObject
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeJsonObject
, or can be converted and retrieved as one.boolean
isCanBeConvertedToLong
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeLong
, or can be converted and retrieved as one.boolean
isCanBeConvertedToString
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
, of typeString
, or can be converted and retrieved as one.boolean
isElementExists
(int index) Is there an element at the specified index? This returnstrue
even if the element isnull
.boolean
isEquivalentTo
(JsonArray other) Compares the currentJsonArray
to the specified one and returnstrue
if they are equivalent.boolean
isNull
(int index) Validates that there is an element at the specifiedindex
and it isnull
.boolean
isOfTypeBigDecimal
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion.boolean
isOfTypeBoolean
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeBoolean
, without requiring any conversion.boolean
isOfTypeByteArray
(int index, boolean acceptBase64StringToo) Validates that the element at the specifiedJsonPath
exists and is currentlynull
or of typebyte[]
, without requiring any conversion.boolean
isOfTypeDate
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeDate
, without requiring any conversion.boolean
isOfTypeDouble
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeDouble
, without requiring any conversion.boolean
isOfTypeFloat
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeFloat
, without requiring any conversion.boolean
isOfTypeInteger
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeInteger
, without requiring any conversion.boolean
isOfTypeJsonArray
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion.boolean
isOfTypeJsonObject
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion.boolean
isOfTypeLong
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeLong
, without requiring any conversion.boolean
isOfTypeString
(int index) Validates that the element at the specifiedindex
exists and is currentlynull
or of typeString
, without requiring any conversion.iterator()
protected JsonArray
remove
(int index) Removes an element at the specified index.Removes an element atJsonPath
.Sets an object at the specified index.Sets an object at the specified index.protected JsonArray
setOrAddAsIs
(Integer index, Object value, boolean insert) int
size()
The size of the object.void
transform
(int index, ElementTransformer transformer) Transforms the element at the given index, using the specifiedElementTransformer
.void
transformAll
(ElementTransformer transformer, boolean recursive) Transforms all the elements of the object, using the specified transformer.void
trim
(int index) Trims the element, if it's of typeString
.Methods inherited from class org.spincast.core.json.JsonObjectArrayBase
clone, contains, getArrayFirst, getArrayFirstBigDecimal, getArrayFirstBigDecimal, getArrayFirstBigDecimal, getArrayFirstBigDecimalNoKeyParsing, getArrayFirstBigDecimalNoKeyParsing, getArrayFirstBoolean, getArrayFirstBoolean, getArrayFirstBoolean, getArrayFirstBooleanNoKeyParsing, getArrayFirstBooleanNoKeyParsing, getArrayFirstBytesFromBase64String, getArrayFirstBytesFromBase64String, getArrayFirstBytesFromBase64String, getArrayFirstBytesFromBase64StringNoKeyParsing, getArrayFirstBytesFromBase64StringNoKeyParsing, getArrayFirstDate, getArrayFirstDate, getArrayFirstDate, getArrayFirstDateNoKeyParsing, getArrayFirstDateNoKeyParsing, getArrayFirstDouble, getArrayFirstDouble, getArrayFirstDouble, getArrayFirstDoubleNoKeyParsing, getArrayFirstDoubleNoKeyParsing, getArrayFirstFloat, getArrayFirstFloat, getArrayFirstFloat, getArrayFirstFloatNoKeyParsing, getArrayFirstFloatNoKeyParsing, getArrayFirstInstant, getArrayFirstInstant, getArrayFirstInstant, getArrayFirstInstantNoKeyParsing, getArrayFirstInstantNoKeyParsing, getArrayFirstInteger, getArrayFirstInteger, getArrayFirstInteger, getArrayFirstIntegerNoKeyParsing, getArrayFirstIntegerNoKeyParsing, getArrayFirstJsonArray, getArrayFirstJsonArray, getArrayFirstJsonArray, getArrayFirstJsonArrayNoKeyParsing, getArrayFirstJsonArrayNoKeyParsing, getArrayFirstJsonObject, getArrayFirstJsonObject, getArrayFirstJsonObject, getArrayFirstJsonObjectNoKeyParsing, getArrayFirstJsonObjectNoKeyParsing, getArrayFirstLong, getArrayFirstLong, getArrayFirstLong, getArrayFirstLongNoKeyParsing, getArrayFirstLongNoKeyParsing, getArrayFirstString, getArrayFirstString, getArrayFirstString, getArrayFirstStringNoKeyParsing, getArrayFirstStringNoKeyParsing, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimalElement, getBigDecimalFromObject, getBigDecimalNoKeyParsing, getBigDecimalNoKeyParsing, getBoolean, getBoolean, getBoolean, getBooleanElement, getBooleanFromObject, getBooleanNoKeyParsing, getBooleanNoKeyParsing, getBytesFromBase64String, getBytesFromBase64String, getBytesFromBase64String, getBytesFromBase64StringElement, getBytesFromBase64StringNoKeyParsing, getBytesFromBase64StringNoKeyParsing, getBytesFromBase64StringValueFromObject, getDate, getDate, getDate, getDateElement, getDateFromObject, getDateNoKeyParsing, getDateNoKeyParsing, getdefaultElementValidator, getDouble, getDouble, getDouble, getDoubleElement, getDoubleFromObject, getDoubleNoKeyParsing, getDoubleNoKeyParsing, getElement, getFloat, getFloat, getFloat, getFloatElement, getFloatFromObject, getFloatNoKeyParsing, getFloatNoKeyParsing, getInstant, getInstant, getInstant, getInstantElement, getInstantFromObject, getInstantNoKeyParsing, getInstantNoKeyParsing, getInteger, getInteger, getInteger, getIntegerElement, getIntegerFromObject, getIntegerNoKeyParsing, getIntegerNoKeyParsing, getJsonArray, getJsonArray, getJsonArray, getJsonArrayFromObject, getJsonArrayNoKeyParsing, getJsonArrayNoKeyParsing, getJsonArrayOrEmpty, getJsonArrayOrEmpty, getJsonArrayOrEmptyNoKeyParsing, getJsonManager, getJsonObject, getJsonObject, getJsonObject, getJsonObject, getJsonObjectFromObject, getJsonObjectNoKeyParsing, getJsonObjectNoKeyParsing, getJsonObjectOrEmpty, getJsonObjectOrEmpty, getJsonObjectOrEmptyNoKeyParsing, getJsonPathCachingMap, getLong, getLong, getLong, getLongElement, getLongFromObject, getLongNoKeyParsing, getLongNoKeyParsing, getObject, getObject, getObject, getObjectConverter, getObjectNoKeyParsing, getObjectNoKeyParsing, getSpincastUtils, getString, getString, getString, getString, getStringFromObject, getStringNoKeyParsing, getStringNoKeyParsing, getTrimTransformer, isCanBeConvertedToBigDecimal, isCanBeConvertedToBigDecimal, isCanBeConvertedToBigDecimalNoKeyParsing, isCanBeConvertedToBoolean, isCanBeConvertedToBoolean, isCanBeConvertedToBooleanNoKeyParsing, isCanBeConvertedToByteArray, isCanBeConvertedToByteArray, isCanBeConvertedToByteArrayNoKeyParsing, isCanBeConvertedToDate, isCanBeConvertedToDate, isCanBeConvertedToDateNoKeyParsing, isCanBeConvertedToDouble, isCanBeConvertedToDouble, isCanBeConvertedToDoubleNoKeyParsing, isCanBeConvertedToFloat, isCanBeConvertedToFloat, isCanBeConvertedToFloatNoKeyParsing, isCanBeConvertedToInteger, isCanBeConvertedToInteger, isCanBeConvertedToIntegerNoKeyParsing, isCanBeConvertedToJsonArray, isCanBeConvertedToJsonArray, isCanBeConvertedToJsonArrayNoKeyParsing, isCanBeConvertedToJsonObject, isCanBeConvertedToJsonObject, isCanBeConvertedToJsonObjectNoKeyParsing, isCanBeConvertedToLong, isCanBeConvertedToLong, isCanBeConvertedToLongNoKeyParsing, isCanBeConvertedToString, isCanBeConvertedToString, isCanBeConvertedToStringNoKeyParsing, isMutable, isNull, isNullNoKeyParsing, isOfTypeBigDecimal, isOfTypeBigDecimalNoKeyParsing, isOfTypeBoolean, isOfTypeBoolean, isOfTypeBooleanNoKeyParsing, isOfTypeByteArray, isOfTypeByteArray, isOfTypeByteArrayNoKeyParsing, isOfTypeDate, isOfTypeDate, isOfTypeDateNoKeyParsing, isOfTypeDouble, isOfTypeDouble, isOfTypeDoubleNoKeyParsing, isOfTypeeBigDecimal, isOfTypeFloat, isOfTypeFloat, isOfTypeFloatNoKeyParsing, isOfTypeInteger, isOfTypeInteger, isOfTypeIntegerNoKeyParsing, isOfTypeJsonArray, isOfTypeJsonArray, isOfTypeJsonArrayNoKeyParsing, isOfTypeJsonObject, isOfTypeJsonObject, isOfTypeJsonObjectNoKeyParsing, isOfTypeLong, isOfTypeLong, isOfTypeLongNoKeyParsing, isOfTypeString, isOfTypeString, isOfTypeStringNoKeyParsing, isPresent, put, set, set, setIfAbsent, setIfAbsent, toJsonString, toJsonString, toString, transform, transformAll, trim, trimAll, trimAll, validateIsNull
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.spincast.core.json.JsonObjectOrArray
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, isPresent, set, set, setIfAbsent, setIfAbsent, toJsonString, toJsonString, transform, transformAll, trim, trimAll, trimAll
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
JsonArrayDefault
public JsonArrayDefault(JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor -
JsonArrayDefault
public JsonArrayDefault(@Nullable List<Object> initialElements, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor -
JsonArrayDefault
public JsonArrayDefault(@Nullable List<Object> initialElements, boolean mutable, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter) Constructor
-
-
Method Details
-
getElements
-
getElement
-
add
Description copied from interface:JsonArray
Adds an object at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
add
Description copied from interface:JsonArray
Inserts an object at the specified index in the array. 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 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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
add
Description copied from interface:JsonArray
Adds an object at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
add
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
add
Description copied from interface:JsonArray
Adds an object at the specified index.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
add
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
addAll
Description copied from interface:JsonArray
Adds all elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
addAll
Description copied from interface:JsonArray
Adds all elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
addAll
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
addAll
Description copied from interface:JsonArray
Adds all elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
addAll
Description copied from interface:JsonArray
Adds elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
addAll
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
addAll
Description copied from interface:JsonArray
Adds all elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
addAll
Description copied from interface:JsonArray
Adds elements at the end of the array.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
addAll
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
set
Description copied from interface:JsonArray
Sets an object at the specified index. If there is an element at this index, it is overwritten.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
-
set
Description copied from interface:JsonArray
Sets an object at the specified index. If there is an element at this index, it is overwritten.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 aJsonArray
and is immutable, it will be cloned. Doing so, we can make sure theJsonArray
is always fully mutable or fully immutable.If the element implements
ToJsonObjectConvertible
, it will be converted to aJsonObject
using the associated conversion method. If it implementsToJsonArrayConvertible
, it will be converted to anJsonArray
using the associated conversion method.Those are the types of objects that will be converted to a
JsonArray
instead of aJsonObject
, if no conversion interface is implemented :- A Collection
- An array
- Specified by:
set
in interfaceJsonArray
clone
- iftrue
, and the element to add is aJsonObject
orJsonArray
, 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 aJsonArray
is always fully mutable or fully immutable.
-
setOrAdd
-
addAsIs
-
addAsIs
-
setOrAddAsIs
-
remove
Description copied from interface:JsonObjectOrArray
Removes an element atJsonPath
.- Specified by:
remove
in interfaceJsonObjectOrArray
- Returns:
- the current object (fluent style).
-
remove
Description copied from interface:JsonArray
Removes an element at the specified index. Any elements to the right are shift to the left. If the index is invalid, nothing is done. -
clear
Description copied from interface:JsonObjectOrArray
Clears all elements.- Specified by:
clear
in interfaceJsonObjectOrArray
-
size
public int size()Description copied from interface:JsonObjectOrArray
The size of the object.- Specified by:
size
in interfaceJsonObjectOrArray
-
isElementExists
public boolean isElementExists(int index) Description copied from interface:JsonArray
Is there an element at the specified index? This returnstrue
even if the element isnull
.This is a synonym of
index >= 0 && index < size()
- Specified by:
isElementExists
in interfaceJsonArray
-
iterator
-
convertToStringList
Description copied from interface:JsonArray
Converts the JsonArray to aList<String>
. To do so, thetoString()
method will be called on any non null element.This list is always a new instance and is mutable.
- Specified by:
convertToStringList
in interfaceJsonArray
-
getJsonObject
Description copied from interface:JsonArray
Gets an element asJsonObject
.- Specified by:
getJsonObject
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getJsonObject
Description copied from interface:JsonArray
Gets an element asJsonObject
.- Specified by:
getJsonObject
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getJsonObjectOrEmpty
Description copied from interface:JsonArray
Gets an element asJsonObject
.- Specified by:
getJsonObjectOrEmpty
in interfaceJsonArray
- Returns:
- the element or an empty
JsonObject
if not found or ifnull
.
-
getJsonArray
Description copied from interface:JsonArray
Gets an element asJsonArray
.- Specified by:
getJsonArray
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getJsonArray
Description copied from interface:JsonArray
Gets an element asJsonArray
.- Specified by:
getJsonArray
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getJsonArrayOrEmpty
Description copied from interface:JsonArray
Gets an element asJsonArray
.- Specified by:
getJsonArrayOrEmpty
in interfaceJsonArray
- Returns:
- the element or an empty
JsonArray
if not found or ifnull
.
-
getString
Description copied from interface:JsonArray
Gets an element asString
. -
getString
Description copied from interface:JsonArray
Gets an element asString
. -
getInteger
Description copied from interface:JsonArray
Gets an element asInteger
.- Specified by:
getInteger
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getInteger
Description copied from interface:JsonArray
Gets an element asInteger
.- Specified by:
getInteger
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getLong
Description copied from interface:JsonArray
Gets an element asLong
. -
getLong
Description copied from interface:JsonArray
Gets an element asLong
. -
getDouble
Description copied from interface:JsonArray
Gets an element asDouble
. -
getDouble
Description copied from interface:JsonArray
Gets an element asDouble
. -
getFloat
Description copied from interface:JsonArray
Gets an element asFloat
. -
getFloat
Description copied from interface:JsonArray
Gets an element asFloat
. -
getBoolean
Description copied from interface:JsonArray
Gets an element asBoolean
.- Specified by:
getBoolean
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getBoolean
Description copied from interface:JsonArray
Gets an element asBoolean
.- Specified by:
getBoolean
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getBigDecimal
Description copied from interface:JsonArray
Gets an element asBigDecimal
.- Specified by:
getBigDecimal
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getBigDecimal
Description copied from interface:JsonArray
Gets an element asBigDecimal
.- Specified by:
getBigDecimal
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getBytesFromBase64String
public byte[] getBytesFromBase64String(int index) Description copied from interface:JsonArray
Gets a byte array, from a base 64 encoded element.- Specified by:
getBytesFromBase64String
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getBytesFromBase64String
public byte[] getBytesFromBase64String(int index, byte[] defaultValue) Description copied from interface:JsonArray
Gets a byte array, from a base 64 encoded element.- Specified by:
getBytesFromBase64String
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getDate
Description copied from interface:JsonArray
Gets a UTC timezoned date from aISO 8601
date element. -
getDate
Description copied from interface:JsonArray
Gets a UTC timezoned date from aISO 8601
date element. -
getInstant
Description copied from interface:JsonArray
Gets an Instant from aISO 8601
date element.- Specified by:
getInstant
in interfaceJsonArray
- Returns:
- the element or
null
if not found.
-
getInstant
Description copied from interface:JsonArray
Gets an Instant from aISO 8601
date element.- Specified by:
getInstant
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if not found.
-
getObject
Description copied from interface:JsonArray
Gets an element, untyped. -
getObject
Description copied from interface:JsonArray
Gets an element, untyped. -
getElementNoKeyParsing
protected Object getElementNoKeyParsing(String jsonPath, boolean hasDefaultValue, Object defaultValue) Description copied from class:JsonObjectArrayBase
Gets the element at this key/index, without key parsing.- Specified by:
getElementNoKeyParsing
in classJsonObjectArrayBase
-
getArrayFirst
protected <T> T getArrayFirst(int index, boolean hasDefaultValue, T defaultValue, JsonObjectDefault.IFirstElementGetter<T> firstElementGetter) -
getArrayFirstJsonObject
Description copied from interface:JsonArray
Gets the first element (as JsonObject) of aJsonArray
element.- Specified by:
getArrayFirstJsonObject
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstJsonObject
Description copied from interface:JsonArray
Gets the first element (as JsonObject) of aJsonArray
element.- Specified by:
getArrayFirstJsonObject
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstJsonArray
Description copied from interface:JsonArray
Gets the first element (as JsonArray) of aJsonArray
element.- Specified by:
getArrayFirstJsonArray
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstJsonArray
Description copied from interface:JsonArray
Gets the first element (as JsonArray) of aJsonArray
element.- Specified by:
getArrayFirstJsonArray
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstString
Description copied from interface:JsonArray
Gets the first element (as String) of aJsonArray
element.- Specified by:
getArrayFirstString
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstString
Description copied from interface:JsonArray
Gets the first element (as String) of aJsonArray
element.- Specified by:
getArrayFirstString
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstInteger
Description copied from interface:JsonArray
Gets the first element (as Integer) of aJsonArray
element.- Specified by:
getArrayFirstInteger
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstInteger
Description copied from interface:JsonArray
Gets the first element (as Integer) of aJsonArray
element.- Specified by:
getArrayFirstInteger
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstLong
Description copied from interface:JsonArray
Gets the first element (as Long) of aJsonArray
element.- Specified by:
getArrayFirstLong
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstLong
Description copied from interface:JsonArray
Gets the first element (as Long) of aJsonArray
element.- Specified by:
getArrayFirstLong
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstDouble
Description copied from interface:JsonArray
Gets the first element (as Double) of aJsonArray
element.- Specified by:
getArrayFirstDouble
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstDouble
Description copied from interface:JsonArray
Gets the first element (as Double) of aJsonArray
element.- Specified by:
getArrayFirstDouble
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstFloat
Description copied from interface:JsonArray
Gets the first element (as Float) of aJsonArray
element.- Specified by:
getArrayFirstFloat
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstFloat
Description copied from interface:JsonArray
Gets the first element (as Float) of aJsonArray
element.- Specified by:
getArrayFirstFloat
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstBoolean
Description copied from interface:JsonArray
Gets the first element (as Boolean) of aJsonArray
element.- Specified by:
getArrayFirstBoolean
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstBoolean
Description copied from interface:JsonArray
Gets the first element (as Boolean) of aJsonArray
element.- Specified by:
getArrayFirstBoolean
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstBigDecimal
Description copied from interface:JsonArray
Gets the first element (as BigDecimal) of aJsonArray
element.- Specified by:
getArrayFirstBigDecimal
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstBigDecimal
Description copied from interface:JsonArray
Gets the first element (as BigDecimal) of aJsonArray
element.- Specified by:
getArrayFirstBigDecimal
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstBytesFromBase64String
public byte[] getArrayFirstBytesFromBase64String(int index) Description copied from interface:JsonArray
Gets the first element (as byte[]) of aJsonArray
element.- Specified by:
getArrayFirstBytesFromBase64String
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstBytesFromBase64String
public byte[] getArrayFirstBytesFromBase64String(int index, byte[] defaultValue) Description copied from interface:JsonArray
Gets the first element (as byte[]) of aJsonArray
element.- Specified by:
getArrayFirstBytesFromBase64String
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstDate
Description copied from interface:JsonArray
Gets the first element (as Date) of aJsonArray
element.- Specified by:
getArrayFirstDate
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstDate
Description copied from interface:JsonArray
Gets the first element (as Date) of aJsonArray
element.- Specified by:
getArrayFirstDate
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
getArrayFirstInstant
Description copied from interface:JsonArray
Gets the first element (as Instant) of aJsonArray
element.- Specified by:
getArrayFirstInstant
in interfaceJsonArray
- Returns:
- the element or
null
if the array or the first element are not found.
-
getArrayFirstInstant
Description copied from interface:JsonArray
Gets the first element (as Instant) of aJsonArray
element.- Specified by:
getArrayFirstInstant
in interfaceJsonArray
- Returns:
- the element or the specified
defaultValue
if the array or the first element are not found.
-
convertToPlainList
Description copied from interface:JsonArray
Converts theJsonArray
to a plainList<Object>
. AllJsonObject
elements will be converted to Maps and allJsonArray
elements will be converted to Lists.This list is always a new instance and is mutable.
- Specified by:
convertToPlainList
in interfaceJsonArray
-
isCanBeConvertedToString
public boolean isCanBeConvertedToString(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeString
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToString
in interfaceJsonArray
-
isCanBeConvertedToInteger
public boolean isCanBeConvertedToInteger(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeInteger
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToInteger
in interfaceJsonArray
-
isCanBeConvertedToLong
public boolean isCanBeConvertedToLong(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeLong
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToLong
in interfaceJsonArray
-
isCanBeConvertedToFloat
public boolean isCanBeConvertedToFloat(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeFloat
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToFloat
in interfaceJsonArray
-
isCanBeConvertedToDouble
public boolean isCanBeConvertedToDouble(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeDouble
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToDouble
in interfaceJsonArray
-
isCanBeConvertedToBoolean
public boolean isCanBeConvertedToBoolean(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeBoolean
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToBoolean
in interfaceJsonArray
-
isCanBeConvertedToBigDecimal
public boolean isCanBeConvertedToBigDecimal(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeBigDecimal
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToBigDecimal
in interfaceJsonArray
-
isCanBeConvertedToByteArray
public boolean isCanBeConvertedToByteArray(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typebase 64 String
representing a byte array, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToByteArray
in interfaceJsonArray
-
isCanBeConvertedToDate
public boolean isCanBeConvertedToDate(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeDate
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToDate
in interfaceJsonArray
-
isCanBeConvertedToJsonObject
public boolean isCanBeConvertedToJsonObject(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeJsonObject
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToJsonObject
in interfaceJsonArray
-
isCanBeConvertedToJsonArray
public boolean isCanBeConvertedToJsonArray(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
, of typeJsonArray
, or can be converted and retrieved as one.- Specified by:
isCanBeConvertedToJsonArray
in interfaceJsonArray
-
isOfTypeString
public boolean isOfTypeString(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeString
, without requiring any conversion.- Specified by:
isOfTypeString
in interfaceJsonArray
-
isOfTypeInteger
public boolean isOfTypeInteger(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeInteger
, without requiring any conversion.- Specified by:
isOfTypeInteger
in interfaceJsonArray
-
isOfTypeLong
public boolean isOfTypeLong(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeLong
, without requiring any conversion.- Specified by:
isOfTypeLong
in interfaceJsonArray
-
isOfTypeFloat
public boolean isOfTypeFloat(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeFloat
, without requiring any conversion.- Specified by:
isOfTypeFloat
in interfaceJsonArray
-
isOfTypeDouble
public boolean isOfTypeDouble(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeDouble
, without requiring any conversion.- Specified by:
isOfTypeDouble
in interfaceJsonArray
-
isOfTypeBoolean
public boolean isOfTypeBoolean(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeBoolean
, without requiring any conversion.- Specified by:
isOfTypeBoolean
in interfaceJsonArray
-
isOfTypeBigDecimal
public boolean isOfTypeBigDecimal(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeBigDecimal
, without requiring any conversion.- Specified by:
isOfTypeBigDecimal
in interfaceJsonArray
-
isOfTypeByteArray
public boolean isOfTypeByteArray(int index, boolean acceptBase64StringToo) Description copied from interface:JsonArray
Validates that the element at the specifiedJsonPath
exists and is currentlynull
or of typebyte[]
, without requiring any conversion.- Specified by:
isOfTypeByteArray
in interfaceJsonArray
acceptBase64StringToo
- iftrue
, then a valid base 64 String will also be accepted.
-
isOfTypeDate
public boolean isOfTypeDate(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeDate
, without requiring any conversion.- Specified by:
isOfTypeDate
in interfaceJsonArray
-
isOfTypeJsonObject
public boolean isOfTypeJsonObject(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeJsonObject
, without requiring any conversion.- Specified by:
isOfTypeJsonObject
in interfaceJsonArray
-
isOfTypeJsonArray
public boolean isOfTypeJsonArray(int index) Description copied from interface:JsonArray
Validates that the element at the specifiedindex
exists and is currentlynull
or of typeJsonArray
, without requiring any conversion.- Specified by:
isOfTypeJsonArray
in interfaceJsonArray
-
isNull
public boolean isNull(int index) Description copied from interface:JsonArray
Validates that there is an element at the specifiedindex
and it isnull
. -
isEquivalentTo
Description copied from interface:JsonArray
Compares the currentJsonArray
to the specified one and returnstrue
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 tonew BigDecimal("123")
or to123L
.- Specified by:
isEquivalentTo
in interfaceJsonArray
-
clone
Description copied from class:JsonObjectArrayBase
Clone the object.- Specified by:
clone
in interfaceJsonArray
- Specified by:
clone
in interfaceJsonObjectOrArray
- Specified by:
clone
in classJsonObjectArrayBase
- Parameters:
mutable
- iftrue
the resulting object and all its children will be mutable, otherwise they will all be immutable.
-
transformAll
Description copied from interface:JsonObjectOrArray
Transforms all the elements of the object, using the specified transformer.- Specified by:
transformAll
in interfaceJsonObjectOrArray
- Specified by:
transformAll
in classJsonObjectArrayBase
recursive
- iftrue
, then all children elements will also be transformed, recursively.
-
transform
Description copied from interface:JsonArray
Transforms the element at the given index, using the specifiedElementTransformer
. -
trim
public void trim(int index) Description copied from interface:JsonArray
Trims the element, if it's of typeString
. -
putAsIs
- Specified by:
putAsIs
in classJsonObjectArrayBase
-