Logo Search packages:      
Sourcecode: libjson-java version File versions

net::sf::json::JSONArray Class Reference

Inheritance diagram for net::sf::json::JSONArray:

net::sf::json::AbstractJSON net::sf::json::JSON

List of all members.


Detailed Description

A JSONArray is an ordered sequence of values. Its external text form is a string wrapped in square brackets with commas separating the values. The internal form is an object having get and opt methods for accessing the values by index, and element methods for adding or replacing values. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, String, or the JSONNull object.

The constructor can convert a JSON text into a Java object. The toString method converts to JSON text.

A get method returns a value if one can be found, and throws an exception if one cannot be found. An opt method returns a default value instead of throwing an exception, and so is useful for obtaining optional values.

The generic get() and opt() methods return an object which you can cast or query for type. There are also typed get and opt methods that do type checking and type coersion for you.

The texts produced by the toString methods strictly conform to JSON syntax rules. The constructors are more forgiving in the texts they will accept:

Author:
JSON.org

Definition at line 116 of file JSONArray.java.


Public Member Functions

boolean add (Object value, JsonConfig jsonConfig)
boolean add (Object value)
void add (int index, Object value, JsonConfig jsonConfig)
void add (int index, Object value)
boolean addAll (int index, Collection collection, JsonConfig jsonConfig)
boolean addAll (int index, Collection collection)
boolean addAll (Collection collection, JsonConfig jsonConfig)
boolean addAll (Collection collection)
void clear ()
int compareTo (Object obj)
boolean contains (Object o, JsonConfig jsonConfig)
boolean contains (Object o)
boolean containsAll (Collection collection, JsonConfig jsonConfig)
boolean containsAll (Collection collection)
JSONArray discard (Object o)
JSONArray discard (int index)
JSONArray element (String value, JsonConfig jsonConfig)
JSONArray element (String value)
JSONArray element (Object value, JsonConfig jsonConfig)
JSONArray element (Object value)
JSONArray element (Map value, JsonConfig jsonConfig)
JSONArray element (Map value)
JSONArray element (long value)
JSONArray element (JSONObject value)
JSONArray element (JSONNull value)
JSONArray element (int index, String value, JsonConfig jsonConfig)
JSONArray element (int index, String value)
JSONArray element (int index, Object value, JsonConfig jsonConfig)
JSONArray element (int index, Object value)
JSONArray element (int index, Map value, JsonConfig jsonConfig)
JSONArray element (int index, Map value)
JSONArray element (int index, long value)
JSONArray element (int index, int value)
JSONArray element (int index, double value)
JSONArray element (int index, Collection value, JsonConfig jsonConfig)
JSONArray element (int index, Collection value)
JSONArray element (int index, boolean value)
JSONArray element (int value)
JSONArray element (double value)
JSONArray element (Collection value, JsonConfig jsonConfig)
JSONArray element (Collection value)
JSONArray element (boolean value)
boolean equals (Object obj)
Object get (int index)
boolean getBoolean (int index)
double getDouble (int index)
int getInt (int index)
JSONArray getJSONArray (int index)
JSONObject getJSONObject (int index)
long getLong (int index)
String getString (int index)
int hashCode ()
int indexOf (Object o)
boolean isArray ()
boolean isEmpty ()
boolean isExpandElements ()
Iterator iterator ()
String join (String separator, boolean stripQuotes)
String join (String separator)
 JSONArray ()
