More diamond interfaces

This commit is contained in:
Stuart Boston
2015-06-01 12:53:48 +01:00
parent 50171a7da5
commit c8310935aa
11 changed files with 25 additions and 32 deletions
@@ -65,7 +65,7 @@ public class TmdbCertifications extends AbstractMethod {
JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new ResultsMap<String, List<Certification>>(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<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
});
return new ResultsMap<String, List<Certification>>(results);
return new ResultsMap<>(results);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex);
}
@@ -97,7 +97,7 @@ public class TmdbCollections extends AbstractMethod {
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP));
ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP));
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -95,7 +95,7 @@ public class TmdbConfiguration extends AbstractMethod {
try {
WrapperJobList wrapper = MAPPER.readValue(webpage, WrapperJobList.class);
ResultList<JobDepartment> results = new ResultList<JobDepartment>(wrapper.getJobs());
ResultList<JobDepartment> 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<String, List<String>> timezones = new ResultsMap<String, List<String>>();
ResultsMap<String, List<String>> timezones = new ResultsMap<>();
for (Map<String, List<String>> tzMap : tzList) {
for (Map.Entry<String, List<String>> x : tzMap.entrySet()) {
@@ -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;
/**
@@ -78,7 +77,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);
}
}
@@ -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<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
ResultList<Artwork> 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<Video> results = new ResultList<Video>(wrapper.getVideos());
ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -91,7 +91,7 @@ public class TmdbGenres extends AbstractMethod {
try {
WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class);
ResultList<Genre> results = new ResultList<Genre>(wrapper.getGenres());
ResultList<Genre> results = new ResultList<>(wrapper.getGenres());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -184,7 +184,7 @@ public class TmdbMovies extends AbstractMethod {
String webpage = httpTools.getRequest(url);
try {
WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class);
ResultList<AlternativeTitle> results = new ResultList<AlternativeTitle>(wrapper.getTitles());
ResultList<AlternativeTitle> results = new ResultList<>(wrapper.getTitles());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -231,7 +231,7 @@ public class TmdbMovies extends AbstractMethod {
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -258,7 +258,7 @@ public class TmdbMovies extends AbstractMethod {
try {
WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class);
ResultList<Keyword> results = new ResultList<Keyword>(wrapper.getKeywords());
ResultList<Keyword> results = new ResultList<>(wrapper.getKeywords());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -285,7 +285,7 @@ public class TmdbMovies extends AbstractMethod {
try {
WrapperReleaseInfo wrapper = MAPPER.readValue(webpage, WrapperReleaseInfo.class);
ResultList<ReleaseInfo> results = new ResultList<ReleaseInfo>(wrapper.getCountries());
ResultList<ReleaseInfo> results = new ResultList<>(wrapper.getCountries());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -314,7 +314,7 @@ public class TmdbMovies extends AbstractMethod {
try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -339,7 +339,7 @@ public class TmdbMovies extends AbstractMethod {
try {
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations());
ResultList<Translation> results = new ResultList<>(wrapper.getTranslations());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -203,13 +203,14 @@ public class TmdbSearch extends AbstractMethod {
try {
WrapperMultiSearch wrapper = MAPPER.readValue(webpage, WrapperMultiSearch.class);
ResultList<MediaBasic> results = new ResultList<MediaBasic>();
ResultList<MediaBasic> results = new ResultList<>();
results.getResults().addAll(wrapper.getResults());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get multi search", url, ex);
} }
}
}
/**
* This is a good starting point to start finding people on TMDb.
@@ -99,8 +99,7 @@ public class TmdbSeasons extends AbstractMethod {
}
/**
* This method lets users get the status of whether or not the TV episodes
* of a season have been rated.
* This method lets users get the status of whether or not the TV episodes of a season have been rated.
*
* A valid session id is required.
*
@@ -147,8 +146,7 @@ public class TmdbSeasons extends AbstractMethod {
}
/**
* Get the external ids that we have stored for a TV season by season
* number.
* Get the external ids that we have stored for a TV season by season number.
*
* @param tvID
* @param seasonNumber
@@ -194,7 +192,7 @@ public class TmdbSeasons extends AbstractMethod {
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -203,8 +201,7 @@ public class TmdbSeasons extends AbstractMethod {
}
/**
* Get the videos that have been added to a TV season (trailers, teasers,
* etc...)
* Get the videos that have been added to a TV season (trailers, teasers, etc...)
*
* @param tvID
* @param seasonNumber
@@ -223,7 +220,7 @@ public class TmdbSeasons extends AbstractMethod {
try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -231,7 +231,7 @@ public class TmdbTV extends AbstractMethod {
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -327,7 +327,7 @@ public class TmdbTV extends AbstractMethod {
try {
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations());
ResultList<Translation> results = new ResultList<>(wrapper.getTranslations());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -354,7 +354,7 @@ public class TmdbTV extends AbstractMethod {
try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
@@ -66,7 +66,6 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
private final Set<PeopleMethod> methods = EnumSet.noneOf(PeopleMethod.class);
// AppendToResponse Properties
private List<ChangeKeyItem> changes = Collections.emptyList();
// TODO: Add COMBINED_CREDITS
private ExternalID externalIDs = new ExternalID();
private List<Artwork> images = Collections.emptyList();
private List<ArtworkMedia> taggedImages = Collections.emptyList();