|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectxv.json.JSONVariant
xv.json.JSONArray
public class JSONArray
Represents a JSON array.
Constructor Summary | |
---|---|
JSONArray()
|
|
JSONArray(int initialCapacity)
|
Method Summary | ||
---|---|---|
void |
add(int index,
JSONVariant element)
|
|
boolean |
add(JSONVariant o)
|
|
boolean |
addAll(Collection<? extends JSONVariant> c)
|
|
boolean |
addAll(int index,
Collection<? extends JSONVariant> c)
|
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
boolean |
containsAll(Collection<?> c)
|
|
boolean |
equals(Object o)
|
|
JSONVariant |
get(int index)
|
|
JSONArray |
getArray(int index)
Gets the item at the given index as an array. |
|
byte |
getByte(int index)
Gets the given index as a byte. |
|
byte |
getByte(int index,
byte defaultValue)
Gets the given index as a byte. |
|
double |
getDouble(int index)
Gets the given index as a double. |
|
double |
getDouble(int index,
double defaultValue)
Gets the given index as a double. |
|
float |
getFloat(int index)
Gets the given index as a float. |
|
float |
getFloat(int index,
float defaultValue)
Gets the given index as a float. |
|
int |
getInt(int index)
Gets the given index as an integer. |
|
int |
getInt(int index,
int defaultValue)
Gets the given index as an integer. |
|
long |
getLong(int index)
Gets the given index as an integer. |
|
long |
getLong(int index,
long defaultValue)
Gets the given index as an integer. |
|
Number |
getNumber(int index)
Gets the item at the given index as a number. |
|
JSONObject |
getObject(int index)
Gets the item at the given index as an object. |
|
short |
getShort(int index)
Gets the given index as a short. |
|
short |
getShort(int index,
short defaultValue)
Gets the given index as a short. |
|
String |
getString(int index)
Gets the item at the given index as a string. |
|
String |
getType()
Returns a string description of the type - one of "array" ,
"object" , "boolean" , "number" , or "string" . |
|
int |
hashCode()
|
|
int |
indexOf(Object o)
|
|
boolean |
isEmpty()
|
|
Iterator<JSONVariant> |
iterator()
|
|
int |
lastIndexOf(Object o)
|
|
ListIterator<JSONVariant> |
listIterator()
|
|
ListIterator<JSONVariant> |
listIterator(int index)
|
|
JSONVariant |
remove(int index)
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
|
|
boolean |
retainAll(Collection<?> c)
|
|
JSONVariant |
set(int index,
JSONVariant element)
|
|
int |
size()
|
|
List<JSONVariant> |
subList(int fromIndex,
int toIndex)
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
Methods inherited from class xv.json.JSONVariant |
---|
toJSON, write |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JSONArray()
public JSONArray(int initialCapacity)
Method Detail |
---|
public String getType()
JSONVariant
"array"
,
"object"
, "boolean"
, "number"
, or "string"
.
getType
in class JSONVariant
public void add(int index, JSONVariant element)
add
in interface List<JSONVariant>
public boolean add(JSONVariant o)
add
in interface Collection<JSONVariant>
add
in interface List<JSONVariant>
public boolean addAll(Collection<? extends JSONVariant> c)
addAll
in interface Collection<JSONVariant>
addAll
in interface List<JSONVariant>
public boolean addAll(int index, Collection<? extends JSONVariant> c)
addAll
in interface List<JSONVariant>
public void clear()
clear
in interface Collection<JSONVariant>
clear
in interface List<JSONVariant>
public boolean contains(Object o)
contains
in interface Collection<JSONVariant>
contains
in interface List<JSONVariant>
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<JSONVariant>
containsAll
in interface List<JSONVariant>
public boolean equals(Object o)
equals
in interface Collection<JSONVariant>
equals
in interface List<JSONVariant>
equals
in class Object
public JSONVariant get(int index)
get
in interface List<JSONVariant>
public String getString(int index)
null
.
index
- the index
null
if it
isn't a string
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public Number getNumber(int index)
null
.
index
- the index
null
if it
isn't a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public JSONArray getArray(int index)
null
.
index
- the index
null
if it
isn't an array
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public JSONObject getObject(int index)
null
.
index
- the index
null
if it
isn't an object
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public byte getByte(int index, byte defaultValue)
index
- the 0-based index of the item to get as a bytedefaultValue
- the value to return if the item at that index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public byte getByte(int index)
index
- the 0-based index of the item to get as a byte
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public short getShort(int index, short defaultValue)
index
- defaultValue
- the value to return if the index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public short getShort(int index)
index
-
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public int getInt(int index, int defaultValue)
index
- defaultValue
- the value to return if the index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public int getInt(int index)
index
-
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public long getLong(int index, long defaultValue)
index
- defaultValue
- the value to return if the index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public long getLong(int index)
index
-
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public float getFloat(int index, float defaultValue)
index
- defaultValue
- the value to return if the index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public float getFloat(int index)
index
- the index to look up
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public double getDouble(int index, double defaultValue)
index
- defaultValue
- the value to return if the index is not a number
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public double getDouble(int index)
index
- the index to look up
IndexOutOfBoundsException
- if the requested index is outside the range 0 to size()
- 1public int hashCode()
hashCode
in interface Collection<JSONVariant>
hashCode
in interface List<JSONVariant>
hashCode
in class Object
public int indexOf(Object o)
indexOf
in interface List<JSONVariant>
public boolean isEmpty()
isEmpty
in interface Collection<JSONVariant>
isEmpty
in interface List<JSONVariant>
public Iterator<JSONVariant> iterator()
iterator
in interface Iterable<JSONVariant>
iterator
in interface Collection<JSONVariant>
iterator
in interface List<JSONVariant>
public int lastIndexOf(Object o)
lastIndexOf
in interface List<JSONVariant>
public ListIterator<JSONVariant> listIterator()
listIterator
in interface List<JSONVariant>
public ListIterator<JSONVariant> listIterator(int index)
listIterator
in interface List<JSONVariant>
public JSONVariant remove(int index)
remove
in interface List<JSONVariant>
public boolean remove(Object o)
remove
in interface Collection<JSONVariant>
remove
in interface List<JSONVariant>
public boolean removeAll(Collection<?> c)
removeAll
in interface Collection<JSONVariant>
removeAll
in interface List<JSONVariant>
public boolean retainAll(Collection<?> c)
retainAll
in interface Collection<JSONVariant>
retainAll
in interface List<JSONVariant>
public JSONVariant set(int index, JSONVariant element)
set
in interface List<JSONVariant>
public int size()
size
in interface Collection<JSONVariant>
size
in interface List<JSONVariant>
public List<JSONVariant> subList(int fromIndex, int toIndex)
subList
in interface List<JSONVariant>
public Object[] toArray()
toArray
in interface Collection<JSONVariant>
toArray
in interface List<JSONVariant>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<JSONVariant>
toArray
in interface List<JSONVariant>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |