Class JsonArrayDefault

java.lang.Object
org.spincast.core.json.JsonObjectArrayBase
org.spincast.core.json.JsonArrayDefault
All Implemented Interfaces:
Iterable<Object>, JsonArray, JsonObjectOrArray

public class JsonArrayDefault extends JsonObjectArrayBase implements JsonArray
JsonArray implementation.
  • Field Details

    • logger

      protected static final org.slf4j.Logger logger
  • Constructor Details

  • Method Details

    • getElements

      protected List<Object> getElements()
    • getElement

      protected Object getElement(int index)
    • add

      public JsonArray add(Object value)
      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 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 :

      • A Collection
      • An array
      Specified by:
      add in interface JsonArray
    • add

      public JsonArray add(int index, Object value)
      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 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 :

      • A Collection
      • An array
      Specified by:
      add in interface JsonArray
    • add

      public JsonArray add(Object value, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      add in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • add

      public JsonArray add(int index, Object value, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      add in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • addAll

      public JsonArray addAll(Collection<?> values)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
    • addAll

      public JsonArray addAll(Collection<?> values, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • addAll

      public JsonArray addAll(Object[] values)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
    • addAll

      public JsonArray addAll(Object[] values, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • addAll

      public JsonArray addAll(JsonArray values)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
    • addAll

      public JsonArray addAll(JsonArray values, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      addAll in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • set

      public JsonArray set(int index, Object value)
      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 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 :

      • A Collection
      • An array
      Specified by:
      set in interface JsonArray
    • set

      public JsonArray set(int index, Object value, boolean clone)
      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 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 :

      • A Collection
      • An array
      Specified by:
      set in interface JsonArray
      clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure a JsonArray is always fully mutable or fully immutable.
    • setOrAdd

      public JsonArray setOrAdd(Integer index, Object value, boolean clone, boolean insert)
    • addAsIs

      protected JsonArray addAsIs(Object value)
    • addAsIs

      protected JsonArray addAsIs(Integer index, Object value)
    • setOrAddAsIs

      protected JsonArray setOrAddAsIs(Integer index, Object value, boolean insert)
    • remove

      public JsonArray remove(String jsonPath)
      Description copied from interface: JsonObjectOrArray
      Removes an element at JsonPath.
      Specified by:
      remove in interface JsonObjectOrArray
      Returns:
      the current object (fluent style).
    • remove

      public JsonArray remove(int index)
      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.
      Specified by:
      remove in interface JsonArray
    • clear

      public JsonArray clear()
      Description copied from interface: JsonObjectOrArray
      Clears all elements.
      Specified by:
      clear in interface JsonObjectOrArray
    • size

      public int size()
      Description copied from interface: JsonObjectOrArray
      The size of the object.
      Specified by:
      size in interface JsonObjectOrArray
    • isElementExists

      public boolean isElementExists(int index)
      Description copied from interface: JsonArray
      Is there an element at the specified index? This returns true even if the element is null.

      This is a synonym of index >= 0 && index < size()

      Specified by:
      isElementExists in interface JsonArray
    • iterator

      public Iterator<Object> iterator()
      Specified by:
      iterator in interface Iterable<Object>
    • convertToStringList

      public List<String> convertToStringList()
      Description copied from interface: JsonArray
      Converts the JsonArray to a List<String>. To do so, the toString() method will be called on any non null element.

      This list is always a new instance and is mutable.

      Specified by:
      convertToStringList in interface JsonArray
    • getJsonObject

      public JsonObject getJsonObject(int index)
      Description copied from interface: JsonArray
      Gets an element as JsonObject.
      Specified by:
      getJsonObject in interface JsonArray
      Returns:
      the element or null if not found.
    • getJsonObject

      public JsonObject getJsonObject(int index, JsonObject defaultValue)
      Description copied from interface: JsonArray
      Gets an element as JsonObject.
      Specified by:
      getJsonObject in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getJsonObjectOrEmpty

      public JsonObject getJsonObjectOrEmpty(int index)
      Description copied from interface: JsonArray
      Gets an element as JsonObject.
      Specified by:
      getJsonObjectOrEmpty in interface JsonArray
      Returns:
      the element or an empty JsonObject if not found or if null.
    • getJsonArray

      public JsonArray getJsonArray(int index)
      Description copied from interface: JsonArray
      Gets an element as JsonArray.
      Specified by:
      getJsonArray in interface JsonArray
      Returns:
      the element or null if not found.
    • getJsonArray

      public JsonArray getJsonArray(int index, JsonArray defaultValue)
      Description copied from interface: JsonArray
      Gets an element as JsonArray.
      Specified by:
      getJsonArray in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getJsonArrayOrEmpty

      public JsonArray getJsonArrayOrEmpty(int index)
      Description copied from interface: JsonArray
      Gets an element as JsonArray.
      Specified by:
      getJsonArrayOrEmpty in interface JsonArray
      Returns:
      the element or an empty JsonArray if not found or if null.
    • getString

      public String getString(int index)
      Description copied from interface: JsonArray
      Gets an element as String.
      Specified by:
      getString in interface JsonArray
      Returns:
      the element or null if not found.
    • getString

      public String getString(int index, String defaultValue)
      Description copied from interface: JsonArray
      Gets an element as String.
      Specified by:
      getString in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getInteger

      public Integer getInteger(int index)
      Description copied from interface: JsonArray
      Gets an element as Integer.
      Specified by:
      getInteger in interface JsonArray
      Returns:
      the element or null if not found.
    • getInteger

      public Integer getInteger(int index, Integer defaultValue)
      Description copied from interface: JsonArray
      Gets an element as Integer.
      Specified by:
      getInteger in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getLong

      public Long getLong(int index)
      Description copied from interface: JsonArray
      Gets an element as Long.
      Specified by:
      getLong in interface JsonArray
      Returns:
      the element or null if not found.
    • getLong

      public Long getLong(int index, Long defaultValue)
      Description copied from interface: JsonArray
      Gets an element as Long.
      Specified by:
      getLong in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getDouble

      public Double getDouble(int index)
      Description copied from interface: JsonArray
      Gets an element as Double.
      Specified by:
      getDouble in interface JsonArray
      Returns:
      the element or null if not found.
    • getDouble

      public Double getDouble(int index, Double defaultValue)
      Description copied from interface: JsonArray
      Gets an element as Double.
      Specified by:
      getDouble in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getFloat

      public Float getFloat(int index)
      Description copied from interface: JsonArray
      Gets an element as Float.
      Specified by:
      getFloat in interface JsonArray
      Returns:
      the element or null if not found.
    • getFloat

      public Float getFloat(int index, Float defaultValue)
      Description copied from interface: JsonArray
      Gets an element as Float.
      Specified by:
      getFloat in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getBoolean

      public Boolean getBoolean(int index)
      Description copied from interface: JsonArray
      Gets an element as Boolean.
      Specified by:
      getBoolean in interface JsonArray
      Returns:
      the element or null if not found.
    • getBoolean

      public Boolean getBoolean(int index, Boolean defaultValue)
      Description copied from interface: JsonArray
      Gets an element as Boolean.
      Specified by:
      getBoolean in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getBigDecimal

      public BigDecimal getBigDecimal(int index)
      Description copied from interface: JsonArray
      Gets an element as BigDecimal.
      Specified by:
      getBigDecimal in interface JsonArray
      Returns:
      the element or null if not found.
    • getBigDecimal

      public BigDecimal getBigDecimal(int index, BigDecimal defaultValue)
      Description copied from interface: JsonArray
      Gets an element as BigDecimal.
      Specified by:
      getBigDecimal in interface JsonArray
      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 interface JsonArray
      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 interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getDate

      public Date getDate(int index)
      Description copied from interface: JsonArray
      Gets a UTC timezoned date from a ISO 8601 date element.
      Specified by:
      getDate in interface JsonArray
      Returns:
      the element or null if not found.
    • getDate

      public Date getDate(int index, Date defaultValue)
      Description copied from interface: JsonArray
      Gets a UTC timezoned date from a ISO 8601 date element.
      Specified by:
      getDate in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getInstant

      public Instant getInstant(int index)
      Description copied from interface: JsonArray
      Gets an Instant from a ISO 8601 date element.
      Specified by:
      getInstant in interface JsonArray
      Returns:
      the element or null if not found.
    • getInstant

      public Instant getInstant(int index, Instant defaultValue)
      Description copied from interface: JsonArray
      Gets an Instant from a ISO 8601 date element.
      Specified by:
      getInstant in interface JsonArray
      Returns:
      the element or the specified defaultValue if not found.
    • getObject

      public Object getObject(int index)
      Description copied from interface: JsonArray
      Gets an element, untyped.
      Specified by:
      getObject in interface JsonArray
      Returns:
      the object or null if not found. This object will necessarly be of a type managed by JsonArray, since an object of any other type is automatically converted when added.
    • getObject

      public Object getObject(int index, Object defaultValue)
      Description copied from interface: JsonArray
      Gets an element, untyped.
      Specified by:
      getObject in interface JsonArray
      Returns:
      the object or the specified defaultValue if not found. This object will necessarly be of a type managed by JsonArray, since an object of any other type is automatically converted when added.
    • 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 class JsonObjectArrayBase
    • getArrayFirst

      protected <T> T getArrayFirst(int index, boolean hasDefaultValue, T defaultValue, JsonObjectDefault.IFirstElementGetter<T> firstElementGetter)
    • getArrayFirstJsonObject

      public JsonObject getArrayFirstJsonObject(int index)
      Description copied from interface: JsonArray
      Gets the first element (as JsonObject) of a JsonArray element.
      Specified by:
      getArrayFirstJsonObject in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstJsonObject

      public JsonObject getArrayFirstJsonObject(int index, JsonObject defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as JsonObject) of a JsonArray element.
      Specified by:
      getArrayFirstJsonObject in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstJsonArray

      public JsonArray getArrayFirstJsonArray(int index)
      Description copied from interface: JsonArray
      Gets the first element (as JsonArray) of a JsonArray element.
      Specified by:
      getArrayFirstJsonArray in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstJsonArray

      public JsonArray getArrayFirstJsonArray(int index, JsonArray defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as JsonArray) of a JsonArray element.
      Specified by:
      getArrayFirstJsonArray in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstString

      public String getArrayFirstString(int index)
      Description copied from interface: JsonArray
      Gets the first element (as String) of a JsonArray element.
      Specified by:
      getArrayFirstString in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstString

      public String getArrayFirstString(int index, String defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as String) of a JsonArray element.
      Specified by:
      getArrayFirstString in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstInteger

      public Integer getArrayFirstInteger(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Integer) of a JsonArray element.
      Specified by:
      getArrayFirstInteger in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstInteger

      public Integer getArrayFirstInteger(int index, Integer defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Integer) of a JsonArray element.
      Specified by:
      getArrayFirstInteger in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstLong

      public Long getArrayFirstLong(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Long) of a JsonArray element.
      Specified by:
      getArrayFirstLong in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstLong

      public Long getArrayFirstLong(int index, Long defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Long) of a JsonArray element.
      Specified by:
      getArrayFirstLong in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstDouble

      public Double getArrayFirstDouble(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Double) of a JsonArray element.
      Specified by:
      getArrayFirstDouble in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstDouble

      public Double getArrayFirstDouble(int index, Double defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Double) of a JsonArray element.
      Specified by:
      getArrayFirstDouble in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstFloat

      public Float getArrayFirstFloat(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Float) of a JsonArray element.
      Specified by:
      getArrayFirstFloat in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstFloat

      public Float getArrayFirstFloat(int index, Float defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Float) of a JsonArray element.
      Specified by:
      getArrayFirstFloat in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstBoolean

      public Boolean getArrayFirstBoolean(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Boolean) of a JsonArray element.
      Specified by:
      getArrayFirstBoolean in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstBoolean

      public Boolean getArrayFirstBoolean(int index, Boolean defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Boolean) of a JsonArray element.
      Specified by:
      getArrayFirstBoolean in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstBigDecimal

      public BigDecimal getArrayFirstBigDecimal(int index)
      Description copied from interface: JsonArray
      Gets the first element (as BigDecimal) of a JsonArray element.
      Specified by:
      getArrayFirstBigDecimal in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstBigDecimal

      public BigDecimal getArrayFirstBigDecimal(int index, BigDecimal defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as BigDecimal) of a JsonArray element.
      Specified by:
      getArrayFirstBigDecimal in interface JsonArray
      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 a JsonArray element.
      Specified by:
      getArrayFirstBytesFromBase64String in interface JsonArray
      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 a JsonArray element.
      Specified by:
      getArrayFirstBytesFromBase64String in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstDate

      public Date getArrayFirstDate(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Date) of a JsonArray element.
      Specified by:
      getArrayFirstDate in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstDate

      public Date getArrayFirstDate(int index, Date defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Date) of a JsonArray element.
      Specified by:
      getArrayFirstDate in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • getArrayFirstInstant

      public Instant getArrayFirstInstant(int index)
      Description copied from interface: JsonArray
      Gets the first element (as Instant) of a JsonArray element.
      Specified by:
      getArrayFirstInstant in interface JsonArray
      Returns:
      the element or null if the array or the first element are not found.
    • getArrayFirstInstant

      public Instant getArrayFirstInstant(int index, Instant defaultValue)
      Description copied from interface: JsonArray
      Gets the first element (as Instant) of a JsonArray element.
      Specified by:
      getArrayFirstInstant in interface JsonArray
      Returns:
      the element or the specified defaultValue if the array or the first element are not found.
    • convertToPlainList

      public List<Object> convertToPlainList()
      Description copied from interface: JsonArray
      Converts the JsonArray 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.

      Specified by:
      convertToPlainList in interface JsonArray
    • isCanBeConvertedToString

      public boolean isCanBeConvertedToString(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type String, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToString in interface JsonArray
    • isCanBeConvertedToInteger

      public boolean isCanBeConvertedToInteger(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Integer, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToInteger in interface JsonArray
    • isCanBeConvertedToLong

      public boolean isCanBeConvertedToLong(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Long, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToLong in interface JsonArray
    • isCanBeConvertedToFloat

      public boolean isCanBeConvertedToFloat(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Float, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToFloat in interface JsonArray
    • isCanBeConvertedToDouble

      public boolean isCanBeConvertedToDouble(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Double, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToDouble in interface JsonArray
    • isCanBeConvertedToBoolean

      public boolean isCanBeConvertedToBoolean(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Boolean, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToBoolean in interface JsonArray
    • isCanBeConvertedToBigDecimal

      public boolean isCanBeConvertedToBigDecimal(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type BigDecimal, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToBigDecimal in interface JsonArray
    • isCanBeConvertedToByteArray

      public boolean isCanBeConvertedToByteArray(int index)
      Description copied from interface: JsonArray
      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.
      Specified by:
      isCanBeConvertedToByteArray in interface JsonArray
    • isCanBeConvertedToDate

      public boolean isCanBeConvertedToDate(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type Date, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToDate in interface JsonArray
    • isCanBeConvertedToJsonObject

      public boolean isCanBeConvertedToJsonObject(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type JsonObject, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToJsonObject in interface JsonArray
    • isCanBeConvertedToJsonArray

      public boolean isCanBeConvertedToJsonArray(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null, of type JsonArray, or can be converted and retrieved as one.
      Specified by:
      isCanBeConvertedToJsonArray in interface JsonArray
    • isOfTypeString

      public boolean isOfTypeString(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type String, without requiring any conversion.
      Specified by:
      isOfTypeString in interface JsonArray
    • isOfTypeInteger

      public boolean isOfTypeInteger(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type Integer, without requiring any conversion.
      Specified by:
      isOfTypeInteger in interface JsonArray
    • isOfTypeLong

      public boolean isOfTypeLong(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type Long, without requiring any conversion.
      Specified by:
      isOfTypeLong in interface JsonArray
    • isOfTypeFloat

      public boolean isOfTypeFloat(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type Float, without requiring any conversion.
      Specified by:
      isOfTypeFloat in interface JsonArray
    • isOfTypeDouble

      public boolean isOfTypeDouble(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type Double, without requiring any conversion.
      Specified by:
      isOfTypeDouble in interface JsonArray
    • isOfTypeBoolean

      public boolean isOfTypeBoolean(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type Boolean, without requiring any conversion.
      Specified by:
      isOfTypeBoolean in interface JsonArray
    • isOfTypeBigDecimal

      public boolean isOfTypeBigDecimal(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type BigDecimal, without requiring any conversion.
      Specified by:
      isOfTypeBigDecimal in interface JsonArray
    • isOfTypeByteArray

      public boolean isOfTypeByteArray(int index, boolean acceptBase64StringToo)
      Description copied from interface: JsonArray
      Validates that the element at the specified JsonPath exists and is currently null or of type byte[], without requiring any conversion.
      Specified by:
      isOfTypeByteArray in interface JsonArray
      acceptBase64StringToo - if true, 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 specified index exists and is currently null or of type Date, without requiring any conversion.
      Specified by:
      isOfTypeDate in interface JsonArray
    • isOfTypeJsonObject

      public boolean isOfTypeJsonObject(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type JsonObject, without requiring any conversion.
      Specified by:
      isOfTypeJsonObject in interface JsonArray
    • isOfTypeJsonArray

      public boolean isOfTypeJsonArray(int index)
      Description copied from interface: JsonArray
      Validates that the element at the specified index exists and is currently null or of type JsonArray, without requiring any conversion.
      Specified by:
      isOfTypeJsonArray in interface JsonArray
    • isNull

      public boolean isNull(int index)
      Description copied from interface: JsonArray
      Validates that there is an element at the specified index and it is null.
      Specified by:
      isNull in interface JsonArray
    • isEquivalentTo

      public boolean isEquivalentTo(JsonArray other)
      Description copied from interface: JsonArray
      Compares the current JsonArray to the specified one and returns true if they are equivalent. To be equivalent, all their elements must be so too.

      An element is equivalent to the other if they can be converted to the¬ł same type, and then if they are equals.

      For example, the String "123" is equivalent to new BigDecimal("123") or to 123L.

      Specified by:
      isEquivalentTo in interface JsonArray
    • clone

      public JsonArray clone(boolean mutable)
      Description copied from class: JsonObjectArrayBase
      Clone the object.
      Specified by:
      clone in interface JsonArray
      Specified by:
      clone in interface JsonObjectOrArray
      Specified by:
      clone in class JsonObjectArrayBase
      Parameters:
      mutable - if true the resulting object and all its children will be mutable, otherwise they will all be immutable.
    • transformAll

      public void transformAll(ElementTransformer transformer, boolean recursive)
      Description copied from interface: JsonObjectOrArray
      Transforms all the elements of the object, using the specified transformer.
      Specified by:
      transformAll in interface JsonObjectOrArray
      Specified by:
      transformAll in class JsonObjectArrayBase
      recursive - if true, then all children elements will also be transformed, recursively.
    • transform

      public void transform(int index, ElementTransformer transformer)
      Description copied from interface: JsonArray
      Transforms the element at the given index, using the specified ElementTransformer.
      Specified by:
      transform in interface JsonArray
    • trim

      public void trim(int index)
      Description copied from interface: JsonArray
      Trims the element, if it's of type String.
      Specified by:
      trim in interface JsonArray
    • putAsIs

      protected JsonArray putAsIs(String key, Object value)
      Specified by:
      putAsIs in class JsonObjectArrayBase