com.omertron.omdbapi.model.SearchResults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of API-OMDB Show documentation
Show all versions of API-OMDB Show documentation
API for the omdbapi.com website
/*
* Copyright (c) 2013-2016 Stuart Boston
*
* This file is part of the OMDB API.
*
* The OMDB 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.
*
* The OMDB 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 the OMDB API. If not, see .
*
*/
package com.omertron.omdbapi.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class SearchResults extends AbstractJsonMapping {
@JsonProperty("Search")
private List results;
@JsonProperty("totalResults")
private int totalResults;
public List getResults() {
return results;
}
public int getTotalResults() {
return totalResults;
}
public void setResults(List results) {
if (results == null || results.isEmpty()) {
// looks like an error or no results
setResponse(false);
setError("No results returned");
} else {
setResponse(true);
setError(results.size() + " results returned");
this.results = results;
}
}
public void setTotalResults(int totalResults) {
this.totalResults = totalResults;
}
}