3434import com .microsoft .graph .logger .ILogger ;
3535import com .microsoft .graph .models .extensions .DateOnly ;
3636
37+ import com .microsoft .graph .models .extensions .TimeOfDay ;
3738import java .lang .reflect .Type ;
3839import java .text .ParseException ;
3940import java .util .Calendar ;
@@ -209,6 +210,20 @@ public Duration deserialize(final JsonElement json,
209210 }
210211 }
211212 };
213+
214+ final JsonDeserializer <TimeOfDay > timeOfDayJsonDeserializer = new JsonDeserializer <TimeOfDay >() {
215+ @ Override
216+ public TimeOfDay deserialize (final JsonElement json ,
217+ final Type typeOfT ,
218+ final JsonDeserializationContext context ) throws JsonParseException {
219+ try {
220+ return TimeOfDay .parse (json .getAsString ());
221+ } catch (Exception e ) {
222+ return null ;
223+ }
224+ }
225+ };
226+
212227 return new GsonBuilder ()
213228 .excludeFieldsWithoutExposeAnnotation ()
214229 .registerTypeAdapter (Calendar .class , calendarJsonSerializer )
@@ -223,6 +238,7 @@ public Duration deserialize(final JsonElement json,
223238 .registerTypeAdapter (EnumSet .class , enumSetJsonDeserializer )
224239 .registerTypeAdapter (Duration .class , durationJsonSerializer )
225240 .registerTypeAdapter (Duration .class , durationJsonDeserializer )
241+ .registerTypeAdapter (TimeOfDay .class , timeOfDayJsonDeserializer )
226242 .registerTypeAdapterFactory (new FallbackTypeAdapterFactory (logger ))
227243 .create ();
228244 }
0 commit comments