JsonNumberUtils
.@Deprecated
public final class JsonNumberUtils
extends java.lang.Object
String
s into Java numeric objects.Modifier and Type | Method and Description |
---|---|
static java.math.BigDecimal |
asBigDecimal(java.lang.String jsonNumberString)
Deprecated.
Replaced by
JsonNumberUtils.asBigDecimal(String) |
static java.math.BigInteger |
asBigInteger(java.lang.String jsonNumberString)
Deprecated.
Replaced by
JsonNumberUtils.asBigInteger(String) |
static java.lang.Double |
asDouble(java.lang.String jsonNumberString)
Deprecated.
Replaced by
JsonNumberUtils.asDouble(String) |
static java.lang.Integer |
asInteger(java.lang.String jsonNumberString)
Deprecated.
Replaced by
JsonNumberUtils.asInteger(String) |
public static java.math.BigDecimal asBigDecimal(java.lang.String jsonNumberString)
JsonNumberUtils.asBigDecimal(String)
String
s into BigDecimal
s.jsonNumberString
- a String
representation of a JSON number.BigDecimal
representing the given JSON number String
.java.lang.NumberFormatException
- if the given String
is not a valid JSON number.public static java.math.BigInteger asBigInteger(java.lang.String jsonNumberString)
JsonNumberUtils.asBigInteger(String)
String
s into BigInteger
s.jsonNumberString
- a String
representation of an integer JSON number.BigInteger
representing the given JSON number String
.java.lang.NumberFormatException
- if the given String
is not a valid JSON number or is not an integer.public static java.lang.Double asDouble(java.lang.String jsonNumberString)
JsonNumberUtils.asDouble(String)
String
s into Double
s. Note that use of this
method is risky as java Double
s have limited precision, whereas JSON numbers have unlimited
precision, i.e. converting a JSON number to a Double
may result is a loss of accuracy.jsonNumberString
- a String
representation of an integer JSON number.Double
representing the given JSON number String
.java.lang.NumberFormatException
- if the given String
is not a valid JSON number.public static java.lang.Integer asInteger(java.lang.String jsonNumberString)
JsonNumberUtils.asInteger(String)
String
s into Integer
s. Note that use of this
method is risky as java Integer
s have limited precision (between Integer.MIN_VALUE
and
Integer.MAX_VALUE
) whereas JSON numbers have unlimited precision.jsonNumberString
- a String
representation of an integer JSON number.Integer
representing the given JSON number String
.java.lang.NumberFormatException
- if the given String
is not a valid JSON number or is not an integer.