From 4f9d74c9f7305291420071c8351d7d252cbac44b Mon Sep 17 00:00:00 2001 From: Stuart Boston Date: Mon, 1 Jun 2015 11:37:54 +0100 Subject: [PATCH] Use diamond interface --- .../methods/TmdbAuthentication.java | 3 +- .../methods/TmdbCertifications.java | 4 +- .../methods/TmdbCollections.java | 8 +-- .../methods/TmdbConfiguration.java | 4 +- .../themoviedbapi/methods/TmdbCredits.java | 13 ++--- .../themoviedbapi/methods/TmdbEpisodes.java | 6 +- .../themoviedbapi/methods/TmdbGenres.java | 2 +- .../themoviedbapi/methods/TmdbMovies.java | 55 +++++++------------ .../themoviedbapi/methods/TmdbSearch.java | 5 +- .../themoviedbapi/methods/TmdbSeasons.java | 13 ++--- .../themoviedbapi/methods/TmdbTV.java | 22 +++----- .../model/person/PersonInfo.java | 1 - 12 files changed, 54 insertions(+), 82 deletions(-) diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java index 247cc7dec..6d02fe849 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbAuthentication.java @@ -157,4 +157,5 @@ public class TmdbAuthentication extends AbstractMethod { } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex); } - }} + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java index 8d324dc70..7a8d62597 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCertifications.java @@ -65,7 +65,7 @@ public class TmdbCertifications extends AbstractMethod { JsonNode node = MAPPER.readTree(webpage); Map> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference>>() { }); - return new ResultsMap>(results); + return new ResultsMap<>(results); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex); } @@ -85,7 +85,7 @@ public class TmdbCertifications extends AbstractMethod { JsonNode node = MAPPER.readTree(webpage); Map> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference>>() { }); - return new ResultsMap>(results); + return new ResultsMap<>(results); } catch (IOException ex) { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex); } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java index 24c781c59..ef778c0de 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCollections.java @@ -53,11 +53,9 @@ public class TmdbCollections extends AbstractMethod { } /** - * This method is used to retrieve all of the basic information about a - * movie collection. + * This method is used to retrieve all of the basic information about a movie collection. * - * You can get the ID needed for this method by making a getMovieInfo - * request for the belongs_to_collection. + * You can get the ID needed for this method by making a getMovieInfo request for the belongs_to_collection. * * @param collectionId * @param language @@ -97,7 +95,7 @@ public class TmdbCollections extends AbstractMethod { try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); - ResultList results = new ResultList(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP)); + ResultList results = new ResultList<>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP)); wrapper.setResultProperties(results); return results; } catch (IOException ex) { diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java index b23a8a870..04f65029d 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbConfiguration.java @@ -95,7 +95,7 @@ public class TmdbConfiguration extends AbstractMethod { try { WrapperJobList wrapper = MAPPER.readValue(webpage, WrapperJobList.class); - ResultList results = new ResultList(wrapper.getJobs()); + ResultList results = new ResultList<>(wrapper.getJobs()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { @@ -121,7 +121,7 @@ public class TmdbConfiguration extends AbstractMethod { throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex); } - ResultsMap> timezones = new ResultsMap>(); + ResultsMap> timezones = new ResultsMap<>(); for (Map> tzMap : tzList) { for (Map.Entry> x : tzMap.entrySet()) { diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java index 55e5f8129..fe859e110 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbCredits.java @@ -28,7 +28,6 @@ import com.omertron.themoviedbapi.tools.Param; import com.omertron.themoviedbapi.tools.TmdbParameters; import java.io.IOException; import java.net.URL; -import org.slf4j.LoggerFactory; import org.yamj.api.common.exception.ApiExceptionType; /** @@ -53,14 +52,11 @@ public class TmdbCredits extends AbstractMethod { *

* This is currently only supported with the new credit model found in TV. *
- * These IDs can be found from any TV credit response as well as the - * TV_credits and combined_credits methods for people.
- * The episodes object returns a list of episodes and are generally going to - * be guest stars.
+ * These IDs can be found from any TV credit response as well as the TV_credits and combined_credits methods for people.
+ * The episodes object returns a list of episodes and are generally going to be guest stars.
* The season array will return a list of season numbers.
- * Season credits are credits that were marked with the "add to every - * season" option in the editing interface and are assumed to be "season - * regulars". + * Season credits are credits that were marked with the "add to every season" option in the editing interface and are assumed to + * be "season regulars". * * @param creditId * @param language @@ -78,7 +74,6 @@ public class TmdbCredits extends AbstractMethod { try { return MAPPER.readValue(webpage, CreditInfo.class); } catch (IOException ex) { - LoggerFactory.getLogger("test").info("{}",ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex); } } diff --git a/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java b/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java index 32cac1636..46e1b2a59 100644 --- a/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java +++ b/src/main/java/com/omertron/themoviedbapi/methods/TmdbEpisodes.java @@ -42,7 +42,6 @@ import com.omertron.themoviedbapi.results.WrapperImages; import com.omertron.themoviedbapi.results.WrapperVideos; import java.io.IOException; import java.net.URL; -import org.slf4j.LoggerFactory; import org.yamj.api.common.exception.ApiExceptionType; /** @@ -89,7 +88,6 @@ public class TmdbEpisodes extends AbstractMethod { try { return MAPPER.readValue(webpage, TVEpisodeInfo.class); } catch (IOException ex) { - LoggerFactory.getLogger("test").warn("{}", ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex); } } @@ -207,7 +205,7 @@ public class TmdbEpisodes extends AbstractMethod { try { WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); - ResultList results = new ResultList(wrapper.getAll()); + ResultList results = new ResultList<>(wrapper.getAll()); wrapper.setResultProperties(results); return results; } catch (IOException ex) { @@ -274,7 +272,7 @@ public class TmdbEpisodes extends AbstractMethod { try { WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); - ResultList