From 2315657ec4073b9e927c841b1c8630a01e9fa635 Mon Sep 17 00:00:00 2001 From: Hammy Date: Wed, 9 Jun 2021 00:15:27 +0100 Subject: [PATCH] Remove annotations and regenerate equals(), hashcode() and toString() methods --- .../me/goudham/api/entity/PaginationData.java | 27 ++++++++++++++++--- .../java/me/goudham/api/entity/Studio.java | 8 +++--- .../api/entity/series/FilteredSeries.java | 11 ++++---- .../me/goudham/api/entity/series/Series.java | 10 +++---- .../me/goudham/api/entity/user/Creator.java | 12 +++------ .../me/goudham/api/entity/user/TrueLove.java | 2 -- .../java/me/goudham/api/entity/user/User.java | 7 ++--- .../me/goudham/api/entity/user/UserList.java | 8 +++--- .../api/entity/waifu/FilteredWaifu.java | 7 +++-- .../me/goudham/api/entity/waifu/Waifu.java | 18 ++++++------- 10 files changed, 63 insertions(+), 47 deletions(-) diff --git a/src/main/java/me/goudham/api/entity/PaginationData.java b/src/main/java/me/goudham/api/entity/PaginationData.java index 2036561..42acd8e 100644 --- a/src/main/java/me/goudham/api/entity/PaginationData.java +++ b/src/main/java/me/goudham/api/entity/PaginationData.java @@ -1,12 +1,12 @@ package me.goudham.api.entity; -import javax.annotation.processing.Generated; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.Objects; + /** * {@link PaginationData} @@ -28,7 +28,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; "per_page", "total" }) -@Generated("jsonschema2pojo") public class PaginationData { /** * Current requested page @@ -102,4 +101,26 @@ public class PaginationData { this.total = total; } + @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(currentPage, that.currentPage) && Objects.equals(lastPage, that.lastPage) && Objects.equals(perPage, that.perPage) && Objects.equals(total, that.total); + } + + @Override + public int hashCode() { + return Objects.hash(currentPage, lastPage, perPage, total); + } + + @Override + public String toString() { + return "PaginationData{" + + "currentPage=" + currentPage + + ", lastPage=" + lastPage + + ", perPage=" + perPage + + ", total=" + total + + '}'; + } } diff --git a/src/main/java/me/goudham/api/entity/Studio.java b/src/main/java/me/goudham/api/entity/Studio.java index 8ce0145..fc797f8 100644 --- a/src/main/java/me/goudham/api/entity/Studio.java +++ b/src/main/java/me/goudham/api/entity/Studio.java @@ -1,8 +1,9 @@ package me.goudham.api.entity; -import javax.annotation.processing.Generated; - -import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; import java.util.Objects; @@ -24,7 +25,6 @@ import java.util.Objects; "name", "original_name" }) -@Generated("jsonschema2pojo") public class Studio { Studio() { } diff --git a/src/main/java/me/goudham/api/entity/series/FilteredSeries.java b/src/main/java/me/goudham/api/entity/series/FilteredSeries.java index 07b9c7b..df25e0a 100644 --- a/src/main/java/me/goudham/api/entity/series/FilteredSeries.java +++ b/src/main/java/me/goudham/api/entity/series/FilteredSeries.java @@ -1,12 +1,11 @@ package me.goudham.api.entity.series; -import javax.annotation.processing.Generated; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import javax.annotation.processing.Generated; import java.util.Objects; /** @@ -41,7 +40,6 @@ import java.util.Objects; "url", "id" }) -@Generated("jsonschema2pojo") public class FilteredSeries { /** * Full name, in English. @@ -218,12 +216,12 @@ public class FilteredSeries { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FilteredSeries that = (FilteredSeries) o; - return Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(romajiName, that.romajiName) && Objects.equals(slug, that.slug) && Objects.equals(description, that.description) && Objects.equals(url, that.url) && Objects.equals(id, that.id); + return Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(relevance, that.relevance) && Objects.equals(romajiName, that.romajiName) && Objects.equals(slug, that.slug) && Objects.equals(type, that.type) && Objects.equals(description, that.description) && Objects.equals(displayPicture, that.displayPicture) && Objects.equals(url, that.url) && Objects.equals(id, that.id); } @Override public int hashCode() { - return Objects.hash(name, originalName, romajiName, slug, description, url, id); + return Objects.hash(name, originalName, relevance, romajiName, slug, type, description, displayPicture, url, id); } @Override @@ -231,9 +229,12 @@ public class FilteredSeries { return "FilteredSeries{" + "name='" + name + '\'' + ", originalName='" + originalName + '\'' + + ", relevance=" + relevance + ", romajiName='" + romajiName + '\'' + ", slug='" + slug + '\'' + + ", type='" + type + '\'' + ", description='" + description + '\'' + + ", displayPicture='" + displayPicture + '\'' + ", url='" + url + '\'' + ", id=" + id + '}'; diff --git a/src/main/java/me/goudham/api/entity/series/Series.java b/src/main/java/me/goudham/api/entity/series/Series.java index d3eda50..bf33f96 100644 --- a/src/main/java/me/goudham/api/entity/series/Series.java +++ b/src/main/java/me/goudham/api/entity/series/Series.java @@ -1,7 +1,5 @@ package me.goudham.api.entity.series; -import javax.annotation.processing.Generated; - import com.fasterxml.jackson.annotation.*; import me.goudham.api.entity.Studio; import me.goudham.api.entity.waifu.Waifu; @@ -48,7 +46,6 @@ import java.util.Objects; "type", "id" }) -@Generated("jsonschema2pojo") public class Series { /** * Full Name (in English) @@ -302,12 +299,12 @@ public class Series { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Series series = (Series) o; - return Objects.equals(name, series.name) && Objects.equals(originalName, series.originalName) && Objects.equals(romajiName, series.romajiName) && Objects.equals(description, series.description) && Objects.equals(slug, series.slug) && Objects.equals(releaseDate, series.releaseDate) && Objects.equals(airingStart, series.airingStart) && Objects.equals(airingEnd, series.airingEnd) && Objects.equals(episodeCount, series.episodeCount) && Objects.equals(displayPicture, series.displayPicture) && Objects.equals(url, series.url) && Objects.equals(studio, series.studio) && Objects.equals(id, series.id); + return Objects.equals(name, series.name) && Objects.equals(originalName, series.originalName) && Objects.equals(romajiName, series.romajiName) && Objects.equals(description, series.description) && Objects.equals(slug, series.slug) && Objects.equals(releaseDate, series.releaseDate) && Objects.equals(airingStart, series.airingStart) && Objects.equals(airingEnd, series.airingEnd) && Objects.equals(episodeCount, series.episodeCount) && Objects.equals(displayPicture, series.displayPicture) && Objects.equals(url, series.url) && Objects.equals(studio, series.studio) && Objects.equals(type, series.type) && Objects.equals(id, series.id); } @Override public int hashCode() { - return Objects.hash(name, originalName, romajiName, description, slug, releaseDate, airingStart, airingEnd, episodeCount, displayPicture, url, studio, id); + return Objects.hash(name, originalName, romajiName, description, slug, releaseDate, airingStart, airingEnd, episodeCount, displayPicture, url, studio, type, id); } @Override @@ -322,9 +319,10 @@ public class Series { ", airingStart='" + airingStart + '\'' + ", airingEnd='" + airingEnd + '\'' + ", episodeCount=" + episodeCount + - ", image='" + displayPicture + '\'' + + ", displayPicture='" + displayPicture + '\'' + ", url='" + url + '\'' + ", studio=" + studio + + ", type='" + type + '\'' + ", id=" + id + '}'; } diff --git a/src/main/java/me/goudham/api/entity/user/Creator.java b/src/main/java/me/goudham/api/entity/user/Creator.java index a731470..547388a 100644 --- a/src/main/java/me/goudham/api/entity/user/Creator.java +++ b/src/main/java/me/goudham/api/entity/user/Creator.java @@ -1,13 +1,10 @@ package me.goudham.api.entity.user; -import javax.annotation.processing.Generated; - -import com.fasterxml.jackson.annotation.JsonPropertyDescription; -import me.goudham.api.entity.waifu.Waifu; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import me.goudham.api.entity.waifu.Waifu; import java.util.Objects; @@ -27,7 +24,6 @@ import java.util.Objects; "id", "name" }) -@Generated("jsonschema2pojo") public class Creator { /** @@ -35,14 +31,14 @@ public class Creator { * */ @JsonProperty("id") - @JsonPropertyDescription("") + @JsonPropertyDescription("Creator ID") private Integer id; /** * {@link Creator} Name */ @JsonProperty("name") - @JsonPropertyDescription("") + @JsonPropertyDescription("Creator Name") private String name; @JsonProperty("id") diff --git a/src/main/java/me/goudham/api/entity/user/TrueLove.java b/src/main/java/me/goudham/api/entity/user/TrueLove.java index b8b36eb..a80f5c3 100644 --- a/src/main/java/me/goudham/api/entity/user/TrueLove.java +++ b/src/main/java/me/goudham/api/entity/user/TrueLove.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import me.goudham.api.entity.series.Series; -import javax.annotation.processing.Generated; import java.util.Objects; /** @@ -28,7 +27,6 @@ import java.util.Objects; "slug", "series" }) -@Generated("jsonschema2pojo") public class TrueLove { /** * Name of {@link TrueLove} diff --git a/src/main/java/me/goudham/api/entity/user/User.java b/src/main/java/me/goudham/api/entity/user/User.java index eb2eedb..3519e11 100644 --- a/src/main/java/me/goudham/api/entity/user/User.java +++ b/src/main/java/me/goudham/api/entity/user/User.java @@ -199,18 +199,19 @@ public class User { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; - return Objects.equals(id, user.id) && Objects.equals(name, user.name) && Objects.equals(twitter, user.twitter) && Objects.equals(joined, user.joined) && Objects.equals(waifusCreated, user.waifusCreated) && Objects.equals(waifusLiked, user.waifusLiked) && Objects.equals(waifusTrashed, user.waifusTrashed) && Objects.equals(trueLove, user.trueLove); + return Objects.equals(avatar, user.avatar) && Objects.equals(id, user.id) && Objects.equals(name, user.name) && Objects.equals(twitter, user.twitter) && Objects.equals(joined, user.joined) && Objects.equals(waifusCreated, user.waifusCreated) && Objects.equals(waifusLiked, user.waifusLiked) && Objects.equals(waifusTrashed, user.waifusTrashed) && Objects.equals(trueLove, user.trueLove); } @Override public int hashCode() { - return Objects.hash(id, name, twitter, joined, waifusCreated, waifusLiked, waifusTrashed, trueLove); + return Objects.hash(avatar, id, name, twitter, joined, waifusCreated, waifusLiked, waifusTrashed, trueLove); } @Override public String toString() { return "User{" + - "id=" + id + + "avatar='" + avatar + '\'' + + ", id=" + id + ", name='" + name + '\'' + ", twitter='" + twitter + '\'' + ", joined='" + joined + '\'' + diff --git a/src/main/java/me/goudham/api/entity/user/UserList.java b/src/main/java/me/goudham/api/entity/user/UserList.java index 4ee0a43..656ef94 100644 --- a/src/main/java/me/goudham/api/entity/user/UserList.java +++ b/src/main/java/me/goudham/api/entity/user/UserList.java @@ -1,15 +1,14 @@ package me.goudham.api.entity.user; -import java.util.List; -import java.util.Objects; -import javax.annotation.processing.Generated; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyDescription; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import me.goudham.api.entity.waifu.Waifu; +import java.util.List; +import java.util.Objects; + /** * {@link UserList} *

Get an array of all user lists on their profile

@@ -30,7 +29,6 @@ import me.goudham.api.entity.waifu.Waifu; "order", "waifus" }) -@Generated("jsonschema2pojo") public class UserList { /** * {@link UserList} ID diff --git a/src/main/java/me/goudham/api/entity/waifu/FilteredWaifu.java b/src/main/java/me/goudham/api/entity/waifu/FilteredWaifu.java index a41af72..736290b 100644 --- a/src/main/java/me/goudham/api/entity/waifu/FilteredWaifu.java +++ b/src/main/java/me/goudham/api/entity/waifu/FilteredWaifu.java @@ -286,12 +286,12 @@ public class FilteredWaifu { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FilteredWaifu that = (FilteredWaifu) o; - return Objects.equals(slug, that.slug) && Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(romajiName, that.romajiName) && Objects.equals(displayPicture, that.displayPicture) && Objects.equals(description, that.description) && Objects.equals(likes, that.likes) && Objects.equals(trash, that.trash) && Objects.equals(url, that.url) && Objects.equals(appearances, that.appearances) && Objects.equals(id, that.id); + return Objects.equals(slug, that.slug) && Objects.equals(name, that.name) && Objects.equals(originalName, that.originalName) && Objects.equals(relevance, that.relevance) && Objects.equals(romaji, that.romaji) && Objects.equals(romajiName, that.romajiName) && Objects.equals(displayPicture, that.displayPicture) && Objects.equals(description, that.description) && Objects.equals(likes, that.likes) && Objects.equals(trash, that.trash) && Objects.equals(type, that.type) && Objects.equals(url, that.url) && Objects.equals(appearances, that.appearances) && Objects.equals(id, that.id); } @Override public int hashCode() { - return Objects.hash(slug, name, originalName, romajiName, displayPicture, description, likes, trash, url, appearances, id); + return Objects.hash(slug, name, originalName, relevance, romaji, romajiName, displayPicture, description, likes, trash, type, url, appearances, id); } @Override @@ -300,11 +300,14 @@ public class FilteredWaifu { "slug='" + slug + '\'' + ", name='" + name + '\'' + ", originalName='" + originalName + '\'' + + ", relevance=" + relevance + + ", romaji='" + romaji + '\'' + ", romajiName='" + romajiName + '\'' + ", displayPicture='" + displayPicture + '\'' + ", description='" + description + '\'' + ", likes=" + likes + ", trash=" + trash + + ", type='" + type + '\'' + ", url='" + url + '\'' + ", appearances=" + appearances + ", id=" + id + diff --git a/src/main/java/me/goudham/api/entity/waifu/Waifu.java b/src/main/java/me/goudham/api/entity/waifu/Waifu.java index 2005e31..6cb527a 100644 --- a/src/main/java/me/goudham/api/entity/waifu/Waifu.java +++ b/src/main/java/me/goudham/api/entity/waifu/Waifu.java @@ -1,14 +1,14 @@ package me.goudham.api.entity.waifu; +import com.fasterxml.jackson.annotation.*; +import me.goudham.api.entity.series.Series; +import me.goudham.api.entity.user.Creator; + +import javax.annotation.processing.Generated; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import javax.annotation.processing.Generated; - -import com.fasterxml.jackson.annotation.*; -import me.goudham.api.entity.series.Series; -import me.goudham.api.entity.user.Creator; /** @@ -81,7 +81,6 @@ import me.goudham.api.entity.user.Creator; "appearances", "series" }) -@Generated("jsonschema2pojo") @JsonIgnoreProperties(ignoreUnknown = true) public class Waifu { /** @@ -612,12 +611,12 @@ public class Waifu { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Waifu waifu = (Waifu) o; - return Objects.equals(id, waifu.id) && Objects.equals(slug, waifu.slug) && Objects.equals(creator, waifu.creator) && Objects.equals(name, waifu.name) && Objects.equals(originalName, waifu.originalName) && Objects.equals(displayPicture, waifu.displayPicture) && Objects.equals(description, waifu.description) && Objects.equals(weight, waifu.weight) && Objects.equals(height, waifu.height) && Objects.equals(bust, waifu.bust) && Objects.equals(hip, waifu.hip) && Objects.equals(waist, waifu.waist) && bloodType == waifu.bloodType && Objects.equals(origin, waifu.origin) && Objects.equals(age, waifu.age) && Objects.equals(birthdayMonth, waifu.birthdayMonth) && Objects.equals(birthdayDay, waifu.birthdayDay) && Objects.equals(birthdayYear, waifu.birthdayYear) && Objects.equals(likes, waifu.likes) && Objects.equals(trash, waifu.trash) && Objects.equals(url, waifu.url) && Objects.equals(husbando, waifu.husbando) && Objects.equals(nsfw, waifu.nsfw) && Objects.equals(popularityRank, waifu.popularityRank) && Objects.equals(likeRank, waifu.likeRank) && Objects.equals(trashRank, waifu.trashRank) && Objects.equals(appearances, waifu.appearances) && Objects.equals(series, waifu.series); + return Objects.equals(id, waifu.id) && Objects.equals(slug, waifu.slug) && Objects.equals(creator, waifu.creator) && Objects.equals(name, waifu.name) && Objects.equals(originalName, waifu.originalName) && Objects.equals(romajiName, waifu.romajiName) && Objects.equals(displayPicture, waifu.displayPicture) && Objects.equals(description, waifu.description) && Objects.equals(weight, waifu.weight) && Objects.equals(height, waifu.height) && Objects.equals(bust, waifu.bust) && Objects.equals(hip, waifu.hip) && Objects.equals(waist, waifu.waist) && bloodType == waifu.bloodType && Objects.equals(origin, waifu.origin) && Objects.equals(age, waifu.age) && Objects.equals(birthdayMonth, waifu.birthdayMonth) && Objects.equals(birthdayDay, waifu.birthdayDay) && Objects.equals(birthdayYear, waifu.birthdayYear) && Objects.equals(likes, waifu.likes) && Objects.equals(trash, waifu.trash) && Objects.equals(url, waifu.url) && Objects.equals(husbando, waifu.husbando) && Objects.equals(nsfw, waifu.nsfw) && Objects.equals(popularityRank, waifu.popularityRank) && Objects.equals(likeRank, waifu.likeRank) && Objects.equals(trashRank, waifu.trashRank) && Objects.equals(appearances, waifu.appearances) && Objects.equals(series, waifu.series); } @Override public int hashCode() { - return Objects.hash(id, slug, creator, name, originalName, displayPicture, description, weight, height, bust, hip, waist, bloodType, origin, age, birthdayMonth, birthdayDay, birthdayYear, likes, trash, url, husbando, nsfw, popularityRank, likeRank, trashRank, appearances, series); + return Objects.hash(id, slug, creator, name, originalName, romajiName, displayPicture, description, weight, height, bust, hip, waist, bloodType, origin, age, birthdayMonth, birthdayDay, birthdayYear, likes, trash, url, husbando, nsfw, popularityRank, likeRank, trashRank, appearances, series); } @Override @@ -625,9 +624,10 @@ public class Waifu { return "Waifu{" + "id=" + id + ", slug='" + slug + '\'' + - ", creatorId=" + creator + + ", creator=" + creator + ", name='" + name + '\'' + ", originalName='" + originalName + '\'' + + ", romajiName='" + romajiName + '\'' + ", displayPicture='" + displayPicture + '\'' + ", description='" + description + '\'' + ", weight=" + weight +