|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.json.AbstractJSONValue ikrs.json.JSONObject
public class JSONObject
Field Summary |
---|
Fields inherited from interface ikrs.json.JSONValue |
---|
FALSE, NULL, TRUE, TYPE_ARRAY, TYPE_BOOLEAN, TYPE_NULL, TYPE_NUMBER, TYPE_OBJECT, TYPE_STRING |
Constructor Summary | |
---|---|
JSONObject()
Create a new JSON object. |
|
JSONObject(java.util.Map<java.lang.String,JSONValue> object)
Create a new JSON object. |
Method Summary | |
---|---|
JSONArray |
asJSONArray()
This method tries to convert this JSONValue into a JSONArray. |
JSONObject |
asJSONObject()
This method tries to convert this JSONValue into a JSONObject. |
protected java.util.Map<java.lang.String,JSONValue> |
getMap()
This method is a copy of getObject(), but with two differences: it is protected (only for subclasses) and does not thrown any exceptions. |
java.util.Map<java.lang.String,JSONValue> |
getObject()
Get the object value as a Map from this JSON value. |
static void |
main(java.lang.String[] argv)
For testing purposes only. |
java.lang.String |
toString()
|
void |
write(java.io.Writer writer)
This method MUST write a valid JSON value to the passed writer. |
Methods inherited from class ikrs.json.AbstractJSONValue |
---|
asJSONBoolean, asJSONNumber, asJSONString, getArray, getBoolean, getNumber, getString, getTypeName, isArray, isBoolean, isNull, isNumber, isObject, isString, isValidTypeID, toJSONString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JSONObject()
public JSONObject(java.util.Map<java.lang.String,JSONValue> object) throws java.lang.NullPointerException
object
- The object value this JSON value should have.
java.lang.NullPointerException
Method Detail |
---|
public java.util.Map<java.lang.String,JSONValue> getObject() throws JSONException
getObject
in interface JSONValue
getObject
in class AbstractJSONValue
JSONException
- If this value does not represent an object.public JSONArray asJSONArray() throws JSONException
asJSONArray
in interface JSONValue
asJSONArray
in class AbstractJSONValue
JSONException
- If this value is not convertible to an array.public JSONObject asJSONObject() throws JSONException
asJSONObject
in interface JSONValue
asJSONObject
in class AbstractJSONValue
JSONException
- If this value is not convertible to an object.public void write(java.io.Writer writer) throws java.io.IOException
write
in interface JSONValue
write
in class AbstractJSONValue
writer
- The writer to write to.
java.io.IOException
- If any IO errors occur.protected java.util.Map<java.lang.String,JSONValue> getMap()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |