Class JsonArray

java.lang.Object
name.martingeisse.grumpyjson.json_model.JsonElement
name.martingeisse.grumpyjson.json_model.JsonArray

public abstract class JsonArray extends JsonElement
This class represents JSON arrays.
  • Method Details

    • of

      public static JsonArray of(List<JsonElement> elements)
      Creates an instance of this class from a List containing the elements of the JSON array.
      Parameters:
      elements - the elements of the JSON array to create
      Returns:
      the JSON array
    • of

      public static JsonArray of(JsonElement... elements)
      Creates an instance of this class from elements passed as varargs.
      Parameters:
      elements - the elements of the JSON array to create
      Returns:
      the JSON array
    • getAsList

      public abstract List<JsonElement> getAsList()
      Returns the elements of this JSON array as a List.
      Returns:
      the elements
    • deserializerExpectsArray

      public final List<JsonElement> deserializerExpectsArray()
      Description copied from class: JsonElement
      If this JSON element is not a JSON array, this method throws a JsonDeserializationException, otherwise it returns the array's elements as a List.
      Overrides:
      deserializerExpectsArray in class JsonElement
      Returns:
      the list of elements
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object