public interface IJsonArray extends Iterable<Object>
Json array "[]", and makes it easier
to get its elements in a typed way.| Modifier and Type | Method and Description |
|---|---|
IJsonArray |
add(BigDecimal value)
Adds a BigDecimal.
|
IJsonArray |
add(Boolean value)
Adds a Boolean.
|
IJsonArray |
add(byte[] value)
Adds a byte[].
|
IJsonArray |
add(Date value)
Adds a Date.
|
IJsonArray |
add(Double value)
Adds a Double.
|
IJsonArray |
add(Float value)
Adds a Float.
|
IJsonArray |
add(IJsonArray value)
Adds a IJsonArray.
|
IJsonArray |
add(IJsonArray value,
boolean clone)
Adds a IJsonArray.
|
IJsonArray |
add(IJsonObject value)
Adds a IJsonObject.
|
IJsonArray |
add(IJsonObject value,
boolean clone)
Adds a IJsonObject.
|
IJsonArray |
add(Integer value)
Adds a Integer.
|
IJsonArray |
add(Long value)
Adds a Long.
|
IJsonArray |
add(String value)
Adds a String.
|
IJsonArray |
addConvert(Object value)
If the object to add is not of a IJsonObject's native type,
then the object will be converted to a IJsonObject or a
IJsonArray before being added.
|
IJsonArray |
addConvert(Object value,
boolean clone)
If the object to add is not of a IJsonObject's native type,
then the object will be converted to a IJsonObject or a
IJsonArray before being added.
|
IJsonArray |
clear()
Clears all elements.
|
IJsonArray |
clone()
Deep copy of the
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa. |
IJsonArray |
clone(boolean mutable)
Deep copy of the
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa. |
List<Object> |
convertToPlainList()
Converts the
IJsonArray to a plain List<Object>. |
List<String> |
convertToStringList()
Converts the IJsonArray to a
List<String>. |
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 property.
|
byte[] |
getBytesFromBase64String(int index,
byte[] defaultValue)
Gets a byte array, from a base 64 encoded property.
|
Date |
getDate(int index)
Gets a UTC timezoned date from a
ISO 8601 date property. |
Date |
getDate(int index,
Date defaultValue)
Gets a UTC timezoned date from a
ISO 8601 date property. |
Double |
getDouble(int index)
Gets an element as
Double. |
Double |
getDouble(int index,
Double defaultValue)
Gets an element as
Double. |
Float |
getFloat(int index)
Gets an element as
Float. |
Float |
getFloat(int index,
Float defaultValue)
Gets an element as
Float. |
Integer |
getInteger(int index)
Gets an element as
Integer. |
Integer |
getInteger(int index,
Integer defaultValue)
Gets an element as
Integer. |
IJsonArray |
getJsonArray(int index)
Gets an element as
IJsonArray. |
IJsonArray |
getJsonArray(int index,
IJsonArray defaultValue)
Gets an element as
IJsonArray. |
IJsonArray |
getJsonArrayOrEmpty(int index)
Gets an element as
IJsonArray. |
IJsonObject |
getJsonObject(int index)
Gets an element as
IJsonObject. |
IJsonObject |
getJsonObject(int index,
IJsonObject defaultValue)
Gets an element as
IJsonObject. |
IJsonObject |
getJsonObjectOrEmpty(int index)
Gets an element as
IJsonObject. |
Long |
getLong(int index)
Gets an element as
Long. |
Long |
getLong(int index,
Long defaultValue)
Gets an element as
Long. |
String |
getString(int index)
Gets an element as
String. |
String |
getString(int index,
String defaultValue)
Gets an element as
String. |
IJsonArray |
remove(int index)
Removes an element at the specified position.
|
int |
size()
The array size.
|
String |
toJsonString()
The
Json string representation
of the array. |
String |
toJsonString(boolean pretty)
The
Json string representation
of the array. |
forEach, iterator, spliteratorIJsonArray add(String value)
IJsonArray add(Integer value)
IJsonArray add(Long value)
IJsonArray add(Float value)
IJsonArray add(Double value)
IJsonArray add(Boolean value)
IJsonArray add(BigDecimal value)
IJsonArray add(byte[] value)
IJsonArray add(Date value)
IJsonArray add(IJsonObject value)
IJsonObject to add is immutable
then it will always be cloned. Doing so, we can make sure a
IJsonArray is always
fully mutable or fully immutable.IJsonArray add(IJsonObject value, boolean clone)
clone - if true, a clone of the original
object will be made before being added.
If that case, any modification to the original object
won't affect the added element, and vice-versa.
If the IJsonObject
to add is immutable then it will always be cloned.
Doing so, we can make sure a IJsonArray is always
fully mutable or fully immutable.IJsonArray add(IJsonArray value)
IJsonArray to add is immutable
then it will always be cloned. Doing so, we can make sure a
IJsonArray is always
fully mutable or fully immutable.IJsonArray add(IJsonArray value, boolean clone)
clone - if true, a clone of the original
object will be made before being added.
If that case, any modification to the original IJsonArray
won't affect the added element, and vice-versa.
If the IJsonArray
to add is immutable then it will always be cloned.
Doing so, we can make sure a IJsonArray is always
fully mutable or fully immutable.IJsonArray addConvert(Object value)
If the element to add is a IJsonObject or
a IJsonArray and is immutable then
it will be cloned.
Doing so, we can make sure a IJsonArray is always
fully mutable or fully immutable.
Those are the types of objects that will be converted to a IJsonArray instead of a IJsonObject :
IJsonArray addConvert(Object value, boolean clone)
Those are the types of object that will be converted to a IJsonArray instead of a IJsonObject :
clone - if true, and the element to add is a
IJsonObject or IJsonArray, 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
IJsonArray is always
fully mutable or fully immutable.IJsonArray remove(int index)
IJsonArray clear()
int size()
String toJsonString()
Json string representation
of the array.String toJsonString(boolean pretty)
Json string representation
of the array.pretty - if true, the generated String will be formatted.IJsonObject getJsonObject(int index)
IJsonObject.null if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonObject getJsonObject(int index, IJsonObject defaultValue)
IJsonObject.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonObject getJsonObjectOrEmpty(int index)
IJsonObject.IJsonObject if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonArray getJsonArray(int index)
IJsonArray.null if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonArray getJsonArray(int index, IJsonArray defaultValue)
IJsonArray.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonArray getJsonArrayOrEmpty(int index)
IJsonArray.IJsonArray if not found.
Throws an exception if an existing element can't be converted to the
required type.String getString(int index)
String.null if not found.
Throws an exception if an existing element can't be converted to the
required type.String getString(int index, String defaultValue)
String.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Integer getInteger(int index)
Integer.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Integer getInteger(int index, Integer defaultValue)
Integer.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Long getLong(int index)
Long.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Long getLong(int index, Long defaultValue)
Long.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Double getDouble(int index)
Double.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Double getDouble(int index, Double defaultValue)
Double.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Float getFloat(int index)
Float.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Float getFloat(int index, Float defaultValue)
Float.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Boolean getBoolean(int index)
Boolean.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Boolean getBoolean(int index, Boolean defaultValue)
Boolean.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.BigDecimal getBigDecimal(int index)
BigDecimal.null if not found.
Throws an exception if an existing element can't be converted to the
required type.BigDecimal getBigDecimal(int index, BigDecimal defaultValue)
BigDecimal.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.byte[] getBytesFromBase64String(int index)
null if not found.
Throws an exception if an existing element can't be converted to the
required type.byte[] getBytesFromBase64String(int index,
byte[] defaultValue)
defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.Date getDate(int index)
ISO 8601 date property.null if not found.
Throws an exception if an existing element can't be converted to the
required type.Date getDate(int index, Date defaultValue)
ISO 8601 date property.defaultValue if not found.
Throws an exception if an existing element can't be converted to the
required type.IJsonArray clone()
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa.
The resulting IJsonArray is mutable.
IJsonArray clone(boolean mutable)
IJsonArray, so any
modification to the original won't affect the
clone, and vice-versa.mutable - if false, the resulting
IJsonArray and all its children
will be immutable.List<Object> convertToPlainList()
IJsonArray to a plain List<Object>.
All IJsonObject elements will be converted to
Maps and all IJsonArray elements will be converted to
Lists.
This list is always a new instance and is always mutable.
Copyright © 2016. All rights reserved.