Custom type adapters
In order to specify custom json parsing, {@code Gson} supports {@link TypeAdapter type adapters}. This module adds one to read numbers in a {@code Map
} as Integers. You cancustomize further by adding additional set bindings to the raw type {@code TypeAdapter}.
Here's an example of adding a custom json type adapter. @Provides(type = Provides.Type.SET) TypeAdapter upperZone() { return new TypeAdapter<Zone>() { @Override public void write(JsonWriter out, Zone value) throws IOException { throw new IllegalArgumentException(); } @Override public Zone read(JsonReader in) throws IOException { in.beginObject(); Zone zone = new Zone(); while (in.hasNext()) { zone.put(in.nextName(), in.nextString().toUpperCase()); } in.endObject(); return zone; } }; }