public class JreJsonObject extends JreJsonValue implements JsonObject
Constructor and Description |
---|
JreJsonObject(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(String key)
Return the element (uncoerced) as a JsonValue.
|
JsonArray |
getArray(String key)
Return the element (uncoerced) as a JsonArray.
|
boolean |
getBoolean(String key)
Return the element (uncoerced) as a boolean.
|
double |
getNumber(String key)
Return the element (uncoerced) as a number.
|
Object |
getObject() |
JsonObject |
getObject(String key)
Return the element (uncoerced) as a JsonObject If the type is not an object,,
this can result in runtime errors.
|
String |
getString(String key)
Return the element (uncoerced) as a String.
|
JsonType |
getType()
Returns an enumeration representing the fundamental JSON type.
|
boolean |
hasKey(String key)
Test whether a given key has present.
|
boolean |
jsEquals(JsonValue value)
Equivalent of Javascript '==' operator comparison between two values.
|
String[] |
keys()
All keys of the object.
|
void |
put(String key,
boolean bool)
Set a given key to the given boolean value.
|
void |
put(String key,
double value)
Set a given key to the given double value.
|
void |
put(String key,
JsonValue value)
Set a given key to the given value.
|
void |
put(String key,
String value)
Set a given key to the given String value.
|
void |
remove(String key)
Remove a given key and associated value from the object.
|
void |
set(String key,
JsonValue value) |
String |
toJson()
Returns a serialized JSON string representing this value.
|
String |
toString() |
void |
traverse(elemental.json.impl.JsonVisitor visitor,
elemental.json.impl.JsonContext ctx) |
parseJson, toNative
public JreJsonObject(JsonFactory factory)
public boolean asBoolean()
JsonValue
public double asNumber()
JsonValue
public String asString()
JsonValue
public JsonValue get(String key)
JsonObject
get
in interface JsonObject
public JsonArray getArray(String key)
JsonObject
getArray
in interface JsonObject
public boolean getBoolean(String key)
JsonObject
getBoolean
in interface JsonObject
public double getNumber(String key)
JsonObject
getNumber
in interface JsonObject
public JsonObject getObject(String key)
JsonObject
getObject
in interface JsonObject
public Object getObject()
getObject
in class JreJsonValue
public String getString(String key)
JsonObject
getString
in interface JsonObject
public JsonType getType()
JsonValue
public boolean hasKey(String key)
JsonObject
hasKey
in interface JsonObject
public boolean jsEquals(JsonValue value)
JsonValue
public String[] keys()
JsonObject
keys
in interface JsonObject
public void put(String key, JsonValue value)
JsonObject
put
in interface JsonObject
public void put(String key, String value)
JsonObject
put
in interface JsonObject
public void put(String key, double value)
JsonObject
put
in interface JsonObject
public void put(String key, boolean bool)
JsonObject
put
in interface JsonObject
public void remove(String key)
JsonObject
remove
in interface JsonObject
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.