public class JsonNumber extends JsonElement
Represents a JSON number element.
Modifier and Type | Field and Description |
---|---|
static JsonNumber |
zero |
TYPE_ARRAY, TYPE_BOOLEAN, TYPE_NUMBER, TYPE_OBJECT, TYPE_STRING
Modifier and Type | Method and Description |
---|---|
int |
getType()
Return JsonElement.TYPE_NUMBER.
|
java.lang.String |
getValue()
Return value of this element, expressed as a string to retain all precision.
|
static JsonNumber |
of(java.lang.String value)
Return a number element with the specified
value . |
static JsonNumber |
ofInt(int value)
Return a number element with the specified
value . |
static JsonNumber |
ofLong(int value)
Return a number element with the specified
value . |
java.lang.String |
toString()
Return the number
JsonNumber.value in JSON format. |
applyVersion, format, parse, parseArray, parseObject, parseOptimized
public static final JsonNumber zero
public int getType()
Return JsonElement.TYPE_NUMBER.
getType
in class JsonElement
public java.lang.String getValue()
Return value of this element, expressed as a string to retain all precision.
public static JsonNumber of(java.lang.String value)
Return a number element with the specified value
.
value
- Number value, expressed as a string to retain all precision. The string must contain valid JSON number syntax.value
.public static JsonNumber ofInt(int value)
Return a number element with the specified value
.
value
- Number value.value
.public static JsonNumber ofLong(int value)
Return a number element with the specified value
.
value
- Number value.value
.public java.lang.String toString()
Return the number JsonNumber.value
in JSON format.
toString
in class JsonElement
JsonNumber.value
in JSON format.