Rename existing PaginationData.java to 'Meta'

pull/9/head
Hammy 3 years ago
parent 69d0187f77
commit ed85f99294

@ -1,4 +1,4 @@
package me.goudham.domain; package me.goudham.domain.pagination;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
@ -9,14 +9,17 @@ import java.util.Objects;
/** /**
* {@link PaginationData} * {@link Meta}
* <p>Contains standard Pagination data from the API</p> * <p>Contains standard Pagination data from the API</p>
* *
* <p> Fields included are: </p> * <p> Fields included are: </p>
* <ul> * <ul>
* <li>{@link Integer currentPage}</li> * <li>{@link Integer currentPage}</li>
* <li>{@link Integer from}</li>
* <li>{@link Integer lastPage}</li> * <li>{@link Integer lastPage}</li>
* <li>{@link String path}</li>
* <li>{@link Integer perPage}</li> * <li>{@link Integer perPage}</li>
* <li>{@link Integer to}</li>
* <li>{@link Integer total}</li> * <li>{@link Integer total}</li>
* </ul> * </ul>
* *
@ -24,11 +27,14 @@ import java.util.Objects;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ @JsonPropertyOrder({
"current_page", "current_page",
"from",
"last_page", "last_page",
"path",
"per_page", "per_page",
"to",
"total" "total"
}) })
public class PaginationData { public class Meta {
/** /**
* Current requested page * Current requested page
* *
@ -37,6 +43,14 @@ public class PaginationData {
@JsonPropertyDescription("Current requested page") @JsonPropertyDescription("Current requested page")
private Integer currentPage; private Integer currentPage;
/**
* Starting gallery image number
*
*/
@JsonProperty("from")
@JsonPropertyDescription("Starting gallery image number")
private Integer from;
/** /**
* Last available page * Last available page
* *
@ -45,6 +59,14 @@ public class PaginationData {
@JsonPropertyDescription("Last available page") @JsonPropertyDescription("Last available page")
private Integer lastPage; private Integer lastPage;
/**
* API url for gallery
*
*/
@JsonProperty("path")
@JsonPropertyDescription("API url for gallery")
private String path;
/** /**
* Total number of items per page * Total number of items per page
* *
@ -54,7 +76,15 @@ public class PaginationData {
private Integer perPage; 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") @JsonProperty("total")
@ -71,6 +101,12 @@ public class PaginationData {
this.currentPage = currentPage; this.currentPage = currentPage;
} }
@JsonProperty("from")
public Integer getFrom() { return from; }
@JsonProperty("from")
public void setFrom(Integer from) { this.from = from; }
@JsonProperty("last_page") @JsonProperty("last_page")
public Integer getLastPage() { public Integer getLastPage() {
return lastPage; return lastPage;
@ -81,6 +117,12 @@ public class PaginationData {
this.lastPage = lastPage; this.lastPage = lastPage;
} }
@JsonProperty("path")
public String getPath() { return path; }
@JsonProperty("path")
public void setPath(String path) { this.path = path; }
@JsonProperty("per_page") @JsonProperty("per_page")
public Integer getPerPage() { public Integer getPerPage() {
return perPage; return perPage;
@ -91,6 +133,12 @@ public class PaginationData {
this.perPage = perPage; this.perPage = perPage;
} }
@JsonProperty("to")
public Integer getTo() { return to; }
@JsonProperty("to")
public void setTo(Integer to) { this.to = to; }
@JsonProperty("total") @JsonProperty("total")
public Integer getTotal() { public Integer getTotal() {
return total; return total;
@ -105,21 +153,24 @@ public class PaginationData {
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; if (o == null || getClass() != o.getClass()) return false;
PaginationData that = (PaginationData) o; Meta meta = (Meta) o;
return Objects.equals(currentPage, that.currentPage) && Objects.equals(lastPage, that.lastPage) && Objects.equals(perPage, that.perPage) && Objects.equals(total, that.total); 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 @Override
public int hashCode() { public int hashCode() {
return Objects.hash(currentPage, lastPage, perPage, total); return Objects.hash(currentPage, from, lastPage, path, perPage, to, total);
} }
@Override @Override
public String toString() { public String toString() {
return "PaginationData{" + return "Meta{" +
"currentPage=" + currentPage + "currentPage=" + currentPage +
", from=" + from +
", lastPage=" + lastPage + ", lastPage=" + lastPage +
", path=" + path +
", perPage=" + perPage + ", perPage=" + perPage +
", to=" + to +
", total=" + total + ", total=" + total +
'}'; '}';
} }
Loading…
Cancel
Save