public class JsonArray extends JsonStructure implements java.lang.Iterable<java.lang.Object>, android.os.Parcelable
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<JsonArray> |
CREATOR |
protected java.util.List<java.lang.Object> |
list |
| Constructor and Description |
|---|
JsonArray()
Creates a new empty JsonArray
|
| Modifier and Type | Method and Description |
|---|---|
JsonArray |
add(boolean value)
Adds the value at the end of this array
|
JsonArray |
add(byte[] v) |
JsonArray |
add(double d) |
JsonArray |
add(JsonArray a) |
JsonArray |
add(JsonObject o) |
JsonArray |
add(long value)
Adds the value at the end of this array
|
JsonArray |
add(java.lang.String value)
Adds the value at the end of this array
|
JsonArray |
addNull() |
JsonArray |
append(JsonArray arr) |
JsonArray |
clear()
Removes all the elements
|
boolean |
contains(java.lang.Object v) |
JsonArray |
copy()
Creates a deeep copy of this structure.
|
static JsonArray |
decode(java.lang.String json) |
int |
describeContents() |
java.lang.String |
encode()
Encodes this structure to it's json representation
|
boolean |
equals(java.lang.Object o) |
<T> T |
get(int index,
T otherwise) |
JsonArray |
getArray(int index) |
JsonArray |
getArray(int index,
JsonArray otherwise) |
byte[] |
getBinary(int index) |
byte[] |
getBinary(int index,
byte[] otherwise) |
java.lang.Boolean |
getBoolean(int index)
Returns the
Boolean at index or null if not found. |
boolean |
getBoolean(int index,
boolean otherwise)
Returns the
boolean at index or otherwise if not found. |
java.lang.Double |
getDouble(int index) |
double |
getDouble(int index,
double otherwise) |
java.lang.Float |
getFloat(int index) |
float |
getFloat(int index,
int otherwise) |
java.lang.Integer |
getInt(int index) |
int |
getInt(int index,
int otherwise) |
java.lang.Long |
getLong(int index)
Returns the
Long at index or null if not found. |
long |
getLong(int index,
long otherwise)
Returns the
long at index or otherwise if not found. |
JsonObject |
getObject(int index) |
JsonObject |
getObject(int index,
JsonObject otherwise) |
java.lang.String |
getString(int index)
Returns the String at index or null if not found.
|
java.lang.String |
getString(int index,
java.lang.String otherwise)
Returns the String at index or otherwise if not found
|
JsonStructure |
getStructure(int index) |
JsonStructure |
getStructure(int index,
JsonStructure otherwise) |
int |
hashCode() |
boolean |
isNull(int index) |
java.util.Iterator<java.lang.Object> |
iterator() |
static JsonArray |
of(java.lang.Object... values) |
java.lang.Object |
remove(int index) |
JsonArray |
set(int index,
boolean value)
Sets the content at index to the value passed as parameter
|
JsonArray |
set(int index,
byte[] value) |
JsonArray |
set(int index,
double value) |
JsonArray |
set(int index,
JsonArray value) |
JsonArray |
set(int index,
JsonObject value) |
JsonArray |
set(int index,
JsonStructure value) |
JsonArray |
set(int index,
long value)
Sets the content at index to the value passed as parameter
|
JsonArray |
set(int index,
java.lang.String value)
Sets the content at index to the value passed as parameter
|
JsonArray |
setNull(int index) |
int |
size() |
java.lang.String |
toString() |
int |
typeAt(int index) |
JsonArray |
values()
Returns the values contained in this structure as a
JsonArray |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
asArray, asObject, isArray, isObjectpublic static final android.os.Parcelable.Creator<JsonArray> CREATOR
protected java.util.List<java.lang.Object> list
public JsonArray copy()
JsonStructurecopy in class JsonStructurepublic static JsonArray of(java.lang.Object... values)
public static JsonArray decode(java.lang.String json)
public JsonArray add(boolean value)
value - public JsonArray add(java.lang.String value)
value - public JsonArray add(long value)
value - public JsonArray add(double d)
public JsonArray addNull()
public JsonArray add(JsonObject o)
public JsonArray add(byte[] v)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String encode()
JsonStructureencode in class JsonStructurepublic java.util.Iterator<java.lang.Object> iterator()
iterator in interface java.lang.Iterable<java.lang.Object>public int describeContents()
describeContents in interface android.os.Parcelablepublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.Parcelablepublic boolean contains(java.lang.Object v)
public <T> T get(int index,
T otherwise)
public JsonArray getArray(int index)
public byte[] getBinary(int index)
public byte[] getBinary(int index,
byte[] otherwise)
public java.lang.Boolean getBoolean(int index)
Boolean at index or null if not found.index - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic boolean getBoolean(int index,
boolean otherwise)
boolean at index or otherwise if not found.index - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic double getDouble(int index,
double otherwise)
public java.lang.Float getFloat(int index)
public java.lang.Double getDouble(int index)
public float getFloat(int index,
int otherwise)
public java.lang.Integer getInt(int index)
public java.lang.Long getLong(int index)
Long at index or null if not found.index - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic int getInt(int index,
int otherwise)
public long getLong(int index,
long otherwise)
long at index or otherwise if not found.index - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic JsonObject getObject(int index)
public JsonObject getObject(int index, JsonObject otherwise)
public java.lang.String getString(int index)
index - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic java.lang.String getString(int index,
java.lang.String otherwise)
index - otherwise - java.lang.IndexOutOfBoundsException - if the index is out of the array boundspublic JsonStructure getStructure(int index)
public JsonStructure getStructure(int index, JsonStructure otherwise)
public int typeAt(int index)
public int size()
public boolean isNull(int index)
public java.lang.Object remove(int index)
public JsonArray set(int index, byte[] value)
public JsonArray set(int index, boolean value)
index - value - public JsonArray set(int index, double value)
public JsonArray set(int index, long value)
index - value - public JsonArray setNull(int index)
public JsonArray set(int index, JsonObject value)
public JsonArray set(int index, java.lang.String value)
index - value - public JsonArray set(int index, JsonStructure value)
public JsonArray values()
JsonStructureJsonArrayvalues in class JsonStructurepublic JsonArray clear()
clear in class JsonStructure