|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectikrs.json.AbstractJSONValue
public abstract class AbstractJSONValue
| 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 | |
|---|---|
protected |
AbstractJSONValue(int type)
|
| Method Summary | |
|---|---|
JSONArray |
asJSONArray()
This method tries to convert this JSONValue into a JSONArray. |
JSONBoolean |
asJSONBoolean()
This method tries to convert this JSONValue into a JSONBoolean. |
JSONNumber |
asJSONNumber()
This method tries to convert this JSONValue into a JSONNumber. |
JSONObject |
asJSONObject()
This method tries to convert this JSONValue into a JSONObject. |
JSONString |
asJSONString()
This method tries to convert this JSONValue into a JSONString. |
java.util.List<JSONValue> |
getArray()
Get the array value as a List from this JSON value. |
java.lang.Boolean |
getBoolean()
Get the boolean from this JSON value. |
java.lang.Number |
getNumber()
Get the number from this JSON value. |
java.util.Map<java.lang.String,JSONValue> |
getObject()
Get the object value as a Map from this JSON value. |
java.lang.String |
getString()
Get the string from this JSON value. |
java.lang.String |
getTypeName()
|
boolean |
isArray()
This method indicates if this JSON value is an array. |
boolean |
isBoolean()
This method indicates if this JSON value is a boolean. |
boolean |
isNull()
This method indicates if this is JSON NULL. |
boolean |
isNumber()
This method indicates if this JSON value is a number. |
boolean |
isObject()
This method indicates if this JSON value is an object. |
boolean |
isString()
This method indicates if this JSON value is a string. |
boolean |
isValidTypeID(int type)
This method indicates if the passed type ID is supported by this class. |
java.lang.String |
toJSONString()
Converts this JSON value into a valid JSON string. |
abstract void |
write(java.io.Writer writer)
This method MUST write a valid JSON value to the passed writer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractJSONValue(int type)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException| Method Detail |
|---|
public boolean isNumber()
isNumber in interface JSONValuepublic boolean isBoolean()
isBoolean in interface JSONValuepublic boolean isString()
isString in interface JSONValuepublic boolean isArray()
isArray in interface JSONValuepublic boolean isObject()
isObject in interface JSONValuepublic boolean isNull()
isNull in interface JSONValue
public java.lang.Number getNumber()
throws JSONException
getNumber in interface JSONValueJSONException - If this value does not represent a number.
public java.lang.Boolean getBoolean()
throws JSONException
getBoolean in interface JSONValueJSONException - If this value does not represent a boolean value.
public java.lang.String getString()
throws JSONException
getString in interface JSONValueJSONException - If this value does not represent a string.
public java.util.List<JSONValue> getArray()
throws JSONException
getArray in interface JSONValueJSONException - If this value does not represent an array.
public java.util.Map<java.lang.String,JSONValue> getObject()
throws JSONException
getObject in interface JSONValueJSONException - If this value does not represent an object.
public JSONBoolean asJSONBoolean()
throws JSONException
asJSONBoolean in interface JSONValueJSONException - If this value is not convertible to a boolean.
public JSONNumber asJSONNumber()
throws JSONException
asJSONNumber in interface JSONValueJSONException - If this value is not convertible to a number.
public JSONString asJSONString()
throws JSONException
asJSONString in interface JSONValueJSONException - If this value is not convertible to a boolean.
public JSONArray asJSONArray()
throws JSONException
asJSONArray in interface JSONValueJSONException - If this value is not convertible to an array.
public JSONObject asJSONObject()
throws JSONException
asJSONObject in interface JSONValueJSONException - If this value is not convertible to an object.
public abstract void write(java.io.Writer writer)
throws java.io.IOException
write in interface JSONValuewriter - The writer to write to.
java.io.IOException - If any IO errors occur.public java.lang.String toJSONString()
toJSONString in interface JSONValuepublic boolean isValidTypeID(int type)
type - The type ID.
public java.lang.String getTypeName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||