List of usage examples for com.google.gson.internal.bind TypeAdapters NUMBER
TypeAdapter NUMBER
To view the source code for com.google.gson.internal.bind TypeAdapters NUMBER.
Click Source Link
From source file:com.flipkart.batching.gson.adapters.BatchingTypeAdapters.java
License:Open Source License
private static void write(Gson gson, JsonWriter out, @Nullable Object value) throws IOException { if (value == null) { out.nullValue();/*from w w w .ja v a 2 s . c om*/ } else if (value instanceof JSONObject) { getJSONObjectTypeAdapter(gson).write(out, (JSONObject) value); } else if (value instanceof JSONArray) { getJSONArrayTypeAdapter(gson).write(out, (JSONArray) value); } else if (value instanceof String) { TypeAdapters.STRING.write(out, (String) value); } else if (value instanceof Number) { TypeAdapters.NUMBER.write(out, (Number) value); } else if (value instanceof Boolean) { TypeAdapters.BOOLEAN.write(out, (Boolean) value); } else { gson.toJson(value, value.getClass(), out); } }