public class JsonArrayDefault extends JsonObjectArrayBase implements JsonArray
JsonArray implementation.JsonObjectArrayBase.JsonPathCachingItem| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
defaultElementValidator| Constructor and Description |
|---|
JsonArrayDefault(JsonManager jsonManager,
SpincastUtils spincastUtils,
ObjectConverter objectConverter)
Constructor
|
JsonArrayDefault(List<Object> initialElements,
boolean mutable,
JsonManager jsonManager,
SpincastUtils spincastUtils,
ObjectConverter objectConverter)
Constructor
|
JsonArrayDefault(List<Object> initialElements,
JsonManager jsonManager,
SpincastUtils spincastUtils,
ObjectConverter objectConverter)
Constructor
|
| 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.
|
protected JsonArray |
addAsIs(Integer index,
Object value) |
protected JsonArray |
addAsIs(Object value) |
JsonArray |
clear()
Clears all elements.
|
JsonArray |
clone(boolean mutable)
Clone the object.
|
List<Object> |
convertToPlainList()
Converts the
JsonArray to a plain List<Object>. |
List<String> |
convertToStringList()
Converts the JsonArray to a
List<String>. |
protected <T> T |
getArrayFirst(int index,
boolean hasDefaultValue,
T defaultValue,
JsonObjectDefault.IFirstElementGetter<T> firstElementGetter) |
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. |
protected Object |
getElement(int index) |
protected Object |
getElementNoKeyParsing(String jsonPath,
boolean hasDefaultValue,
Object defaultValue)
Gets the element at this key/index, without
key parsing.
|
protected List<Object> |
getElements() |
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. |
Iterator<Object> |
iterator() |
protected JsonArray |
putAsIs(String key,
Object value) |
JsonArray |
remove(int index)
Removes an element at the specified index.
|
JsonArray |
remove(String jsonPath)
Removes an element at
JsonPath. |
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.
|
JsonArray |
setOrAdd(Integer index,
Object value,
boolean clone,
boolean insert) |
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
specified
ElementTransformer. |
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 type
String. |
clone, 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, isElementExists, 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, put, set, set, toJsonString, toJsonString, toString, transform, transformAll, trim, trimAll, trimAll, validateIsNullequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetArrayFirstBigDecimal, 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, isElementExists, isMutable, isNull, isOfTypeBigDecimal, isOfTypeBoolean, isOfTypeByteArray, isOfTypeDate, isOfTypeDouble, isOfTypeFloat, isOfTypeInteger, isOfTypeJsonArray, isOfTypeJsonObject, isOfTypeLong, isOfTypeString, set, set, toJsonString, toJsonString, transform, transformAll, trim, trimAll, trimAllforEach, spliteratorpublic JsonArrayDefault(JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter)
public JsonArrayDefault(@Nullable List<Object> initialElements, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter)
public JsonArrayDefault(@Nullable List<Object> initialElements, boolean mutable, JsonManager jsonManager, SpincastUtils spincastUtils, ObjectConverter objectConverter)
protected Object getElement(int index)
public JsonArray add(Object value)
JsonArrayIf 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 :
public JsonArray add(int index, Object value)
JsonArray
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 :
public JsonArray add(Object value, boolean clone)
JsonArrayIf 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 :
add in interface JsonArrayclone - 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.public JsonArray add(int index, Object value, boolean clone)
JsonArrayAny 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 :
add in interface JsonArrayclone - 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.public JsonArray addAll(Collection<?> values)
JsonArrayIf 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 :
public JsonArray addAll(Collection<?> values, boolean clone)
JsonArrayIf 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 :
addAll in interface JsonArrayclone - 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.public JsonArray addAll(Object[] values)
JsonArrayIf 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 :
public JsonArray addAll(Object[] values, boolean clone)
JsonArrayIf 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 :
addAll in interface JsonArrayclone - 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.public JsonArray addAll(JsonArray values)
JsonArrayIf 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 :
public JsonArray addAll(JsonArray values, boolean clone)
JsonArrayIf 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 :
addAll in interface JsonArrayclone - 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.public JsonArray set(int index, Object value)
JsonArray
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 :
public JsonArray set(int index, Object value, boolean clone)
JsonArray
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 :
set in interface JsonArrayclone - 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.public JsonArray remove(String jsonPath)
JsonObjectOrArrayJsonPath.remove in interface JsonObjectOrArraypublic JsonArray remove(int index)
JsonArraypublic JsonArray clear()
JsonObjectOrArrayclear in interface JsonObjectOrArraypublic int size()
JsonObjectOrArraysize in interface JsonObjectOrArraypublic boolean isElementExists(int index)
JsonArraytrue even if the element is null.
This is a synonym of index >= 0 && index < size()
isElementExists in interface JsonArraypublic List<String> convertToStringList()
JsonArrayList<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.
convertToStringList in interface JsonArraypublic JsonObject getJsonObject(int index)
JsonArrayJsonObject.getJsonObject in interface JsonArraynull if not found.public JsonObject getJsonObject(int index, JsonObject defaultValue)
JsonArrayJsonObject.getJsonObject in interface JsonArraydefaultValue if not found.public JsonObject getJsonObjectOrEmpty(int index)
JsonArrayJsonObject.getJsonObjectOrEmpty in interface JsonArrayJsonObject if not found
or if null.public JsonArray getJsonArray(int index)
JsonArrayJsonArray.getJsonArray in interface JsonArraynull if not found.public JsonArray getJsonArray(int index, JsonArray defaultValue)
JsonArrayJsonArray.getJsonArray in interface JsonArraydefaultValue if not found.public JsonArray getJsonArrayOrEmpty(int index)
JsonArrayJsonArray.getJsonArrayOrEmpty in interface JsonArrayJsonArray if not found or if null.public String getString(int index)
JsonArrayString.public String getString(int index, String defaultValue)
JsonArrayString.public Integer getInteger(int index)
JsonArrayInteger.getInteger in interface JsonArraynull if not found.public Integer getInteger(int index, Integer defaultValue)
JsonArrayInteger.getInteger in interface JsonArraydefaultValue if not found.public Long getLong(int index)
JsonArrayLong.public Long getLong(int index, Long defaultValue)
JsonArrayLong.public Double getDouble(int index)
JsonArrayDouble.public Double getDouble(int index, Double defaultValue)
JsonArrayDouble.public Float getFloat(int index)
JsonArrayFloat.public Float getFloat(int index, Float defaultValue)
JsonArrayFloat.public Boolean getBoolean(int index)
JsonArrayBoolean.getBoolean in interface JsonArraynull if not found.public Boolean getBoolean(int index, Boolean defaultValue)
JsonArrayBoolean.getBoolean in interface JsonArraydefaultValue if not found.public BigDecimal getBigDecimal(int index)
JsonArrayBigDecimal.getBigDecimal in interface JsonArraynull if not found.public BigDecimal getBigDecimal(int index, BigDecimal defaultValue)
JsonArrayBigDecimal.getBigDecimal in interface JsonArraydefaultValue if not found.public byte[] getBytesFromBase64String(int index)
JsonArraygetBytesFromBase64String in interface JsonArraynull if not found.public byte[] getBytesFromBase64String(int index,
byte[] defaultValue)
JsonArraygetBytesFromBase64String in interface JsonArraydefaultValue if not found.public Date getDate(int index)
JsonArrayISO 8601 date element.public Date getDate(int index, Date defaultValue)
JsonArrayISO 8601 date element.public Instant getInstant(int index)
JsonArrayISO 8601 date element.getInstant in interface JsonArraynull if not found.public Instant getInstant(int index, Instant defaultValue)
JsonArrayISO 8601 date element.getInstant in interface JsonArraydefaultValue if not found.public Object getObject(int index)
JsonArraypublic Object getObject(int index, Object defaultValue)
JsonArrayprotected Object getElementNoKeyParsing(String jsonPath, boolean hasDefaultValue, Object defaultValue)
JsonObjectArrayBasegetElementNoKeyParsing in class JsonObjectArrayBaseprotected <T> T getArrayFirst(int index,
boolean hasDefaultValue,
T defaultValue,
JsonObjectDefault.IFirstElementGetter<T> firstElementGetter)
public JsonObject getArrayFirstJsonObject(int index)
JsonArrayJsonArray element.getArrayFirstJsonObject in interface JsonArraynull if the array or
the first element are not found.public JsonObject getArrayFirstJsonObject(int index, JsonObject defaultValue)
JsonArrayJsonArray element.getArrayFirstJsonObject in interface JsonArraydefaultValue if the array or
the first element are not found.public JsonArray getArrayFirstJsonArray(int index)
JsonArrayJsonArray element.getArrayFirstJsonArray in interface JsonArraynull if the array or
the first element are not found.public JsonArray getArrayFirstJsonArray(int index, JsonArray defaultValue)
JsonArrayJsonArray element.getArrayFirstJsonArray in interface JsonArraydefaultValue if the array or
the first element are not found.public String getArrayFirstString(int index)
JsonArrayJsonArray element.getArrayFirstString in interface JsonArraynull if the array or
the first element are not found.public String getArrayFirstString(int index, String defaultValue)
JsonArrayJsonArray element.getArrayFirstString in interface JsonArraydefaultValue if the array or
the first element are not found.public Integer getArrayFirstInteger(int index)
JsonArrayJsonArray element.getArrayFirstInteger in interface JsonArraynull if the array or
the first element are not found.public Integer getArrayFirstInteger(int index, Integer defaultValue)
JsonArrayJsonArray element.getArrayFirstInteger in interface JsonArraydefaultValue if the array or
the first element are not found.public Long getArrayFirstLong(int index)
JsonArrayJsonArray element.getArrayFirstLong in interface JsonArraynull if the array or
the first element are not found.public Long getArrayFirstLong(int index, Long defaultValue)
JsonArrayJsonArray element.getArrayFirstLong in interface JsonArraydefaultValue if the array or
the first element are not found.public Double getArrayFirstDouble(int index)
JsonArrayJsonArray element.getArrayFirstDouble in interface JsonArraynull if the array or
the first element are not found.public Double getArrayFirstDouble(int index, Double defaultValue)
JsonArrayJsonArray element.getArrayFirstDouble in interface JsonArraydefaultValue if the array or
the first element are not found.public Float getArrayFirstFloat(int index)
JsonArrayJsonArray element.getArrayFirstFloat in interface JsonArraynull if the array or
the first element are not found.public Float getArrayFirstFloat(int index, Float defaultValue)
JsonArrayJsonArray element.getArrayFirstFloat in interface JsonArraydefaultValue if the array or
the first element are not found.public Boolean getArrayFirstBoolean(int index)
JsonArrayJsonArray element.getArrayFirstBoolean in interface JsonArraynull if the array or
the first element are not found.public Boolean getArrayFirstBoolean(int index, Boolean defaultValue)
JsonArrayJsonArray element.getArrayFirstBoolean in interface JsonArraydefaultValue if the array or
the first element are not found.public BigDecimal getArrayFirstBigDecimal(int index)
JsonArrayJsonArray element.getArrayFirstBigDecimal in interface JsonArraynull if the array or
the first element are not found.public BigDecimal getArrayFirstBigDecimal(int index, BigDecimal defaultValue)
JsonArrayJsonArray element.getArrayFirstBigDecimal in interface JsonArraydefaultValue if the array or
the first element are not found.public byte[] getArrayFirstBytesFromBase64String(int index)
JsonArrayJsonArray element.getArrayFirstBytesFromBase64String in interface JsonArraynull if the array or
the first element are not found.public byte[] getArrayFirstBytesFromBase64String(int index,
byte[] defaultValue)
JsonArrayJsonArray element.getArrayFirstBytesFromBase64String in interface JsonArraydefaultValue if the array or
the first element are not found.public Date getArrayFirstDate(int index)
JsonArrayJsonArray element.getArrayFirstDate in interface JsonArraynull if the array or
the first element are not found.public Date getArrayFirstDate(int index, Date defaultValue)
JsonArrayJsonArray element.getArrayFirstDate in interface JsonArraydefaultValue if the array or
the first element are not found.public Instant getArrayFirstInstant(int index)
JsonArrayJsonArray element.getArrayFirstInstant in interface JsonArraynull if the array or
the first element are not found.public Instant getArrayFirstInstant(int index, Instant defaultValue)
JsonArrayJsonArray element.getArrayFirstInstant in interface JsonArraydefaultValue if the array or
the first element are not found.public List<Object> convertToPlainList()
JsonArrayJsonArray to a plain List<Object>.
All JsonObject elements will be converted to
Maps and all JsonArray elements will be converted to
Lists.
This list is always a new instance and is mutable.
convertToPlainList in interface JsonArraypublic boolean isCanBeConvertedToString(int index)
JsonArrayindex exists and
is currently null, of type String, or can be
converted and retrieved as one.isCanBeConvertedToString in interface JsonArraypublic boolean isCanBeConvertedToInteger(int index)
JsonArrayindex exists and
is currently null, of type Integer, or can be
converted and retrieved as one.isCanBeConvertedToInteger in interface JsonArraypublic boolean isCanBeConvertedToLong(int index)
JsonArrayindex exists and
is currently null, of type Long, or can be
converted and retrieved as one.isCanBeConvertedToLong in interface JsonArraypublic boolean isCanBeConvertedToFloat(int index)
JsonArrayindex exists and
is currently null, of type Float, or can be
converted and retrieved as one.isCanBeConvertedToFloat in interface JsonArraypublic boolean isCanBeConvertedToDouble(int index)
JsonArrayindex exists and
is currently null, of type Double, or can be
converted and retrieved as one.isCanBeConvertedToDouble in interface JsonArraypublic boolean isCanBeConvertedToBoolean(int index)
JsonArrayindex exists and
is currently null, of type Boolean, or can be
converted and retrieved as one.isCanBeConvertedToBoolean in interface JsonArraypublic boolean isCanBeConvertedToBigDecimal(int index)
JsonArrayindex exists and
is currently null, of type BigDecimal, or can be
converted and retrieved as one.isCanBeConvertedToBigDecimal in interface JsonArraypublic boolean isCanBeConvertedToByteArray(int index)
JsonArrayindex exists and
is currently null, of type base 64 String representing
a byte array, or can be converted and retrieved as one.isCanBeConvertedToByteArray in interface JsonArraypublic boolean isCanBeConvertedToDate(int index)
JsonArrayindex exists and
is currently null, of type Date, or can be
converted and retrieved as one.isCanBeConvertedToDate in interface JsonArraypublic boolean isCanBeConvertedToJsonObject(int index)
JsonArrayindex exists and
is currently null, of type JsonObject, or can be
converted and retrieved as one.isCanBeConvertedToJsonObject in interface JsonArraypublic boolean isCanBeConvertedToJsonArray(int index)
JsonArrayindex exists and
is currently null, of type JsonArray, or can be
converted and retrieved as one.isCanBeConvertedToJsonArray in interface JsonArraypublic boolean isOfTypeString(int index)
JsonArrayindex exists and
is currently null or of type String, without requiring
any conversion.isOfTypeString in interface JsonArraypublic boolean isOfTypeInteger(int index)
JsonArrayindex exists and
is currently null or of type Integer, without requiring
any conversion.isOfTypeInteger in interface JsonArraypublic boolean isOfTypeLong(int index)
JsonArrayindex exists and
is currently null or of type Long, without requiring
any conversion.isOfTypeLong in interface JsonArraypublic boolean isOfTypeFloat(int index)
JsonArrayindex exists and
is currently null or of type Float, without requiring
any conversion.isOfTypeFloat in interface JsonArraypublic boolean isOfTypeDouble(int index)
JsonArrayindex exists and
is currently null or of type Double, without requiring
any conversion.isOfTypeDouble in interface JsonArraypublic boolean isOfTypeBoolean(int index)
JsonArrayindex exists and
is currently null or of type Boolean, without requiring
any conversion.isOfTypeBoolean in interface JsonArraypublic boolean isOfTypeBigDecimal(int index)
JsonArrayindex exists and
is currently null or of type BigDecimal, without requiring
any conversion.isOfTypeBigDecimal in interface JsonArraypublic boolean isOfTypeByteArray(int index,
boolean acceptBase64StringToo)
JsonArrayJsonPath exists and
is currently null or of type byte[], without requiring
any conversion.isOfTypeByteArray in interface JsonArrayacceptBase64StringToo - if true, then a valid base 64 String
will also be accepted.public boolean isOfTypeDate(int index)
JsonArrayindex exists and
is currently null or of type Date, without requiring
any conversion.isOfTypeDate in interface JsonArraypublic boolean isOfTypeJsonObject(int index)
JsonArrayindex exists and
is currently null or of type JsonObject, without requiring
any conversion.isOfTypeJsonObject in interface JsonArraypublic boolean isOfTypeJsonArray(int index)
JsonArrayindex exists and
is currently null or of type JsonArray, without requiring
any conversion.isOfTypeJsonArray in interface JsonArraypublic boolean isNull(int index)
JsonArrayindex and
it is null.public boolean isEquivalentTo(JsonArray other)
JsonArrayJsonArray 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.
isEquivalentTo in interface JsonArraypublic JsonArray clone(boolean mutable)
JsonObjectArrayBaseclone in interface JsonArrayclone in interface JsonObjectOrArrayclone in class JsonObjectArrayBasemutable - if true the resulting
object and all its children will be mutable, otherwise
they will all be immutable.public void transformAll(ElementTransformer transformer, boolean recursive)
JsonObjectOrArraytransformAll in interface JsonObjectOrArraytransformAll in class JsonObjectArrayBaserecursive - if true,
then all children elements will also be transformed,
recursively.public void transform(int index,
ElementTransformer transformer)
JsonArrayElementTransformer.public void trim(int index)
JsonArrayString.protected JsonArray putAsIs(String key, Object value)
putAsIs in class JsonObjectArrayBaseCopyright © 2018. All rights reserved.