From 009e725cb6052bbecd5953358364bbd240088baa Mon Sep 17 00:00:00 2001 From: Stuart Boston Date: Sat, 18 May 2013 11:23:44 +0100 Subject: [PATCH] Added new classes to return the results --- .../themoviedbapi/results/TmdbResults.java | 92 +++++++++++++++++++ .../results/TmdbResultsList.java | 41 +++++++++ .../themoviedbapi/results/TmdbResultsMap.java | 42 +++++++++ .../themoviedbapi/wrapper/WrapperMovie.java | 1 - 4 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/omertron/themoviedbapi/results/TmdbResults.java create mode 100644 src/main/java/com/omertron/themoviedbapi/results/TmdbResultsList.java create mode 100644 src/main/java/com/omertron/themoviedbapi/results/TmdbResultsMap.java diff --git a/src/main/java/com/omertron/themoviedbapi/results/TmdbResults.java b/src/main/java/com/omertron/themoviedbapi/results/TmdbResults.java new file mode 100644 index 000000000..f18ecc88e --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/results/TmdbResults.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2004-2013 Stuart Boston + * + * This file is part of TheMovieDB API. + * + * TheMovieDB API is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * TheMovieDB API is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TheMovieDB API. If not, see . + * + */ +package com.omertron.themoviedbapi.results; + +import com.omertron.themoviedbapi.wrapper.AbstractWrapperAll; +import com.omertron.themoviedbapi.wrapper.AbstractWrapperId; + +/** + * Abstract class to return the results and the id/page info + * @author Stuart + */ +public abstract class TmdbResults { + + private int id = 0; + private int page = 0; + private int totalPages = 0; + private int totalResults = 0; + + // + public int getId() { + return id; + } + + public int getPage() { + return page; + } + + public int getTotalPages() { + return totalPages; + } + + public int getTotalResults() { + return totalResults; + } + // + + // + public void setId(int id) { + this.id = id; + } + + public void setPage(int page) { + this.page = page; + } + + public void setTotalPages(int totalPages) { + this.totalPages = totalPages; + } + + public void setTotalResults(int totalResults) { + this.totalResults = totalResults; + } + // + + /** + * Copy the Id from the wrapper + * + * @param wrapper + */ + public void copyWrapper(AbstractWrapperId wrapper) { + this.id = wrapper.getId(); + } + + /** + * Copy the Id and pages from the wrapper + * + * @param wrapper + */ + public void copyWrapper(AbstractWrapperAll wrapper) { + this.id = wrapper.getId(); + this.page = wrapper.getPage(); + this.totalPages = wrapper.getTotalPages(); + this.totalResults = wrapper.getTotalResults(); + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsList.java b/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsList.java new file mode 100644 index 000000000..70ce3b972 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsList.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2004-2013 Stuart Boston + * + * This file is part of TheMovieDB API. + * + * TheMovieDB API is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * TheMovieDB API is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TheMovieDB API. If not, see . + * + */ +package com.omertron.themoviedbapi.results; + +import java.util.Collections; +import java.util.List; + +/** + * List of the results from TheMovieDb + * @author Stuart + * @param + */ +public final class TmdbResultsList extends TmdbResults { + + private List results = Collections.EMPTY_LIST; + + public List getResults() { + return results; + } + + public void setResults(List results) { + this.results = results; + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsMap.java b/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsMap.java new file mode 100644 index 000000000..f14e30fea --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/results/TmdbResultsMap.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2004-2013 Stuart Boston + * + * This file is part of TheMovieDB API. + * + * TheMovieDB API is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * TheMovieDB API is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with TheMovieDB API. If not, see . + * + */ +package com.omertron.themoviedbapi.results; + +import java.util.Collections; +import java.util.Map; + +/** + * Map of the results from TheMovieDb + * @author Stuart + * @param + * @param + */ +public final class TmdbResultsMap extends TmdbResults { + + private Map results = Collections.EMPTY_MAP; + + public Map getResults() { + return results; + } + + public void setResults(Map results) { + this.results = results; + } +} diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperMovie.java b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperMovie.java index 4e44e8224..8d902f69f 100644 --- a/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperMovie.java +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/WrapperMovie.java @@ -22,7 +22,6 @@ package com.omertron.themoviedbapi.wrapper; import com.fasterxml.jackson.annotation.JsonProperty; import com.omertron.themoviedbapi.model.MovieDb; import java.util.List; -import org.slf4j.LoggerFactory; /** *