From d05c80c49986ebe7644708244f06bde7a0b9a798 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sun, 13 Jun 2021 02:08:45 +0100 Subject: [PATCH] Add equals(), hashCode() & toString() methods --- .../domain/pagination/PaginationData.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/main/java/me/goudham/domain/pagination/PaginationData.java b/src/main/java/me/goudham/domain/pagination/PaginationData.java index 2437e4e..c5ea94a 100644 --- a/src/main/java/me/goudham/domain/pagination/PaginationData.java +++ b/src/main/java/me/goudham/domain/pagination/PaginationData.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.List; +import java.util.Objects; /** * {@link PaginationData} @@ -81,4 +82,25 @@ public class PaginationData { this.meta = meta; } + @Override + 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(data, that.data) && Objects.equals(links, that.links) && Objects.equals(meta, that.meta); + } + + @Override + public int hashCode() { + return Objects.hash(data, links, meta); + } + + @Override + public String toString() { + return "PaginationData{" + + "data=" + data + + ", links=" + links + + ", meta=" + meta + + '}'; + } } \ No newline at end of file