com.alibaba.dubbo.common.json
Class JSONArray

java.lang.Object
  extended by com.alibaba.dubbo.common.json.JSONArray

public class JSONArray
extends Object

JSONArray.

Author:
qian.lei

Constructor Summary
JSONArray()
           
 
Method Summary
 void add(Object ele)
          add item.
 void addAll(Collection<?> c)
          add items.
 void addAll(Object[] eles)
          add items.
 Object get(int index)
          get.
 JSONArray getArray(int index)
          get JSONArray value.
 boolean getBoolean(int index, boolean def)
          get boolean value.
 double getDouble(int index, double def)
          get double value.
 float getFloat(int index, float def)
          get float value.
 int getInt(int index, int def)
          get int value.
 long getLong(int index, long def)
          get long value.
 JSONObject getObject(int index)
          get JSONObject value.
 String getString(int index)
          get string value.
 int length()
          get array length.
 void writeJSON(JSONConverter jc, JSONWriter jb, boolean writeClass)
          write json.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONArray

public JSONArray()
Method Detail

get

public Object get(int index)
get.

Parameters:
index - index.
Returns:
boolean or long or double or String or JSONArray or JSONObject or null.

getBoolean

public boolean getBoolean(int index,
                          boolean def)
get boolean value.

Parameters:
index - index.
def - default value.
Returns:
value or default value.

getInt

public int getInt(int index,
                  int def)
get int value.

Parameters:
index - index.
def - default value.
Returns:
value or default value.

getLong

public long getLong(int index,
                    long def)
get long value.

Parameters:
index - index.
def - default value.
Returns:
value or default value.

getFloat

public float getFloat(int index,
                      float def)
get float value.

Parameters:
index - index.
def - default value.
Returns:
value or default value.

getDouble

public double getDouble(int index,
                        double def)
get double value.

Parameters:
index - index.
def - default value.
Returns:
value or default value.

getString

public String getString(int index)
get string value.

Parameters:
index - index.
Returns:
value or default value.

getArray

public JSONArray getArray(int index)
get JSONArray value.

Parameters:
index - index.
Returns:
value or default value.

getObject

public JSONObject getObject(int index)
get JSONObject value.

Parameters:
index - index.
Returns:
value or default value.

length

public int length()
get array length.

Returns:
length.

add

public void add(Object ele)
add item.


addAll

public void addAll(Object[] eles)
add items.


addAll

public void addAll(Collection<?> c)
add items.


writeJSON

public void writeJSON(JSONConverter jc,
                      JSONWriter jb,
                      boolean writeClass)
               throws IOException
write json.

Parameters:
jc - json converter
jb - json builder.
Throws:
IOException


Copyright © 2012–2017 Alibaba. All rights reserved.