List of usage examples for com.google.gson.internal LazilyParsedNumber longValue
@Override public long longValue()
From source file:com.tsc9526.monalisa.tools.json.MelpJson.java
License:Open Source License
public static Object primitive(JsonPrimitive e) { if (e.isNumber()) { Number n = e.getAsNumber(); if (n instanceof LazilyParsedNumber) { LazilyParsedNumber ln = (LazilyParsedNumber) n; String value = ln.toString(); if (value.indexOf('.') >= 0) { return ln.doubleValue(); } else { return ln.longValue(); }/*from ww w . j a va2 s. co m*/ } else { return n; } } else if (e.isBoolean()) { return e.getAsBoolean(); } else { return e.getAsString(); } }