|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectikrs.json.AbstractJSONValue
ikrs.json.JSONNumber
public class JSONNumber
This is the JSON number 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 | |
|---|---|
JSONNumber(java.lang.Number number)
Create a new JSON number. |
|
| Method Summary | |
|---|---|
JSONArray |
asJSONArray()
This method tries to convert this JSONValue into a JSONArray. |
JSONNumber |
asJSONNumber()
This method tries to convert this JSONValue into a JSONNumber. |
JSONString |
asJSONString()
This method tries to convert this JSONValue into a JSONString. |
java.lang.Number |
getNumber()
Get the number from this JSON value. |
static JSONNumber |
parseJSONNumber(java.lang.String str)
This static method is the equivalent to Java's Integer.parseInt(String) respective Double.parseDouble(String). |
static java.lang.Number |
parseNumber(java.lang.String str)
This static method is the equivalent to Java's Integer.parseInt(String) respective Double.parseDouble(String). |
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, asJSONObject, getArray, getBoolean, 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 JSONNumber(java.lang.Number number)
throws java.lang.NullPointerException
number - The numeric value this JSON value should have.
java.lang.NullPointerException - If number is null.| Method Detail |
|---|
public java.lang.Number getNumber()
throws JSONException
getNumber in interface JSONValuegetNumber in class AbstractJSONValueJSONException - If this value does not represent a number.
public JSONNumber asJSONNumber()
throws JSONException
asJSONNumber in interface JSONValueasJSONNumber in class AbstractJSONValueJSONException - If this value is not convertible to a number.
public JSONString asJSONString()
throws JSONException
asJSONString in interface JSONValueasJSONString in class AbstractJSONValueJSONException - If this value is not convertible to a boolean.
public JSONArray asJSONArray()
throws JSONException
asJSONArray in interface JSONValueasJSONArray in class AbstractJSONValueJSONException - If this value is not convertible to an array.
public void write(java.io.Writer writer)
throws java.io.IOException
write in interface JSONValuewrite in class AbstractJSONValuewriter - The writer to write to.
java.io.IOException - If any IO errors occur.public java.lang.String toString()
toString in class java.lang.Object
public static java.lang.Number parseNumber(java.lang.String str)
throws java.lang.NullPointerException,
java.lang.NumberFormatException
str - The string to be parsed.
java.lang.NullPointerException - If the passed string is null.
JSONException - If the passed string does not represent a number.
java.lang.NumberFormatException
public static JSONNumber parseJSONNumber(java.lang.String str)
throws java.lang.NullPointerException,
JSONException
str - The string to be parsed.
java.lang.NullPointerException - If the passed string is null.
JSONException - If the passed string does not represent a number.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||