Interface JsonArrayNode

All Superinterfaces:
JsonNode

public interface JsonArrayNode extends JsonNode
This interface is used to define a JSON array node.

Note: The underlying list can be accessed. Changes to this list are shown on the Node. You can operate on a copy of the list to avoid this behavior.

  • Method Details

    • getValue

      List<JsonNode> getValue()
      Description copied from interface: JsonNode
      Retrieves the value for this JsonNode.
      Specified by:
      getValue in interface JsonNode
      Returns:
      The value for this JsonNode.
    • asList

      List<JsonNode> asList()
      Retrieves the value for this JsonNode.
      Returns:
      The value for this JsonNode.
    • add

      void add(JsonNode value)
      Adds a JsonNode to this JsonArrayNode.
      Parameters:
      value - The node to add.
    • addString

      void addString(String value)
      Adds a string to this JsonArrayNode.
      Parameters:
      value - The string to add.
      Throws:
      NullPointerException - if the value is null.
    • addBoolean

      void addBoolean(boolean value)
      Adds a boolean to this JsonArrayNode.
      Parameters:
      value - The boolean to add.
    • addNumber

      void addNumber(long value)
      Adds a long to this JsonArrayNode.
      Parameters:
      value - The long to add.
    • addNumber

      void addNumber(double value)
      Adds a double to this JsonArrayNode.
      Parameters:
      value - The double to add.
    • addNumber

      void addNumber(Number value)
      Adds a number to this JsonArrayNode.
      Parameters:
      value - The number to add.
    • get

      JsonNode get(int index)
      Attempts to return the JsonNode at the given index.
      Parameters:
      index - The index to retrieve.
      Returns:
      The JsonNode at the given index.
    • getString

      String getString(int index)
      Attempts to return the string at the given index.
      Parameters:
      index - The index to retrieve.
      Returns:
      The string at the given index or null if it is not a String.
    • getBoolean

      Boolean getBoolean(int index)
      Attempts to return the boolean at the given index.
      Parameters:
      index - The index to retrieve.
      Returns:
      The boolean at the given index or null if it is not a Boolean.
    • getLong

      Long getLong(int index)
      Attempts to return the number at the given index as a long.
      Parameters:
      index - The index to retrieve.
      Returns:
      The number at the given index as a long or null if it is not a Long.
    • getDouble

      Double getDouble(int index)
      Attempts to return the number at the given index as a double.
      Parameters:
      index - The index to retrieve.
      Returns:
      The number at the given index as a double or null if it is not a Double.
    • getNumber

      Number getNumber(int index)
      Attempts to return the number at the given index.
      Parameters:
      index - The index to retrieve.
      Returns:
      The number at the given index or null if it is not a Number.
    • remove

      void remove(int index)
      Removes the JsonNode at the given index.
      Parameters:
      index - The index for the JsonNode to remove.
    • jsonArrayNode

      static JsonArrayNode jsonArrayNode()
      Creates a new empty instance of JsonArrayNode.
      Returns:
      A new JsonArrayNode instance.
    • jsonArrayNode

      static JsonArrayNode jsonArrayNode(List<? extends JsonNode> value)
      Creates a new instance of JsonArrayNode from the supplied list of JsonNode.
      Parameters:
      value - The list of JsonNode.
      Returns:
      A new JsonNode instance.
    • jsonArrayNode

      static JsonArrayNode jsonArrayNode(JsonNode... values)
      Creates a new instance of JsonArrayNode from the supplied JsonNode instances.
      Parameters:
      values - The instances of JsonNode.
      Returns:
      A new JsonNode instance.