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.JsonProperty;
@ -9,14 +9,17 @@ import java.util.Objects;
/**
* {@link PaginationData}
* {@link Meta}
* <p>Contains standard Pagination data from the API</p>
*
* <p> Fields included are: </p>
* <ul>
* <li>{@link Integer currentPage}</li>
* <li>{@link Integer from}</li>
* <li>{@link Integer lastPage}</li>
* <li>{@link String path}</li>
* <li>{@link Integer perPage}</li>
* <li>{@link Integer to}</li>
* <li>{@link Integer total}</li>
* </ul>
*
@ -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 +
'}';
}
Loading…
Cancel
Save