public class

JSONArray

extends JSONValue
java.lang.Object
   ↳ com.google.gwt.json.client.JSONValue
     ↳ com.google.gwt.json.client.JSONArray

Class Overview

Represents an array of JSONValue objects.

Summary

Public Constructors
JSONArray()
Creates an empty JSONArray.
JSONArray(JavaScriptObject arr)
Creates a new JSONArray from the supplied JavaScriptObject representing a JavaScript array.
Public Methods
boolean equals(Object other)
Returns true if other is a JSONArray wrapping the same underlying object.
JSONValue get(int index)
Returns the value at the specified index position.
JavaScriptObject getJavaScriptObject()
Returns the underlying JavaScript array that this object wraps.
int hashCode()
JSONArray isArray()
Returns this, as this is a JSONArray.
JSONValue set(int index, JSONValue value)
Sets the specified index to the given value.
int size()
Returns the number of elements in this array.
String toString()
Create the JSON encoded string representation of this JSONArray instance.
[Expand]
Inherited Methods
From class com.google.gwt.json.client.JSONValue
From class java.lang.Object

Public Constructors

public JSONArray ()

Creates an empty JSONArray.

public JSONArray (JavaScriptObject arr)

Creates a new JSONArray from the supplied JavaScriptObject representing a JavaScript array.

Parameters
arr a JavaScript array

Public Methods

public boolean equals (Object other)

Returns true if other is a JSONArray wrapping the same underlying object.

public JSONValue get (int index)

Returns the value at the specified index position.

Parameters
index the index of the array item to retrieve
Returns
  • the value at this index, or null if this index is empty

public JavaScriptObject getJavaScriptObject ()

Returns the underlying JavaScript array that this object wraps.

public int hashCode ()

public JSONArray isArray ()

Returns this, as this is a JSONArray.

Returns
  • a reference to a JSONArray if this JSONValue is a JSONArray or null otherwise.

public JSONValue set (int index, JSONValue value)

Sets the specified index to the given value.

Parameters
index the index to set
value the value to set
Returns
  • the previous value at this index, or null if this index was empty

public int size ()

Returns the number of elements in this array.

Returns
  • size of this array

public String toString ()

Create the JSON encoded string representation of this JSONArray instance. This method may take a long time to execute if the underlying array is large.