MCPcopy
hub / github.com/google/gson / deserialize

Method deserialize

src/main/java/com/google/gson/MapTypeAdapter.java:60–72  ·  view source on GitHub ↗
(JsonElement json, Type typeOfT, JsonDeserializationContext context)

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 7

constructMapTypeMethod · 0.80
entrySetMethod · 0.80
deserializeMethod · 0.65
getRawTypeMethod · 0.45
getAsJsonObjectMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected