2525import com .google .gson .JsonElement ;
2626
2727import java .io .InputStream ;
28+ import java .util .Collections ;
2829import java .util .List ;
2930import java .util .Map ;
3031
3132import javax .annotation .Nullable ;
3233import javax .annotation .Nonnull ;
3334
35+ import static java .util .Collections .emptyMap ;
36+
3437/**
3538 * Serializes and deserializes items from strings into their types
3639 */
@@ -45,21 +48,37 @@ public interface ISerializer {
4548 * @return the deserialized item from the input string
4649 */
4750 @ Nullable
48- <T > T deserializeObject (@ Nonnull final String inputString , @ Nonnull final Class <T > clazz );
51+ default <T > T deserializeObject (@ Nonnull final String inputString , @ Nonnull final Class <T > clazz ) {
52+ return deserializeObject (inputString , clazz , emptyMap ());
53+ }
4954
5055 /**
5156 * Deserialize an object from the input string
5257 *
58+ * @param inputString the string that stores the representation of the item
59+ * @param clazz the {@code Class} of the item to be deserialized
60+ * @param responseHeaders the HTTP response headers
61+ * @param <T> the type of the item to be deserialized
62+ * @return the deserialized item from the input string
63+ */
64+ @ Nullable
65+ <T > T deserializeObject (@ Nonnull final String inputString , @ Nonnull final Class <T > clazz , @ Nonnull final Map <String , List <String >> responseHeaders );
66+
67+ /**
68+ * Deserialize an object from the input stream
69+ *
5370 * @param inputStream the stream that stores the representation of the item
5471 * @param clazz the {@code Class} of the item to be deserialized
5572 * @param <T> the type of the item to be deserialized
56- * @return the deserialized item from the input string
73+ * @return the deserialized item from the input string
5774 */
5875 @ Nullable
59- <T > T deserializeObject (@ Nonnull final InputStream inputStream , @ Nonnull final Class <T > clazz );
60-
76+ default <T > T deserializeObject (@ Nonnull final InputStream inputStream , @ Nonnull final Class <T > clazz ) {
77+ return deserializeObject (inputStream , clazz , emptyMap ());
78+ }
79+
6180 /**
62- * Deserialize an object from the input string
81+ * Deserialize an object from the input stream
6382 *
6483 * @param inputStream the stream that stores the representation of the item
6584 * @param clazz the {@code Class} of the item to be deserialized
@@ -71,7 +90,7 @@ public interface ISerializer {
7190 <T > T deserializeObject (@ Nonnull final InputStream inputStream , @ Nonnull final Class <T > clazz , @ Nonnull final Map <String , List <String >> responseHeaders );
7291
7392 /**
74- * Deserialize an object from the input string
93+ * Deserialize an object from the input JsonElement
7594 *
7695 * @param jsonElement the {@code JsonElement} that stores the representation of the item
7796 * @param clazz the {@code Class} of the item to be deserialized
0 commit comments