java.lang.Object
io.helidon.json.JsonValue
io.helidon.json.JsonNumber
Represents a JSON number value.
-
Method Summary
Modifier and TypeMethodDescriptionReturn the BigDecimal value of this JsonNumber.Return the BigInteger value of this JsonNumber.byteReturn the byte value of this JsonNumber.static JsonNumbercreate(double doubleValue) Create a JsonNumber from a double value.static JsonNumbercreate(long longValue) Create a JsonNumber from a long value.static JsonNumbercreate(BigDecimal bigDecimalValue) Create a JsonNumber from a BigDecimal value.doubleReturn the double value of this JsonNumber.floatReturn the float value of this JsonNumber.intintValue()Return the int value of this JsonNumber.longReturn the long value of this JsonNumber.shortReturn the short value of this JsonNumber.voidtoJson(JsonGenerator generator) Write this JSON value to the provided generator.type()Return the type of this JSON value.
-
Method Details
-
create
Create a JsonNumber from a BigDecimal value.- Parameters:
bigDecimalValue- the BigDecimal value- Returns:
- a new JsonNumber
-
create
Create a JsonNumber from a double value.- Parameters:
doubleValue- the double value- Returns:
- a new JsonNumber
-
create
Create a JsonNumber from a long value.- Parameters:
longValue- the long value- Returns:
- a new JsonNumber
-
doubleValue
public double doubleValue()Return the double value of this JsonNumber.- Returns:
- the double value
-
byteValue
public byte byteValue()Return the byte value of this JsonNumber.- Returns:
- the byte value
-
shortValue
public short shortValue()Return the short value of this JsonNumber.- Returns:
- the short value
-
intValue
public int intValue()Return the int value of this JsonNumber.- Returns:
- the int value
-
longValue
public long longValue()Return the long value of this JsonNumber.- Returns:
- the long value
-
floatValue
public float floatValue()Return the float value of this JsonNumber.- Returns:
- the float value
-
bigIntegerValue
Return the BigInteger value of this JsonNumber.For a nonzero value with a negative scale, a conversion may introduce at most 4,096 trailing decimal digits. Numbers originating from the same parsed JSON document also share a cumulative budget of 65,536 such digits; every invocation consumes that document budget. Programmatically created numbers have only the per-conversion limit.
- Returns:
- the BigInteger value
- Throws:
JsonException- if the conversion exceeds the per-value or parsed-document expansion budget
-
bigDecimalValue
Return the BigDecimal value of this JsonNumber.- Returns:
- the BigDecimal value
-
type
Description copied from class:JsonValueReturn the type of this JSON value. -
toJson
Description copied from class:JsonValueWrite this JSON value to the provided generator.
-