public static interface Json.Array
int->value map.| Modifier and Type | Method and Description |
|---|---|
Json.Array |
add(int index,
java.lang.Object value)
Inserts a JSON boolean, null, number, object, or array value at the given index.
|
Json.Array |
add(java.lang.Object value)
Appends a JSON boolean, null, number, object, or array value.
|
Json.Array |
getArray(int index)
Gets the array value at the given index, or
null if there is no value at this
index. |
<T> Json.TypedArray<T> |
getArray(int index,
java.lang.Class<T> jsonType)
Gets an array at the given index that assumes its values are of the given json type, or
null if there is no value at this index. |
Json.Array |
getArray(int index,
Json.Array dflt)
Gets the array value at the given index, or the default if there is no value at this index.
|
boolean |
getBoolean(int index)
Gets the boolean value at the given index, or
false if there is no value at this
index. |
boolean |
getBoolean(int index,
boolean dflt)
Gets the boolean value at the given index, or the default if there is no value at this index.
|
double |
getDouble(int index)
Gets the double value at the given index, or
0 if there is no value at this
index. |
double |
getDouble(int index,
double dflt)
Gets the double value at the given index, or the default if there is no value at this index.
|
int |
getInt(int index)
Gets the integer value at the given index, or
0 if there is no value at this
index. |
int |
getInt(int index,
int dflt)
Gets the integer value at the given index, or the default if there is no value at this index.
|
long |
getLong(int index)
Gets the long value at the given index, or
0 if there is no value at this
index. |
long |
getLong(int index,
long dflt)
Gets the long value at the given index, or the default if there is no value at this index.
|
float |
getNumber(int index)
Gets the float value at the given index, or
0 if there is no value at this
index. |
float |
getNumber(int index,
float dflt)
Gets the float value at the given index, or the default if there is no value at this index.
|
Json.Object |
getObject(int index)
Gets the object value at the given index, or
null if there is no value at this
index. |
Json.Object |
getObject(int index,
Json.Object dflt)
Gets the object value at the given index, or the default if there is no value at this index.
|
java.lang.String |
getString(int index)
Gets the string value at the given index, or
null if there is no value at this
index. |
java.lang.String |
getString(int index,
java.lang.String dflt)
Gets the string value at the given index, or the default if there is no value at this index.
|
boolean |
isArray(int index)
Returns
true if the value at the given index is an array. |
boolean |
isBoolean(int index)
Returns
true if the value at the given index is a boolean. |
boolean |
isNull(int index)
Returns
true if the value at the given index is null, or does not exist. |
boolean |
isNumber(int index)
Returns
true if the value at the given index is a number. |
boolean |
isObject(int index)
Returns
true if the value at the given index is an object. |
boolean |
isString(int index)
Returns
true if the value at the given index is a string. |
int |
length()
Gets the length of this array.
|
Json.Array |
remove(int index)
Removes a JSON value from the given index.
|
Json.Array |
set(int index,
java.lang.Object value)
Sets a JSON boolean, null, number, object, or array value at the given index.
|
<T extends playn.core.json.JsonSink<T>> |
write(playn.core.json.JsonSink<T> sink)
Writes this object to a
JsonSink. |
int length()
boolean getBoolean(int index)
false if there is no value at this
index.boolean getBoolean(int index,
boolean dflt)
float getNumber(int index)
0 if there is no value at this
index.float getNumber(int index,
float dflt)
double getDouble(int index)
0 if there is no value at this
index.double getDouble(int index,
double dflt)
int getInt(int index)
0 if there is no value at this
index.int getInt(int index,
int dflt)
long getLong(int index)
0 if there is no value at this
index. NOTE: this is not accurate on the HTML backend as all numbers are
represented as doubles, which cannot represent all possible long values. This is included
for projects that use only the other backends and need long values.long getLong(int index,
long dflt)
java.lang.String getString(int index)
null if there is no value at this
index.java.lang.String getString(int index,
java.lang.String dflt)
Json.Object getObject(int index)
null if there is no value at this
index.Json.Object getObject(int index, Json.Object dflt)
Json.Array getArray(int index)
null if there is no value at this
index.Json.Array getArray(int index, Json.Array dflt)
<T> Json.TypedArray<T> getArray(int index, java.lang.Class<T> jsonType)
null if there is no value at this index.jsonType - one of Json.Object, Json.Array, Boolean, Integer, Float, Double, or Stringjava.lang.IllegalArgumentException - if jsonType is of an invalid type.boolean isArray(int index)
true if the value at the given index is an array.boolean isBoolean(int index)
true if the value at the given index is a boolean.boolean isNull(int index)
true if the value at the given index is null, or does not exist.boolean isNumber(int index)
true if the value at the given index is a number.boolean isString(int index)
true if the value at the given index is a string.boolean isObject(int index)
true if the value at the given index is an object.Json.Array add(java.lang.Object value)
Json.Array add(int index, java.lang.Object value)
Json.Array remove(int index)
Json.Array set(int index, java.lang.Object value)
<T extends playn.core.json.JsonSink<T>> playn.core.json.JsonSink<T> write(playn.core.json.JsonSink<T> sink)
JsonSink.Copyright © 2018. All Rights Reserved.