int lastIndexOf (Object o)
ListIterator listIterator (int index)
ListIterator listIterator ()
Object opt (int index)
boolean optBoolean (int index, boolean defaultValue)
boolean optBoolean (int index)
double optDouble (int index, double defaultValue)
double optDouble (int index)
int optInt (int index, int defaultValue)
int optInt (int index)
JSONArray optJSONArray (int index)
JSONObject optJSONObject (int index)
long optLong (int index, long defaultValue)
long optLong (int index)
String optString (int index, String defaultValue)
String optString (int index)
boolean remove (Object o)
Object remove (int index)
boolean removeAll (Collection collection, JsonConfig jsonConfig)
boolean removeAll (Collection collection)
boolean retainAll (Collection collection, JsonConfig jsonConfig)
boolean retainAll (Collection collection)
Object set (int index, Object value, JsonConfig jsonConfig)
Object set (int index, Object value)
void setExpandElements (boolean expandElements)
int size ()
List subList (int fromIndex, int toIndex)
Object[] toArray (Object[] array)
Object[] toArray ()
JSONObject toJSONObject (JSONArray names)
String toString (int indentFactor, int indent)
String toString (int indentFactor)
String toString ()
Writer write (Writer writer)

Static Public Member Functions

static JSONArray fromObject (Object object, JsonConfig jsonConfig)
static JSONArray fromObject (Object object)
static Class[] getCollectionType (PropertyDescriptor pd, boolean useGetter) throws JSONException
static int[] getDimensions (JSONArray jsonArray)
static Object toArray (JSONArray jsonArray, Object root, JsonConfig jsonConfig)
static Object toArray (JSONArray jsonArray, JsonConfig jsonConfig)
static Object toArray (JSONArray jsonArray, Class objectClass, Map classMap)
static Object toArray (JSONArray jsonArray, Class objectClass)
static Object toArray (JSONArray jsonArray)
static Collection toCollection (JSONArray jsonArray, JsonConfig jsonConfig)
static Collection toCollection (JSONArray jsonArray, Class objectClass)
static Collection toCollection (JSONArray jsonArray)
static List toList (JSONArray jsonArray, Object root, JsonConfig jsonConfig)
static List toList (JSONArray jsonArray, JsonConfig jsonConfig)
static List toList (JSONArray jsonArray, Class objectClass, Map classMap)
static List toList (JSONArray jsonArray, Class objectClass)
static List toList (JSONArray jsonArray)

Protected Member Functions

JSONArray addString (String str)

Static Protected Member Functions

static boolean addInstance (Object instance)
static void fireArrayEndEvent (JsonConfig jsonConfig)
static void fireArrayStartEvent (JsonConfig jsonConfig)
static void fireElementAddedEvent (int index, Object element, JsonConfig jsonConfig)
static void fireErrorEvent (JSONException jsone, JsonConfig jsonConfig)
static void fireObjectEndEvent (JsonConfig jsonConfig)
static void fireObjectStartEvent (JsonConfig jsonConfig)
static void firePropertySetEvent (String key, Object value, boolean accumulated, JsonConfig jsonConfig)
static void fireWarnEvent (String warning, JsonConfig jsonConfig)
static void removeInstance (Object instance)

Private Member Functions

JSONArray _addValue (Object value, JsonConfig jsonConfig)
Object _processValue (Object value, JsonConfig jsonConfig)
JSONArray addValue (Object value, JsonConfig jsonConfig)
Object processValue (Object value, JsonConfig jsonConfig)

Static Private Member Functions

static JSONArray _fromArray (short[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (Object[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (long[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (int[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (float[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (Enum e, JsonConfig jsonConfig)
static JSONArray _fromArray (double[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (char[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (byte[] array, JsonConfig jsonConfig)
static JSONArray _fromArray (boolean[] array, JsonConfig jsonConfig)
static JSONArray _fromCollection (Collection collection, JsonConfig jsonConfig)
static JSONArray _fromJSONArray (JSONArray array, JsonConfig jsonConfig)
static JSONArray _fromJSONString (JSONString string, JsonConfig jsonConfig)
static JSONArray _fromJSONTokener (JSONTokener tokener, JsonConfig jsonConfig)
static JSONArray _fromString (String string, JsonConfig jsonConfig)
static void processArrayDimensions (JSONArray jsonArray, List dims, int index)

Private Attributes

List elements
boolean expandElements

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index