List of usage examples for com.google.gson JsonPrimitive getAsInt
@Override public int getAsInt()
From source file:tk.breezy64.pantex.core.ConfigManager.java
private static Object jsonElementToObject(JsonElement e) { if (e.isJsonObject()) { return jsonObjectToMap(e.getAsJsonObject()); } else if (e.isJsonPrimitive()) { JsonPrimitive p = e.getAsJsonPrimitive(); if (p.isNumber()) { return p.getAsInt(); } else if (p.isString()) { return p.getAsString(); } else if (p.isBoolean()) { return p.getAsBoolean(); }//from ww w . java2 s.c o m } else if (e.isJsonArray()) { List<Object> list = new ArrayList<>(); e.getAsJsonArray().forEach((x) -> list.add(jsonElementToObject(x))); return list; } return null; }