(JsonElement json, Type typeOfT, JsonDeserializationContext context)
| 58 | } |
| 59 | |
| 60 | public Map deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) |
| 61 | throws JsonParseException { |
| 62 | // Use ObjectConstructor to create instance instead of hard-coding a specific type. |
| 63 | // This handles cases where users are using their own subclass of Map. |
| 64 | Map<Object, Object> map = constructMapType(typeOfT, context); |
| 65 | Type[] keyAndValueTypes = $Gson$Types.getMapKeyAndValueTypes(typeOfT, $Gson$Types.getRawType(typeOfT)); |
| 66 | for (Map.Entry<String, JsonElement> entry : json.getAsJsonObject().entrySet()) { |
| 67 | Object key = context.deserialize(new JsonPrimitive(entry.getKey()), keyAndValueTypes[0]); |
| 68 | Object value = context.deserialize(entry.getValue(), keyAndValueTypes[1]); |
| 69 | map.put(key, value); |
| 70 | } |
| 71 | return map; |
| 72 | } |
| 73 | |
| 74 | @Override |
| 75 | public String toString() { |
nothing calls this directly
no test coverage detected