From ed85f99294e6880401b8f4559ccfa8edc209a91f Mon Sep 17 00:00:00 2001 From: Hammy Date: Sat, 12 Jun 2021 06:14:35 +0100 Subject: [PATCH] Rename existing PaginationData.java to 'Meta' --- .../Meta.java} | 67 ++++++++++++++++--- 1 file changed, 59 insertions(+), 8 deletions(-) rename src/main/java/me/goudham/domain/{PaginationData.java => pagination/Meta.java} (60%) diff --git a/src/main/java/me/goudham/domain/PaginationData.java b/src/main/java/me/goudham/domain/pagination/Meta.java similarity index 60% rename from src/main/java/me/goudham/domain/PaginationData.java rename to src/main/java/me/goudham/domain/pagination/Meta.java index 8ba619e..41479b2 100644 --- a/src/main/java/me/goudham/domain/PaginationData.java +++ b/src/main/java/me/goudham/domain/pagination/Meta.java @@ -1,4 +1,4 @@ -package me.goudham.domain; +package me.goudham.domain.pagination; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -9,14 +9,17 @@ import java.util.Objects; /** - * {@link PaginationData} + * {@link Meta} *

Contains standard Pagination data from the API

* *

Fields included are:

* * @@ -24,11 +27,14 @@ import java.util.Objects; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "current_page", + "from", "last_page", + "path", "per_page", + "to", "total" }) -public class PaginationData { +public class Meta { /** * Current requested page * @@ -37,6 +43,14 @@ public class PaginationData { @JsonPropertyDescription("Current requested page") private Integer currentPage; + /** + * Starting gallery image number + * + */ + @JsonProperty("from") + @JsonPropertyDescription("Starting gallery image number") + private Integer from; + /** * Last available page * @@ -45,6 +59,14 @@ public class PaginationData { @JsonPropertyDescription("Last available page") private Integer lastPage; + /** + * API url for gallery + * + */ + @JsonProperty("path") + @JsonPropertyDescription("API url for gallery") + private String path; + /** * Total number of items per page * @@ -54,7 +76,15 @@ public class PaginationData { private Integer perPage; /** - * Total number of items + * Last gallery image number + * + */ + @JsonProperty("to") + @JsonPropertyDescription("Last gallery image number") + private Integer to; + + /** + * Total number of items within the gallery * */ @JsonProperty("total") @@ -71,6 +101,12 @@ public class PaginationData { this.currentPage = currentPage; } + @JsonProperty("from") + public Integer getFrom() { return from; } + + @JsonProperty("from") + public void setFrom(Integer from) { this.from = from; } + @JsonProperty("last_page") public Integer getLastPage() { return lastPage; @@ -81,6 +117,12 @@ public class PaginationData { this.lastPage = lastPage; } + @JsonProperty("path") + public String getPath() { return path; } + + @JsonProperty("path") + public void setPath(String path) { this.path = path; } + @JsonProperty("per_page") public Integer getPerPage() { return perPage; @@ -91,6 +133,12 @@ public class PaginationData { this.perPage = perPage; } + @JsonProperty("to") + public Integer getTo() { return to; } + + @JsonProperty("to") + public void setTo(Integer to) { this.to = to; } + @JsonProperty("total") public Integer getTotal() { return total; @@ -105,21 +153,24 @@ public class PaginationData { public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - PaginationData that = (PaginationData) o; - return Objects.equals(currentPage, that.currentPage) && Objects.equals(lastPage, that.lastPage) && Objects.equals(perPage, that.perPage) && Objects.equals(total, that.total); + Meta meta = (Meta) o; + return Objects.equals(currentPage, meta.currentPage) && Objects.equals(from, meta.from) && Objects.equals(lastPage, meta.lastPage) && Objects.equals(path, meta.path) && Objects.equals(perPage, meta.perPage) && Objects.equals(to, meta.to) && Objects.equals(total, meta.total); } @Override public int hashCode() { - return Objects.hash(currentPage, lastPage, perPage, total); + return Objects.hash(currentPage, from, lastPage, path, perPage, to, total); } @Override public String toString() { - return "PaginationData{" + + return "Meta{" + "currentPage=" + currentPage + + ", from=" + from + ", lastPage=" + lastPage + + ", path=" + path + ", perPage=" + perPage + + ", to=" + to + ", total=" + total + '}'; }