public class JSONObject extends JSONValue
Constructor and Description |
---|
JSONObject() |
JSONObject(JavaScriptObject jsValue)
Creates a new JSONObject from the supplied JavaScript value.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(java.lang.String key)
Tests whether or not this JSONObject contains the specified property.
|
boolean |
equals(java.lang.Object other)
|
JSONValue |
get(java.lang.String key)
Gets the JSONValue associated with the specified property.
|
JavaScriptObject |
getJavaScriptObject()
Returns the underlying JavaScript object that this object wraps.
|
(package private) JavaScriptObject |
getUnwrapper()
Internal.
|
int |
hashCode() |
JSONObject |
isObject()
Returns
this , as this is a JSONObject. |
java.util.Set<java.lang.String> |
keySet()
Returns the set of properties defined on this JSONObject.
|
JSONValue |
put(java.lang.String key,
JSONValue jsonValue)
Assign the specified property to the specified value in this JSONObject.
|
int |
size()
Determines the number of properties on this object.
|
java.lang.String |
toString()
Converts a JSONObject into a JSON representation that can be used to
communicate with a JSON service.
|
public JSONObject()
public JSONObject(JavaScriptObject jsValue)
public boolean containsKey(java.lang.String key)
key
- the property to search fortrue
if the JSONObject contains the specified propertypublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public JSONValue get(java.lang.String key)
key
- the property to accessnull
if the
property does not existjava.lang.NullPointerException
- if key is null
public JavaScriptObject getJavaScriptObject()
public int hashCode()
hashCode
in class java.lang.Object
public JSONObject isObject()
this
, as this is a JSONObject.public java.util.Set<java.lang.String> keySet()
public JSONValue put(java.lang.String key, JSONValue jsonValue)
key
- the property to assignjsonValue
- the value to assignnull
if the
property did not existjava.lang.NullPointerException
- if key is null
public int size()
public java.lang.String toString()
JavaScriptObject getUnwrapper()
JSONValue
getUnwrapper
in class JSONValue