Skip to content

Commit 51ab35c

Browse files
author
Caitlin Bales (MSFT)
committed
Serializer parameters
1 parent 689b312 commit 51ab35c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/com/microsoft/graph/serializer/DefaultSerializer.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.HashMap;
3232
import java.util.Iterator;
3333
import java.util.Map;
34+
import java.util.Map.Entry;
3435

3536
/**
3637
* The default serializer implementation for the SDK.
@@ -143,7 +144,8 @@ public <T> String serializeObject(final T serializableObject) {
143144
* @param outJson The serialized output JSON to add to
144145
* @return The serialized output JSON including the additional child data
145146
*/
146-
private JsonObject getChildAdditionalData(IJsonBackedObject serializableObject, JsonObject outJson) {
147+
@SuppressWarnings("unchecked")
148+
private JsonObject getChildAdditionalData(IJsonBackedObject serializableObject, JsonObject outJson) {
147149
// Use reflection to iterate through fields for eligible Graph children
148150
for (java.lang.reflect.Field field : serializableObject.getClass().getFields()) {
149151
try {
@@ -152,7 +154,7 @@ private JsonObject getChildAdditionalData(IJsonBackedObject serializableObject,
152154
// If the object is a HashMap, iterate through its children
153155
if (fieldObject instanceof HashMap) {
154156
HashMap<String, Object> serializableChildren = (HashMap<String, Object>) fieldObject;
155-
Iterator it = serializableChildren.entrySet().iterator();
157+
Iterator<Entry<String, Object>> it = serializableChildren.entrySet().iterator();
156158

157159
while (it.hasNext()) {
158160
HashMap.Entry<String, Object> pair = (HashMap.Entry<String, Object>)it.next();
@@ -222,7 +224,7 @@ private boolean fieldIsOdataTransient(Map.Entry<String, JsonElement> entry) {
222224
* @param parentClass The parent class the derived class should inherit from
223225
* @return The derived class if found, or null if not applicable
224226
*/
225-
private Class getDerivedClass(JsonObject jsonObject, Class parentClass) {
227+
private Class<?> getDerivedClass(JsonObject jsonObject, Class<?> parentClass) {
226228
//Identify the odata.type information if provided
227229
if (jsonObject.get("@odata.type") != null) {
228230
String odataType = jsonObject.get("@odata.type").getAsString();
@@ -231,7 +233,7 @@ private Class getDerivedClass(JsonObject jsonObject, Class parentClass) {
231233
derivedType = "com.microsoft.graph.models.extensions." + derivedType; //Add full package path
232234

233235
try {
234-
Class derivedClass = Class.forName(derivedType);
236+
Class<?> derivedClass = Class.forName(derivedType);
235237
//Check that the derived class inherits from the given parent class
236238
if (parentClass.isAssignableFrom(derivedClass)) {
237239
return derivedClass;

0 commit comments

Comments
 (0)