|
37 | 37 | import com.microsoft.graph.http.BaseCollectionResponse; |
38 | 38 | import com.microsoft.graph.logger.ILogger; |
39 | 39 |
|
40 | | -/** Specialized serializer to handle collection responses */ |
41 | | -public class CollectionResponseSerializer { |
| 40 | +/** Specialized de-serializer to handle collection responses */ |
| 41 | +public class CollectionResponseDeserializer { |
42 | 42 | private static DefaultSerializer serializer; |
43 | 43 | /** |
44 | 44 | * Not available for instantiation |
45 | 45 | */ |
46 | | - private CollectionResponseSerializer() {} |
| 46 | + private CollectionResponseDeserializer() {} |
47 | 47 | /** |
48 | 48 | * Deserializes the JsonElement |
49 | 49 | * |
@@ -86,15 +86,7 @@ public static <T1> BaseCollectionResponse<T1> deserialize(@Nonnull final JsonEle |
86 | 86 | for(JsonElement sourceElement : sourceArray) { |
87 | 87 | if(sourceElement.isJsonObject()) { |
88 | 88 | final JsonObject sourceObject = sourceElement.getAsJsonObject(); |
89 | | - Class<?> entityClass = serializer.getDerivedClass(sourceObject, baseEntityClass); |
90 | | - if(entityClass == null) { |
91 | | - if(baseEntityClass == null) { |
92 | | - logger.logError("Could not find target class for object " + sourceObject.toString(), null); |
93 | | - continue; |
94 | | - } else |
95 | | - entityClass = baseEntityClass; // it is possible the odata type is absent or we can't find the derived type (not in SDK yet) |
96 | | - } |
97 | | - final T1 targetObject = (T1)serializer.deserializeObject(sourceObject, entityClass); |
| 89 | + final T1 targetObject = (T1)serializer.deserializeObject(sourceObject, baseEntityClass); |
98 | 90 | ((IJsonBackedObject)targetObject).setRawObject(serializer, sourceObject); |
99 | 91 | list.add(targetObject); |
100 | 92 | } else if (sourceElement.isJsonPrimitive()) { |
|
0 commit comments