List of usage examples for com.google.gson JsonElement getAsDouble
public double getAsDouble()
From source file:vellum.jx.JMaps.java
License:Apache License
public static Object parsePrimitive(JsonElement element) { String string = element.toString(); if (string.equals("true")) { return element.getAsBoolean(); } else if (string.equals("false")) { return element.getAsBoolean(); } else if (string.startsWith("\"")) { return element.getAsString(); } else if (string.contains(".")) { return element.getAsDouble(); } else if (string.matches("[0-9]*")) { return element.getAsLong(); }//from ww w .jav a 2 s. com return element.getAsString(); }