Example usage for javax.json JsonNumber toString

List of usage examples for javax.json JsonNumber toString

Introduction

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

Prototype

@Override
String toString();

Source Link

Document

Returns a JSON text representation of the JSON number.

Usage

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

public static Money jsonNumberToMoney(final JsonNumber n) {
    if (n == null)
        return new Money();
    return Money.createFromStringOrZero(n.toString());
}

From source file:org.apache.unomi.services.services.SegmentServiceImpl.java

public static void dumpJSON(JsonValue tree, String key, String depthPrefix) {
    if (key != null)
        logger.info(depthPrefix + "Key " + key + ": ");
    switch (tree.getValueType()) {
    case OBJECT:/*from   ww w.  j a  v  a2  s.  c  o  m*/
        logger.info(depthPrefix + "OBJECT");
        JsonObject object = (JsonObject) tree;
        for (String name : object.keySet())
            dumpJSON(object.get(name), name, depthPrefix + "  ");
        break;
    case ARRAY:
        logger.info(depthPrefix + "ARRAY");
        JsonArray array = (JsonArray) tree;
        for (JsonValue val : array)
            dumpJSON(val, null, depthPrefix + "  ");
        break;
    case STRING:
        JsonString st = (JsonString) tree;
        logger.info(depthPrefix + "STRING " + st.getString());
        break;
    case NUMBER:
        JsonNumber num = (JsonNumber) tree;
        logger.info(depthPrefix + "NUMBER " + num.toString());
        break;
    case TRUE:
    case FALSE:
    case NULL:
        logger.info(depthPrefix + tree.getValueType().toString());
        break;
    }
}