Package org.dashbuilder.json
Class JsonObject
- java.lang.Object
-
- org.dashbuilder.json.JsonObject
-
-
Constructor Summary
Constructors Constructor Description JsonObject(JsonFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasBoolean()Convert the underlying value to booleandoubleasNumber()Convert the underlying value to a numberStringasString()Convert the underlying value to a StringJsonValueget(String key)JsonArraygetArray(String key)JsonArraygetArray(Collection<String> keys)booleangetBoolean(String key)JsonValuegetFirst(Collection<String> keys)NumbergetNumber(String key)NumbergetNumber(String key, Number defaultValue)JsonObjectgetObject(String key)JsonObjectgetObject(Collection<String> keys)StringgetString(String key)StringgetString(Collection<String> keys)JsonTypegetType()Returns an enumeration representing the fundamental JSON type.booleanhas(String key)booleanhasKey(String key)booleanisEmpty()Check if the json has no value stored.String[]keys()voidput(String key, boolean bool)voidput(String key, double value)voidput(String key, String value)voidput(String key, JsonValue value)voidremove(String key)voidset(String key, JsonValue value)intsize()StringtoJson()Returns a serialized JSON string representing this value.StringtoString()voidtraverse(org.dashbuilder.json.JsonVisitor visitor, org.dashbuilder.json.JsonContext ctx)Visitor interface
-
-
-
Constructor Detail
-
JsonObject
public JsonObject(JsonFactory factory)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
Description copied from interface:JsonValueCheck if the json has no value stored.
-
asBoolean
public boolean asBoolean()
Description copied from interface:JsonValueConvert the underlying value to boolean
-
asNumber
public double asNumber()
Description copied from interface:JsonValueConvert the underlying value to a number
-
asString
public String asString()
Description copied from interface:JsonValueConvert the underlying value to a String
-
has
public boolean has(String key)
-
getFirst
public JsonValue getFirst(Collection<String> keys)
-
getArray
public JsonArray getArray(Collection<String> keys)
-
getBoolean
public boolean getBoolean(String key)
-
getObject
public JsonObject getObject(String key)
-
getString
public String getString(Collection<String> keys)
-
getObject
public JsonObject getObject(Collection<String> keys)
-
getType
public JsonType getType()
Description copied from interface:JsonValueReturns an enumeration representing the fundamental JSON type.
-
hasKey
public boolean hasKey(String key)
-
size
public int size()
-
keys
public String[] keys()
-
put
public void put(String key, double value)
-
put
public void put(String key, boolean bool)
-
remove
public void remove(String key)
-
toJson
public String toJson()
Description copied from interface:JsonValueReturns a serialized JSON string representing this value.
-
-