public class JreJsonArray extends JreJsonValue implements JsonArray
Constructor and Description |
---|
JreJsonArray(JsonFactory factory) |
Modifier and Type | Method and Description |
---|---|
boolean |
asBoolean()
Coerces underlying value to boolean according to the rules of Javascript coercion.
|
double |
asNumber()
Coerces the underlying value to a number according to the rules of Javascript coercion.
|
String |
asString()
Coerces the underlying value to a String according to the rules of JavaScript coercion.
|
JsonValue |
get(int index)
Return the ith element of the array.
|
JsonArray |
getArray(int index)
Return the ith element of the array (uncoerced) as a JsonArray.
|
boolean |
getBoolean(int index)
Return the ith element of the array (uncoerced) as a boolean.
|
double |
getNumber(int index)
Return the ith element of the array (uncoerced) as a number.
|
Object |
getObject() |
JsonObject |
getObject(int index)
Return the ith element of the array (uncoerced) as a JsonObject If the type is not an object,,
this can result in runtime errors.
|
String |
getString(int index)
Return the ith element of the array (uncoerced) as a String.
|
JsonType |
getType()
Returns an enumeration representing the fundamental JSON type.
|
boolean |
jsEquals(JsonValue value)
Equivalent of Javascript '==' operator comparison between two values.
|
int |
length()
Length of the array.
|
void |
remove(int index)
Remove an element of the array at a particular index.
|
void |
set(int index,
boolean bool)
Set the value at index to be a boolean value.
|
void |
set(int index,
double number)
Set the value at index to be a number value.
|
void |
set(int index,
JsonValue value)
Set the value at index to be a given value.
|
void |
set(int index,
String string)
Set the value at index to be a String value.
|
String |
toJson()
Returns a serialized JSON string representing this value.
|
void |
traverse(elemental.json.impl.JsonVisitor visitor,
elemental.json.impl.JsonContext ctx) |
toNative
public JreJsonArray(JsonFactory factory)
public boolean asBoolean()
JsonValue
public double asNumber()
JsonValue
public String asString()
JsonValue
public JsonValue get(int index)
JsonArray
public JsonArray getArray(int index)
JsonArray
public boolean getBoolean(int index)
JsonArray
getBoolean
in interface JsonArray
public double getNumber(int index)
JsonArray
public JsonObject getObject(int index)
JsonArray
public Object getObject()
getObject
in class JreJsonValue
public String getString(int index)
JsonArray
public JsonType getType()
JsonValue
public boolean jsEquals(JsonValue value)
JsonValue
public int length()
JsonArray
public void remove(int index)
JsonArray
public void set(int index, JsonValue value)
JsonArray
public void set(int index, String string)
JsonArray
public void set(int index, double number)
JsonArray
public void set(int index, boolean bool)
JsonArray
public String toJson()
JsonValue
public void traverse(elemental.json.impl.JsonVisitor visitor, elemental.json.impl.JsonContext ctx)
traverse
in class JreJsonValue
Copyright © 2018. All rights reserved.