|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ikrs.json.AbstractJSONValue ikrs.json.JSONArray
public class JSONArray
This is the JSON array subclass.
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 | |
---|---|
JSONArray()
Creates a new empty JSON array backed by an internal ArrayList instance. |
|
JSONArray(java.util.List<JSONValue> array)
Create a new JSON array. |
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. |
java.util.List<JSONValue> |
getArray()
Get the array value as a List from this JSON value. |
protected java.util.List<JSONValue> |
getList()
This method is a copy of getArray(), but with two differences: it is protected (only for subclasses) and does not thrown any exceptions. |
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, getBoolean, getNumber, getObject, 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 JSONArray()
public JSONArray(java.util.List<JSONValue> array) throws java.lang.NullPointerException
array
- The array value this JSON value should have.
java.lang.NullPointerException
Method Detail |
---|
public java.util.List<JSONValue> getArray() throws JSONException
getArray
in interface JSONValue
getArray
in class AbstractJSONValue
JSONException
- If this value does not represent an array.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.List<JSONValue> getList()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |