elemental.json.impl.
Class JreJsonArray
- java.lang.Object
-
- elemental.json.impl.JreJsonValue
-
- elemental.json.impl.JreJsonArray
-
All Implemented Interfaces:
public class JreJsonArray extends JreJsonValue implements JsonArray
Server-side implementation of JsonArray.
See Also:
-
-
Constructor Summary
Constructors Constructor Description JreJsonArray(JsonFactory factory)
-
Method Summary
All Methods Modifier and Type Method 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)
-
Methods inherited from class elemental.json.impl.JreJsonValue
parseJson, toNative
-
-
-
-
Constructor Detail
-
JreJsonArray
public JreJsonArray(JsonFactory factory)
-
-
Method Detail
-
asBoolean
public boolean asBoolean()
Description copied from interface:
JsonValue
Coerces underlying value to boolean according to the rules of Javascript coercion.
-
asNumber
public double asNumber()
Description copied from interface:
JsonValue
Coerces the underlying value to a number according to the rules of Javascript coercion.
-
asString
public String asString()
Description copied from interface:
JsonValue
Coerces the underlying value to a String according to the rules of JavaScript coercion.
-
get
public JsonValue get(int index)
Description copied from interface:
JsonArray
Return the ith element of the array.
-
getArray
public JsonArray getArray(int index)
Description copied from interface:
JsonArray
Return the ith element of the array (uncoerced) as a JsonArray. If the type is not an array, this can result in runtime errors.
-
getBoolean
public boolean getBoolean(int index)
Description copied from interface:
JsonArray
Return the ith element of the array (uncoerced) as a boolean. If the type is not a boolean, this can result in runtime errors.
Specified by:
getBoolean
in interfaceJsonArray
-
getNumber
public double getNumber(int index)
Description copied from interface:
JsonArray
Return the ith element of the array (uncoerced) as a number. If the type is not a number, this can result in runtime errors.
-
getObject
public JsonObject getObject(int index)
Description copied from interface:
JsonArray
Return the ith element of the array (uncoerced) as a JsonObject If the type is not an object,, this can result in runtime errors.
-
getObject
public Object getObject()
Specified by:
getObject
in classJreJsonValue
-
getString
public String getString(int index)
Description copied from interface:
JsonArray
Return the ith element of the array (uncoerced) as a String. If the type is not a String, this can result in runtime errors.
-
getType
public JsonType getType()
Description copied from interface:
JsonValue
Returns an enumeration representing the fundamental JSON type.
-
jsEquals
public boolean jsEquals(JsonValue value)
Description copied from interface:
JsonValue
Equivalent of Javascript '==' operator comparison between two values.
-
length
public int length()
Description copied from interface:
JsonArray
Length of the array.
-
remove
public void remove(int index)
Description copied from interface:
JsonArray
Remove an element of the array at a particular index.
-
set
public void set(int index, JsonValue value)
Description copied from interface:
JsonArray
Set the value at index to be a given value.
-
set
public void set(int index, String string)
Description copied from interface:
JsonArray
Set the value at index to be a String value.
-
set
public void set(int index, double number)
Description copied from interface:
JsonArray
Set the value at index to be a number value.
-
set
public void set(int index, boolean bool)
Description copied from interface:
JsonArray
Set the value at index to be a boolean value.
-
toJson
public String toJson()
Description copied from interface:
JsonValue
Returns a serialized JSON string representing this value.
-
traverse
public void traverse(elemental.json.impl.JsonVisitor visitor, elemental.json.impl.JsonContext ctx)
Specified by:
traverse
in classJreJsonValue
-
-