Interface ReadOnlyAstArray

All Superinterfaces:
Iterable<Object>, ReadOnlyAstNode
All Known Subinterfaces:
AstArray, NativeAstArray
All Known Implementing Classes:
ConfigArray, ListAstArray, ListBasedAstArray, ReadOnlyAstArrayWrapper

public interface ReadOnlyAstArray extends ReadOnlyAstNode, Iterable<Object>
Author:
Bruno Salmon
  • Method Details

    • size

      int size()
      Length of the array or number of keys of the object
      Specified by:
      size in interface ReadOnlyAstNode
    • indexOf

      int indexOf(Object value)
      Returns the first index of the given value, or -1 if it cannot be found.
    • getElement

      <V> V getElement(int index)
      Return the ith element of the array. Most consuming call.
    • isNull

      default boolean isNull(int index)
    • isObject

      default boolean isObject(int index)
    • isArray

      default boolean isArray(int index)
    • isScalar

      default boolean isScalar(int index)
    • getObject

      default ReadOnlyAstObject getObject(int index)
      Return the ith element of the array as a JsonObject. If the type is not an object, this can result in runtime errors.
    • getArray

      default ReadOnlyAstArray getArray(int index)
      Return the ith element of the array as a JsonArray. If the type is not an array, this can result in runtime errors.
    • getScalar

      default <T> T getScalar(int index)
    • getScalar

      default <T> T getScalar(int index, T defaultValue)
    • getBoolean

      default Boolean getBoolean(int index)
      Return the ith element of the array as a boolean. If the type is not a boolean, this can result in runtime errors.
    • getBoolean

      default Boolean getBoolean(int index, Boolean defaultValue)
      Return the ith element of the array as a boolean. If the type is not a boolean, this can result in runtime errors.
    • getString

      default String getString(int index)
      Return the ith element of the array as a String. If the type is not a String, this can result in runtime errors.
    • getString

      default String getString(int index, String defaultValue)
      Return the ith element of the array as a String. If the type is not a String, this can result in runtime errors.
    • getInteger

      default Integer getInteger(int index)
      Return the ith element of the array as a int. If the type is not a int, this can result in runtime errors.
    • getInteger

      default Integer getInteger(int index, Integer defaultValue)
      Return the ith element of the array as a int. If the type is not a int, this can result in runtime errors.
    • getLong

      default Long getLong(int index)
      Return the ith element of the array as a long. If the type is not a long, this can result in runtime errors.
    • getLong

      default Long getLong(int index, Long defaultValue)
      Return the ith element of the array as a long. If the type is not a long, this can result in runtime errors.
    • getDouble

      default Double getDouble(int index)
      Return the ith element of the array as a double. If the type is not a double, this can result in runtime errors.
    • getDouble

      default Double getDouble(int index, Double defaultValue)
      Return the ith element of the array as a double. If the type is not a double, this can result in runtime errors.
    • iterator

      default Iterator<Object> iterator()
      Specified by:
      iterator in interface Iterable<Object>