diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/AbstractWrapperAll.java b/src/main/java/com/omertron/themoviedbapi/wrapper/AbstractWrapperAll.java index e05281a6d..e0f98b26a 100644 --- a/src/main/java/com/omertron/themoviedbapi/wrapper/AbstractWrapperAll.java +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/AbstractWrapperAll.java @@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; * * @author Stuart */ -public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages { +public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, IWrapperPages, IWrapperDates { /* * Properties */ @@ -37,6 +37,8 @@ public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, private int totalPages; @JsonProperty("total_results") private int totalResults; + @JsonProperty("dates") + private ResultDates dates = new ResultDates(); public AbstractWrapperAll(Class classToLog) { super(classToLog); @@ -57,6 +59,11 @@ public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, return totalResults; } + @Override + public ResultDates getDates() { + return dates; + } + @Override public void setPage(int page) { this.page = page; @@ -71,4 +78,9 @@ public class AbstractWrapperAll extends AbstractWrapperId implements IWrapperId, public void setTotalResults(int totalResults) { this.totalResults = totalResults; } + + @Override + public void setDates(ResultDates dates) { + this.dates = dates; + } } diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/IWrapperDates.java b/src/main/java/com/omertron/themoviedbapi/wrapper/IWrapperDates.java new file mode 100644 index 000000000..09c5feca0 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/IWrapperDates.java @@ -0,0 +1,27 @@ +/* + * 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.wrapper; + +public interface IWrapperDates { + + ResultDates getDates(); + + void setDates(ResultDates dates); +} diff --git a/src/main/java/com/omertron/themoviedbapi/wrapper/ResultDates.java b/src/main/java/com/omertron/themoviedbapi/wrapper/ResultDates.java new file mode 100644 index 000000000..581ec1682 --- /dev/null +++ b/src/main/java/com/omertron/themoviedbapi/wrapper/ResultDates.java @@ -0,0 +1,89 @@ +/* + * 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.wrapper; + +import com.omertron.themoviedbapi.model.*; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Stuart + */ +public class ResultDates implements Serializable { + + private static final long serialVersionUID = 1L; + + /* + * Logger + */ + private static final Logger LOG = LoggerFactory.getLogger(ResultDates.class); + /* + * Properties + */ + @JsonProperty("minimum") + private String minimum = ""; + @JsonProperty("maximum") + private String maximum = ""; + + // + public String getMinimum() { + return minimum; + } + + public String getMaximum() { + return maximum; + } + // + + // + public void setMinimum(String minimum) { + this.minimum = minimum; + } + + public void setMaximum(String maximum) { + this.maximum = maximum; + } + // + + /** + * Handle unknown properties and print a message + * + * @param key + * @param value + */ + @JsonAnySetter + public void handleUnknown(String key, Object value) { + StringBuilder sb = new StringBuilder(); + sb.append("Unknown property: '").append(key); + sb.append("' value: '").append(value).append("'"); + LOG.trace(sb.toString()); + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE); + } +}