diff --git a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java index 3d3d27b90..04094b470 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java @@ -49,6 +49,7 @@ import com.omertron.themoviedbapi.tools.TmdbParameters; import com.omertron.themoviedbapi.results.WrapperChanges; import com.omertron.themoviedbapi.results.WrapperGenericList; import java.io.IOException; +import java.io.Serializable; import java.net.URL; import java.util.HashMap; import java.util.List; @@ -68,7 +69,7 @@ public class AbstractMethod { protected final HttpTools httpTools; // Jackson JSON configuration protected static final ObjectMapper MAPPER = new ObjectMapper(); - private static final Map TYPE_REFS = new HashMap<>(); + private static final Map, TypeReference>> TYPE_REFS = new HashMap<>(); static { TYPE_REFS.put(MovieBasic.class, new TypeReference>() { @@ -124,9 +125,9 @@ public class AbstractMethod { * @return * @throws MovieDbException */ - protected static TypeReference getTypeReference(Class aClass) throws MovieDbException { + protected static TypeReference> getTypeReference(Class aClass) throws MovieDbException { if (TYPE_REFS.containsKey(aClass)) { - return TYPE_REFS.get(aClass); + return (TypeReference>) TYPE_REFS.get(aClass); } else { throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!"); } @@ -142,7 +143,7 @@ public class AbstractMethod { * @return * @throws MovieDbException */ - protected List processWrapperList(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException { + protected List processWrapperList(TypeReference> typeRef, URL url, String errorMessageSuffix) throws MovieDbException { WrapperGenericList val = processWrapper(typeRef, url, errorMessageSuffix); return val.getResults(); } @@ -157,7 +158,7 @@ public class AbstractMethod { * @return * @throws MovieDbException */ - protected WrapperGenericList processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException { + protected WrapperGenericList processWrapper(TypeReference> typeRef, URL url, String errorMessageSuffix) throws MovieDbException { String webpage = httpTools.getRequest(url); try { // Due to type erasure, this doesn't work diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java index bf58176b0..71c5962ba 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java @@ -113,7 +113,7 @@ public class TmdbPeople extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - TypeReference tr = new TypeReference>() { + TypeReference> tr = new TypeReference>() { }; return MAPPER.readValue(webpage, tr); } catch (IOException ex) { @@ -144,7 +144,7 @@ public class TmdbPeople extends AbstractMethod { String webpage = httpTools.getRequest(url); try { - TypeReference tr = new TypeReference>() { + TypeReference> tr = new TypeReference>() { }; return MAPPER.readValue(webpage, tr); } catch (IOException ex) { @@ -177,7 +177,7 @@ public class TmdbPeople extends AbstractMethod { try { ObjectMapper mapper = new ObjectMapper(); mapper.addMixIn(PersonCreditList.class, PersonCreditsMixIn.class); - TypeReference tr = new TypeReference>() { + TypeReference> tr = new TypeReference>() { }; return mapper.readValue(webpage, tr); } catch (IOException ex) {