Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.json.client
Class JSONArray

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

    public class JSONArray

extends JSONValue

Represents an array of `JSONValue` objects.

Constructor Summary
`JSONArray()` Creates an empty JSONArray.
`JSONArray(JavaScriptObject arr)` Creates a new JSONArray from the supplied JavaScriptObject representing a JavaScript array.

Method Summary
`JSONValue` | `get(int index)` Returns the value at the specified index position.
`JSONArray` | `isArray()` Returns `this`, as this is a JSONArray.
`JSONValue` | `set(int index, JSONValue jsonValue)` Sets the specified index to the given value.
`int` | `size()` Returns the number of elements in this array.
`java.lang.String` | `toString()` Create the JSON encoded string representation of this JSONArray instance.

Methods inherited from class com.google.gwt.json.client.JSONValue
`isBoolean, isNull, isNumber, isObject, isString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JSONArray

    public JSONArray()

  Creates an empty JSONArray.

### JSONArray

    public JSONArray(JavaScriptObject arr)

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

  Parameters:
    `arr` - a JavaScript array

Method Detail

### get

    public JSONValue get(int index)
                  throws JSONException

  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
  Throws:
    `JSONException`

### isArray

    public JSONArray isArray()

  Returns `this`, as this is a JSONArray.

  Overrides:
    `isArray` in class `JSONValue`
  Returns:
    a reference to a JSONArray if this JSONValue is a JSONArray or `null` otherwise.

### set

    public JSONValue set(int index,
                         JSONValue jsonValue)

  Sets the specified index to the given value.

  Parameters:
    `index` - the index to set
    `jsonValue` - the value to set
  Returns:
    the previous value at this index, or `null` if this index was empty

### size

    public int size()

  Returns the number of elements in this array.

  Returns:
    size of this array

### toString

    public java.lang.String toString()
                              throws JSONException

  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.

  Specified by:
    `toString` in class `JSONValue`
  Throws:
    `JSONException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD