Example usage for javax.json JsonNumber bigDecimalValue

List of usage examples for javax.json JsonNumber bigDecimalValue

Introduction

In this page you can find the example usage for javax.json JsonNumber bigDecimalValue.

Prototype

BigDecimal bigDecimalValue();

Source Link

Document

Returns this JSON number as a BigDecimal object.

Usage

From source file:com.buffalokiwi.aerodrome.jet.Utils.java

public static BigDecimal getJsonNumber(final JsonNumber n) {
    final BigDecimal b = new BigDecimal(0);
    if (n == null)
        return b;

    return n.bigDecimalValue();
}

From source file:com.buffalokiwi.aerodrome.jet.Utils.java

public static BigDecimal jsonNumberToBigDecimal(final JsonNumber n, final int defaultValue) {
    if (n == null)
        return new BigDecimal(defaultValue);

    return n.bigDecimalValue();
}

From source file:org.btc4j.daemon.BtcJsonRpcHttpClient.java

public BigDecimal jsonDouble(JsonObject object, String key) throws BtcException {
    JsonNumber number = object.getJsonNumber(key);
    return (number == null) ? BigDecimal.ZERO : number.bigDecimalValue();
}