Use Records instead of normal classes

JDK-16 has support for Records which are much superior here
dev/jdk-16
Hammy 3 years ago
parent 7446554233
commit a8949a241c

@ -2,11 +2,8 @@ package me.goudham.domain.series;
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 FilteredSeries}
* <p> Contains basic series information for most endpoints </p>
@ -35,207 +32,19 @@ import java.util.Objects;
"slug",
"type",
"description",
"displayPicture",
"display_picture",
"url",
"id"
})
public class FilteredSeries {
/**
* Full name, in English.
*
*/
@JsonProperty("name")
@JsonPropertyDescription("Full name, in English.")
private String name;
/**
* Name in the original language ()
*
*/
@JsonProperty("original_name")
@JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)")
private String originalName;
/**
* Relevancy of {@link FilteredSeries}
*/
@JsonProperty("relevance")
@JsonPropertyDescription("Relevancy of FilteredSeries")
private Integer relevance;
/**
* If this {@link FilteredSeries} has a romaji name, we'll put it here.
*
*/
@JsonProperty("romaji_name")
@JsonPropertyDescription("if this series has a romaji name, we'll put it here. ")
private String romajiName;
/**
* Readable URL's for this {@link FilteredSeries}
*
*/
@JsonProperty("slug")
@JsonPropertyDescription("Used to generate readable URL's for the FilteredSeries")
private String slug;
/**
* Type of {@link FilteredSeries}. E.g TV, Game
*
*/
@JsonProperty("type")
@JsonPropertyDescription("Type of FilteredSeries. E.g TV, Game")
private String type;
/**
* Truncated, spoiler-free description of this {@link FilteredSeries}
*
*/
@JsonProperty("description")
@JsonPropertyDescription("Truncated, spoiler-free description of this FilteredSeries")
private String description;
/**
* URL of the display picture
*
*/
@JsonProperty("display_picture")
@JsonPropertyDescription("URL of the display picture")
private String displayPicture;
/**
* URL to view in browser
*
*/
@JsonProperty("url")
@JsonPropertyDescription("URL to view in browser")
private String url;
/**
* Interal ID of this {@link FilteredSeries}
*/
@JsonProperty("id")
@JsonPropertyDescription("Internal ID of this FilteredSeries")
private Integer id;
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("original_name")
public String getOriginalName() {
return originalName;
}
@JsonProperty("original_name")
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
@JsonProperty("relevance")
public Integer getRelevance() { return relevance; }
@JsonProperty("relevance")
public void setRelevance(Integer relevance) { this.relevance = relevance; }
@JsonProperty("romaji_name")
public String getRomajiName() {
return romajiName;
}
@JsonProperty("romaji_name")
public void setRomajiName(String romajiName) {
this.romajiName = romajiName;
}
@JsonProperty("slug")
public String getSlug() {
return slug;
}
@JsonProperty("slug")
public void setSlug(String slug) {
this.slug = slug;
}
@JsonProperty("type")
public String getType() { return type; }
@JsonProperty("type")
public void setType(String type) { this.type = type; }
@JsonProperty("description")
public String getDescription() {
return description;
}
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("display_picture")
public String getDisplayPicture() {
return displayPicture;
}
@JsonProperty("display_picture")
public void setDisplayPicture(String displayPicture) {
this.displayPicture = displayPicture;
}
@JsonProperty("url")
public String getUrl() {
return url;
}
@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
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(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, relevance, romajiName, slug, type, description, displayPicture, url, id);
}
@Override
public String toString() {
return "FilteredSeries{" +
"name='" + name + '\'' +
", originalName='" + originalName + '\'' +
", relevance=" + relevance +
", romajiName='" + romajiName + '\'' +
", slug='" + slug + '\'' +
", type='" + type + '\'' +
", description='" + description + '\'' +
", displayPicture='" + displayPicture + '\'' +
", url='" + url + '\'' +
", id=" + id +
'}';
}
}
public record FilteredSeries(
String name,
@JsonProperty("original_name") String originalName,
Integer relevance,
@JsonProperty("romaji_name") String romajiName,
String slug,
String type,
String description,
@JsonProperty("display_picture") String displayPicture,
String url,
Integer id
) { }

@ -1,11 +1,12 @@
package me.goudham.domain.series;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import me.goudham.domain.Studio;
import me.goudham.domain.waifu.Waifu;
import java.util.Objects;
/**
* {@link Series}
* <p>Represents a grouping of various {@link Waifu}'s. This can be an anime, mobile game, video game, manga, or LN</p>
@ -47,284 +48,19 @@ import java.util.Objects;
"id"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class Series {
/**
* Full Name (in English)
*
*/
@JsonProperty("name")
@JsonPropertyDescription("Full Name (in English)")
private String name;
/**
* Name in the original language ()
*
*/
@JsonProperty("original_name")
@JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)")
private String originalName;
/**
* Romanization of this {@link Series} name
*
*/
@JsonProperty("romaji_name")
@JsonPropertyDescription("Romanization of this Series name")
private String romajiName;
/**
* Spoiler-free description of the {@link Series}, work, etc
*
*/
@JsonProperty("description")
@JsonPropertyDescription("Spoiler-free description of the series, work, etc")
private String description;
/**
* Used to generate readable URL's for the {@link Series}
*
*/
@JsonProperty("slug")
@JsonPropertyDescription("Used to generate readable URL's for the Series")
private String slug;
/**
* Original works release date (
*
*/
@JsonProperty("release_date")
@JsonAlias("release")
@JsonPropertyDescription("Original works release date (")
private String releaseDate;
/**
* The works airing start date
*
*/
@JsonProperty("airing_start")
@JsonPropertyDescription("The works airing start date")
private String airingStart;
/**
* The works airing end date
*
*/
@JsonProperty("airing_end")
@JsonPropertyDescription("The works airing end date")
private String airingEnd;
/**
* The number of episodes in this work. 1 if OVA or Movie.
*
*/
@JsonProperty("episode_count")
@JsonPropertyDescription("The number of episodes in this work. 1 if OVA or Movie.")
private Integer episodeCount;
/**
* URL of the display picture
*
*/
@JsonProperty("display_picture")
@JsonAlias("image")
@JsonPropertyDescription("URL of the display picture")
private String displayPicture;
/**
* URL of the {@link Series}
*/
@JsonProperty("url")
private String url;
/**
* {@link Studio}
* <p> Contains information on a given animation or game development studio </p>
*
*/
@JsonProperty("studio")
@JsonPropertyDescription("Contains information on a given animation or game development studio")
private Studio studio;
/**
* Type of {@link Series}. E.g TV, Game
*
*/
@JsonProperty("type")
@JsonPropertyDescription("Type of FilteredSeries. E.g TV, Game")
private String type;
/**
* The internal ID of the {@link Series}
*
*/
@JsonProperty("id")
@JsonPropertyDescription("The internal ID of the Series")
private Integer id;
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("original_name")
public String getOriginalName() {
return originalName;
}
@JsonProperty("original_name")
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
@JsonProperty("romaji_name")
public String getRomajiName() {
return romajiName;
}
@JsonProperty("romaji_name")
public void setRomajiName(String romajiName) {
this.romajiName = romajiName;
}
@JsonProperty("description")
public String getDescription() {
return description;
}
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("slug")
public String getSlug() {
return slug;
}
@JsonProperty("slug")
public void setSlug(String slug) {
this.slug = slug;
}
@JsonProperty("release_date")
public String getReleaseDate() {
return releaseDate;
}
@JsonProperty("release_date")
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
public String getAiringStart() {
return airingStart;
}
public void setAiringStart(String airingStart) {
this.airingStart = airingStart;
}
@JsonProperty("airing_end")
public String getAiringEnd() {
return airingEnd;
}
@JsonProperty("airing_end")
public void setAiringEnd(String airingEnd) {
this.airingEnd = airingEnd;
}
@JsonProperty("episode_count")
public Integer getEpisodeCount() {
return episodeCount;
}
@JsonProperty("episode_count")
public void setEpisodeCount(Integer episodeCount) {
this.episodeCount = episodeCount;
}
@JsonProperty("image")
public String getDisplayPicture() {
return displayPicture;
}
@JsonProperty("image")
public void setDisplayPicture(String displayPicture) {
this.displayPicture = displayPicture;
}
@JsonProperty("url")
public String getUrl() {
return url;
}
@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}
@JsonProperty("studio")
public Studio getStudio() {
return studio;
}
@JsonProperty("studio")
public void setStudio(Studio studio) {
this.studio = studio;
}
@JsonProperty("type")
public String getType() { return type; }
@JsonProperty("type")
public void setType(String type) { this.type = type; }
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
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(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, type, id);
}
@Override
public String toString() {
return "Series{" +
"name='" + name + '\'' +
", originalName='" + originalName + '\'' +
", romajiName='" + romajiName + '\'' +
", description='" + description + '\'' +
", slug='" + slug + '\'' +
", releaseDate='" + releaseDate + '\'' +
", airingStart='" + airingStart + '\'' +
", airingEnd='" + airingEnd + '\'' +
", episodeCount=" + episodeCount +
", displayPicture='" + displayPicture + '\'' +
", url='" + url + '\'' +
", studio=" + studio +
", type='" + type + '\'' +
", id=" + id +
'}';
}
}
public record Series(
String name,
@JsonProperty("original_name") String originalName,
@JsonProperty("romaji_name") String romajiName,
String description,
String slug,
@JsonProperty("release_date") String releaseDate,
@JsonProperty("airing_start") String airingStart,
@JsonProperty("airing_end") String airing_end,
@JsonProperty("episode_count") Integer episodeCount,
@JsonProperty("display_picture") String displayPicture,
String url,
Studio studio,
String type,
Integer id
) { }

@ -1,13 +1,9 @@
package me.goudham.domain.user;
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.domain.waifu.Waifu;
import java.util.Objects;
/**
* {@link Creator}
* <p>User that submitted the {@link Waifu}</p>
@ -24,61 +20,4 @@ import java.util.Objects;
"id",
"name"
})
public class Creator {
/**
* {@link Creator} ID
*
*/
@JsonProperty("id")
@JsonPropertyDescription("Creator ID")
private Integer id;
/**
* {@link Creator} Name
*/
@JsonProperty("name")
@JsonPropertyDescription("Creator Name")
private String name;
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Creator creator = (Creator) o;
return Objects.equals(id, creator.id) && Objects.equals(name, creator.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
return "Creator{" +
"id=" + id +
", name='" + name + '\'' +
'}';
}
}
public record Creator(Integer id, String name) { }

@ -2,12 +2,7 @@
package me.goudham.domain.user;
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.domain.series.Series;
import java.util.Objects;
/**
* {@link TrueLove}
@ -27,77 +22,4 @@ import java.util.Objects;
"slug",
"series"
})
public class TrueLove {
/**
* Name of {@link TrueLove}
*/
@JsonProperty("name")
@JsonPropertyDescription("Name of True Love")
private String name;
/**
* Slug value of {@link TrueLove}
*/
@JsonProperty("slug")
@JsonPropertyDescription("Slug value of True Love")
private String slug;
/**
* {@link Series} that this {@link TrueLove} is part of
*/
@JsonProperty("series")
@JsonPropertyDescription("Series that this TrueLove is part of")
private String series;
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("slug")
public String getSlug() {
return slug;
}
@JsonProperty("slug")
public void setSlug(String slug) {
this.slug = slug;
}
@JsonProperty("series")
public String getSeries() {
return series;
}
@JsonProperty("series")
public void setSeries(String series) {
this.series = series;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TrueLove trueLove = (TrueLove) o;
return Objects.equals(name, trueLove.name) && Objects.equals(slug, trueLove.slug) && Objects.equals(series, trueLove.series);
}
@Override
public int hashCode() {
return Objects.hash(name, slug, series);
}
@Override
public String toString() {
return "TrueLove{" +
"name='" + name + '\'' +
", slug='" + slug + '\'' +
", series='" + series + '\'' +
'}';
}
}
record TrueLove(String name, String slug, String series) { }

@ -1,9 +1,9 @@
package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.*;
import me.goudham.domain.waifu.Waifu;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
@ -37,188 +37,14 @@ import java.util.Objects;
"true_love"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
/**
* {@link User} Avatar
*/
@JsonProperty("avatar")
@JsonPropertyDescription("User Avatar")
private String avatar;
/**
* {@link User} ID
*/
@JsonProperty("id")
@JsonPropertyDescription("User ID")
private Integer id;
/**
* {@link User}'s display name, or twitter name
*
*/
@JsonProperty("name")
@JsonPropertyDescription("User's display name, or twitter name")
private String name;
/**
* {@link User}'s Twitter Handle
*
*/
@JsonProperty("twitter")
@JsonPropertyDescription("User's Twitter Handle")
private String twitter;
/**
* ISO 8601 date when {@link User} joined
*
*/
@JsonProperty("joined")
@JsonPropertyDescription("ISO 8601 date when user joined")
private String joined;
/**
* Number of {@link Waifu}'s this {@link User} has created
*
*/
@JsonProperty("waifus_created")
@JsonPropertyDescription("Number of Waifu's this user has created")
private Integer waifusCreated;
/**
* Number of {@link Waifu}'s this {@link User} has liked
*
*/
@JsonProperty("waifus_liked")
@JsonPropertyDescription("Number of Waifu's this user has liked")
private Integer waifusLiked;
/**
* Number of {@link Waifu}'s this {@link User} has trashed
*
*/
@JsonProperty("waifus_trashed")
@JsonPropertyDescription("Number of Waifu's this user has trashed")
private Integer waifusTrashed;
/**
* <p>{@link User}'s {@link TrueLove}</p>
*
*/
@JsonProperty("true_love")
@JsonPropertyDescription("User's True Love")
private TrueLove trueLove;
@JsonProperty("avatar")
public String getAvatar() { return avatar; }
@JsonProperty("avatar")
public void setAvatar(String avatar) { this.avatar = avatar; }
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("twitter")
public String getTwitter() {
return twitter;
}
@JsonProperty("twitter")
public void setTwitter(String twitter) {
this.twitter = twitter;
}
@JsonProperty("joined")
public String getJoined() {
return joined;
}
@JsonProperty("joined")
public void setJoined(String joined) {
this.joined = joined;
}
@JsonProperty("waifus_created")
public Integer getWaifusCreated() {
return waifusCreated;
}
@JsonProperty("waifus_created")
public void setWaifusCreated(Integer waifusCreated) {
this.waifusCreated = waifusCreated;
}
@JsonProperty("waifus_liked")
public Integer getWaifusLiked() {
return waifusLiked;
}
@JsonProperty("waifus_liked")
public void setWaifusLiked(Integer waifusLiked) {
this.waifusLiked = waifusLiked;
}
@JsonProperty("waifus_trashed")
public Integer getWaifusTrashed() {
return waifusTrashed;
}
@JsonProperty("waifus_trashed")
public void setWaifusTrashed(Integer waifusTrashed) {
this.waifusTrashed = waifusTrashed;
}
@JsonProperty("true_love")
public TrueLove getTrueLove() {
return trueLove;
}
@JsonProperty("true_love")
public void setTrueLove(TrueLove trueLove) {
this.trueLove = trueLove;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
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(avatar, id, name, twitter, joined, waifusCreated, waifusLiked, waifusTrashed, trueLove);
}
@Override
public String toString() {
return "User{" +
"avatar='" + avatar + '\'' +
", id=" + id +
", name='" + name + '\'' +
", twitter='" + twitter + '\'' +
", joined='" + joined + '\'' +
", waifusCreated=" + waifusCreated +
", waifusLiked=" + waifusLiked +
", waifusTrashed=" + waifusTrashed +
", trueLove=" + trueLove +
'}';
}
}
public record User(
String avatar,
Integer id,
String name,
String twitter,
String joined,
@JsonProperty("waifus_created") Integer waifusCreated,
@JsonProperty("waifus_liked") Integer waifusLiked,
@JsonProperty("waifus_trashed") Integer waifusTrashed,
@JsonProperty("true_love") TrueLove trueLove
) { }

@ -1,10 +1,11 @@
package me.goudham.domain.user;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import me.goudham.domain.waifu.Waifu;
import java.util.List;
import java.util.Objects;
/**
* {@link UserList}
@ -27,99 +28,4 @@ import java.util.Objects;
"waifus"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class UserList {
/**
* {@link UserList} ID
*
*/
@JsonProperty("id")
@JsonPropertyDescription("UserList ID")
private Integer id;
/**
* {@link UserList} Name
*
*/
@JsonProperty("name")
@JsonPropertyDescription("UserList Name")
private String name;
/**
* Order this appears in the {@link UserList}
*
*/
@JsonProperty("order")
@JsonPropertyDescription("Order this appears in the UserList")
private Integer order;
/**
* List of {@link Waifu}'s within the {@link UserList}
*
*/
@JsonProperty("waifus")
@JsonPropertyDescription("List of Waifu's within the UserList")
private List<Waifu> waifus;
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("order")
public Integer getOrder() {
return order;
}
@JsonProperty("order")
public void setOrder(Integer order) {
this.order = order;
}
@JsonProperty("waifus")
public List<Waifu> getWaifus() {
return waifus;
}
@JsonProperty("waifus")
public void setWaifus(List<Waifu> waifus) {
this.waifus = waifus;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserList userList = (UserList) o;
return Objects.equals(id, userList.id) && Objects.equals(name, userList.name) && Objects.equals(order, userList.order) && Objects.equals(waifus, userList.waifus);
}
@Override
public int hashCode() {
return Objects.hash(id, name, order, waifus);
}
@Override
public String toString() {
return "UserList{" +
"id=" + id +
", name='" + name + '\'' +
", order=" + order +
", waifus=" + waifus +
'}';
}
}
public record UserList(Integer id, String name, Integer order, List<Waifu> waifus) { }

@ -1,10 +1,12 @@
package me.goudham.domain.waifu;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import me.goudham.domain.series.FilteredSeries;
import java.util.List;
import java.util.Objects;
/**
@ -48,270 +50,19 @@ import java.util.Objects;
"id"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class FilteredWaifu {
/**
* Used to generate readable URL's for the {@link FilteredWaifu}
*
*/
@JsonProperty("slug")
@JsonPropertyDescription("Used to generate readable URL's for the FilteredWaifu")
private String slug;
/**
* Full name, in English.
*
*/
@JsonProperty("name")
@JsonPropertyDescription("Full name, in English.")
private String name;
/**
* Name in the original language ()
*
*/
@JsonProperty("original_name")
@JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)")
private String originalName;
/**
* Relevancy of {@link FilteredWaifu}
*/
@JsonProperty("relevance")
@JsonPropertyDescription("Relevancy of FilteredWaifu")
private Integer relevance;
/**
* If this character has a romaji name, we'll put it here.
*
*/
@JsonProperty("romaji")
@JsonPropertyDescription("if this character has a romaji name, we'll put it here. ")
private String romaji;
/**
* If this character has a romaji name, we'll put it here.
*
*/
@JsonProperty("romaji_name")
@JsonPropertyDescription("if this character has a romaji name, we'll put it here. ")
private String romajiName;
/**
* URL of the display picture
*
*/
@JsonProperty("display_picture")
@JsonPropertyDescription("URL of the display picture")
private String displayPicture;
/**
* Truncated, spoiler-free description of this {@link FilteredWaifu}
*
*/
@JsonProperty("description")
@JsonPropertyDescription("Truncated, spoiler-free description of this FilteredWaifu")
private String description;
/**
* Number of likes for this {@link FilteredWaifu}
*
*/
@JsonProperty("likes")
@JsonPropertyDescription("Number of likes for this FilteredWaifu")
private Integer likes;
/**
* Number of trashes for this {@link FilteredWaifu}
*
*/
@JsonProperty("trash")
@JsonPropertyDescription("Number of trashes for this FilteredWaifu")
private Integer trash;
/**
* Type that is returned. Eg Waifu, Husbando
*
*/
@JsonProperty("type")
@JsonPropertyDescription("Type that is returned. Eg Waifu, Husbando")
private String type;
/**
* URL to view in browser
*
*/
@JsonProperty("url")
@JsonPropertyDescription("URL to view in browser")
private String url;
/**
* <p>{@link List} of Waifu's appearances</p>
*/
@JsonProperty("appearances")
private List<FilteredSeries> appearances;
/**
* {@link FilteredWaifu} ID
*/
@JsonProperty("id")
private Double id;
@JsonProperty("slug")
public String getSlug() {
return slug;
}
@JsonProperty("slug")
public void setSlug(String slug) {
this.slug = slug;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("original_name")
public String getOriginalName() {
return originalName;
}
@JsonProperty("original_name")
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
@JsonProperty("relevance")
public Integer getRelevance() { return relevance; }
@JsonProperty("relevance")
public void setRelevance(Integer relevance) { this.relevance = relevance; }
@JsonProperty("romaji")
public String getRomaji() { return romaji; }
@JsonProperty("romaji")
public void setRomaji(String romaji) { this.romaji = romaji; }
@JsonProperty("romaji_name")
public String getRomajiName() {
return romajiName;
}
@JsonProperty("romaji_name")
public void setRomajiName(String romajiName) {
this.romajiName = romajiName;
}
@JsonProperty("display_picture")
public String getDisplayPicture() {
return displayPicture;
}
@JsonProperty("display_picture")
public void setDisplayPicture(String displayPicture) {
this.displayPicture = displayPicture;
}
@JsonProperty("description")
public String getDescription() {
return description;
}
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("likes")
public Integer getLikes() {
return likes;
}
@JsonProperty("likes")
public void setLikes(Integer likes) {
this.likes = likes;
}
@JsonProperty("trash")
public Integer getTrash() {
return trash;
}
@JsonProperty("trash")
public void setTrash(Integer trash) {
this.trash = trash;
}
@JsonProperty("type")
public String getType() { return type; }
@JsonProperty("type")
public void setType(String type) { this.type = type; }
@JsonProperty("url")
public String getUrl() {
return url;
}
@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}
@JsonProperty("appearances")
public List<FilteredSeries> getAppearances() { return appearances; }
@JsonProperty("appearances")
public void setAppearances(List<FilteredSeries> filteredSeries) {
this.appearances = filteredSeries;
}
@JsonProperty("id")
public Double getId() {
return id;
}
@JsonProperty("id")
public void setId(Double id) {
this.id = id;
}
@Override
public boolean equals(Object o) {
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(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, relevance, romaji, romajiName, displayPicture, description, likes, trash, type, url, appearances, id);
}
@Override
public String toString() {
return "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 +
'}';
}
}
public record FilteredWaifu(
String slug,
String name,
@JsonProperty("original_name") String originalName,
Integer relevance,
String romaji,
@JsonProperty("romaji_name") String romajiName,
@JsonProperty("display_picture") String displayPicture,
String description,
Integer likes,
Integer trash,
String type,
String url,
List<FilteredSeries> appearances,
Double id
) { }

@ -8,7 +8,6 @@ import javax.annotation.processing.Generated;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
@ -19,7 +18,7 @@ import java.util.Objects;
* <ul>
* <li>{@link Integer id}</li>
* <li>{@link String slug}</li>
* <li>{@link Creator creatorId}</li>
* <li>{@link Creator creator}</li>
* <li>{@link String name}</li>
* <li>{@link String originalName}</li>
* <li>{@link String romaji_name}</li>
@ -82,577 +81,37 @@ import java.util.Objects;
"series"
})
@JsonIgnoreProperties(ignoreUnknown = true)
public class Waifu {
/**
* {@link Waifu} ID
*
*/
@JsonProperty("id")
@JsonPropertyDescription("ID of this Waifu")
private Integer id;
/**
* Used to generate readable URL's for the {@link Waifu}
*
*/
@JsonProperty("slug")
@JsonPropertyDescription("Used to generate readable URL's for the Waifu")
private String slug;
/**
* ID of the user who created this {@link Waifu}
*
*/
@JsonProperty("creator")
@JsonPropertyDescription("User who created this Waifu")
private Creator creator;
/**
* Full name, in English.
*
*/
@JsonProperty("name")
@JsonPropertyDescription("Full name, in English.")
private String name;
/**
* Name in the original language ()
*
*/
@JsonProperty("original_name")
@JsonPropertyDescription("Name in the original language (\u65e5\u672c\u8a9e)")
private String originalName;
/**
* If this character has a romaji name, we'll put it here.
*
*/
@JsonProperty("romaji_name")
@JsonPropertyDescription("if this character has a romaji name, we'll put it here. ")
private String romajiName;
/**
* URL of the display picture
*
*/
@JsonProperty("display_picture")
@JsonPropertyDescription("URL of the display picture")
private String displayPicture;
/**
* Spoiler-free description of this {@link Waifu}
*
*/
@JsonProperty("description")
@JsonPropertyDescription("Spoiler-free description of this Waifu")
private String description;
/**
* Weight (kg)
*
*/
@JsonProperty("weight")
@JsonPropertyDescription("Weight (kg)")
private Double weight;
/**
* Height(cm)
*
*/
@JsonProperty("height")
@JsonPropertyDescription("Height(cm)")
private Double height;
/**
* Bust size (cm)
*
*/
@JsonProperty("bust")
@JsonPropertyDescription("Bust size (cm)")
private Double bust;
/**
* Hip size (cm)
*
*/
@JsonProperty("hip")
@JsonPropertyDescription("Hip size (cm)")
private Double hip;
/**
* Waist size (cm)
*
*/
@JsonProperty("waist")
@JsonPropertyDescription("Waist size (cm)")
private Double waist;
/**
* Common in Japanese culture as a potential reprenstation of personality types
*
*/
@JsonProperty("blood_type")
@JsonPropertyDescription("Common in Japanese culture as a potential reprenstation of personality types")
private Waifu.BloodType bloodType;
/**
* Birth location, home, etc.
*
*/
@JsonProperty("origin")
@JsonPropertyDescription("Birth location, home, etc.")
private String origin;
/**
* Age from the source material (e.g. 500 for 500 years old)
*
*/
@JsonProperty("age")
@JsonPropertyDescription("Age from the source material (e.g. 500 for 500 years old)")
private Integer age;
/**
* Birth month from source material
*
*/
@JsonProperty("birthday_month")
@JsonPropertyDescription("Birth month from source material")
private String birthdayMonth;
/**
* Birth day from source material
*
*/
@JsonProperty("birthday_day")
@JsonPropertyDescription("Birth day from source material")
private Integer birthdayDay;
/**
* Birth year from source material
*
*/
@JsonProperty("birthday_year")
@JsonPropertyDescription("Birth year from source material")
private Integer birthdayYear;
/**
* Number of likes for this {@link Waifu}
*
*/
@JsonProperty("likes")
@JsonPropertyDescription("Number of likes for this Waifu")
private Integer likes;
/**
* Number of trashes for this {@link Waifu}
*
*/
@JsonProperty("trash")
@JsonPropertyDescription("Number of trashes for this Waifu")
private Integer trash;
/**
* URL to view in browser
*
*/
@JsonProperty("url")
@JsonPropertyDescription("URL to view in browser")
private String url;
/**
* If this character is a husbando
*
*/
@JsonProperty("husbando")
@JsonPropertyDescription("If this character is a husbando")
private Boolean husbando;
/**
* If this {@link Waifu}\husbando appears in an NSFW work
*
*/
@JsonProperty("nsfw")
@JsonPropertyDescription("If this waifu\\husbando appears in an NSFW work")
private Boolean nsfw;
/**
* Site-wide popularity ranking
*
*/
@JsonProperty("popularity_rank")
@JsonPropertyDescription("Site-wide popularity ranking")
private Integer popularityRank;
/**
* Site-wide "like" or "claim" ranking
*
*/
@JsonProperty("like_rank")
@JsonPropertyDescription("Site-wide \"like\" or \"claim\" ranking")
private Integer likeRank;
/**
* Site-wide trash ranking - lower is worse.
*
*/
@JsonProperty("trash_rank")
@JsonPropertyDescription("Site-wide trash ranking - lower is worse")
private Integer trashRank;
/**
* An array of series or works that this character appears in.
*
*/
@JsonProperty("appearances")
@JsonPropertyDescription("An array of series or works that this character appears in")
private List<Series> appearances;
/**
* {@link Series}
* <p>Contains basic series information for most endpoints</p>
*
*/
@JsonProperty("series")
@JsonPropertyDescription("Contains basic series information for most endpoints")
private Series series;
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("slug")
public String getSlug() {
return slug;
}
@JsonProperty("slug")
public void setSlug(String slug) {
this.slug = slug;
}
@JsonProperty("creator")
public Creator getCreator() {
return creator;
}
@JsonProperty("creator")
public void setCreator(Creator creator) {
this.creator = creator;
}
@JsonProperty("name")
public String getName() {
return name;
}
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("original_name")
public String getOriginalName() {
return originalName;
}
@JsonProperty("original_name")
public void setOriginalName(String originalName) {
this.originalName = originalName;
}
@JsonProperty("romaji_name")
public String getRomajiName() {
return romajiName;
}
@JsonProperty("romaji_name")
public void setRomajiName(String romajiName) {
this.romajiName = romajiName;
}
@JsonProperty("display_picture")
public String getDisplayPicture() {
return displayPicture;
}
@JsonProperty("display_picture")
public void setDisplayPicture(String displayPicture) {
this.displayPicture = displayPicture;
}
@JsonProperty("description")
public String getDescription() {
return description;
}
@JsonProperty("description")
public void setDescription(String description) {
this.description = description;
}
@JsonProperty("weight")
public Double getWeight() {
return weight;
}
@JsonProperty("weight")
public void setWeight(Double weight) {
this.weight = weight;
}
@JsonProperty("height")
public Double getHeight() {
return height;
}
@JsonProperty("height")
public void setHeight(Double height) {
this.height = height;
}
@JsonProperty("bust")
public Double getBust() {
return bust;
}
@JsonProperty("bust")
public void setBust(Double bust) {
this.bust = bust;
}
@JsonProperty("hip")
public Double getHip() {
return hip;
}
@JsonProperty("hip")
public void setHip(Double hip) {
this.hip = hip;
}
@JsonProperty("waist")
public Double getWaist() {
return waist;
}
@JsonProperty("waist")
public void setWaist(Double waist) {
this.waist = waist;
}
@JsonProperty("blood_type")
public Waifu.BloodType getBloodType() {
return bloodType;
}
@JsonProperty("blood_type")
public void setBloodType(Waifu.BloodType bloodType) {
this.bloodType = bloodType;
}
@JsonProperty("origin")
public String getOrigin() {
return origin;
}
@JsonProperty("origin")
public void setOrigin(String origin) {
this.origin = origin;
}
@JsonProperty("age")
public Integer getAge() {
return age;
}
@JsonProperty("age")
public void setAge(Integer age) {
this.age = age;
}
@JsonProperty("birthday_month")
public String getBirthdayMonth() {
return birthdayMonth;
}
@JsonProperty("birthday_month")
public void setBirthdayMonth(String birthdayMonth) {
this.birthdayMonth = birthdayMonth;
}
@JsonProperty("birthday_day")
public Integer getBirthdayDay() {
return birthdayDay;
}
@JsonProperty("birthday_day")
public void setBirthdayDay(Integer birthdayDay) {
this.birthdayDay = birthdayDay;
}
@JsonProperty("birthday_year")
public Integer getBirthdayYear() {
return birthdayYear;
}
@JsonProperty("birthday_year")
public void setBirthdayYear(Integer birthdayYear) {
this.birthdayYear = birthdayYear;
}
@JsonProperty("likes")
public Integer getLikes() {
return likes;
}
@JsonProperty("likes")
public void setLikes(Integer likes) {
this.likes = likes;
}
@JsonProperty("trash")
public Integer getTrash() {
return trash;
}
@JsonProperty("trash")
public void setTrash(Integer trash) {
this.trash = trash;
}
@JsonProperty("url")
public String getUrl() {
return url;
}
@JsonProperty("url")
public void setUrl(String url) {
this.url = url;
}
@JsonProperty("husbando")
public Boolean getHusbando() {
return husbando;
}
@JsonProperty("husbando")
public void setHusbando(Boolean husbando) {
this.husbando = husbando;
}
@JsonProperty("nsfw")
public Boolean getNsfw() {
return nsfw;
}
@JsonProperty("nsfw")
public void setNsfw(Boolean nsfw) {
this.nsfw = nsfw;
}
@JsonProperty("popularity_rank")
public Integer getPopularityRank() {
return popularityRank;
}
@JsonProperty("popularity_rank")
public void setPopularityRank(Integer popularityRank) {
this.popularityRank = popularityRank;
}
@JsonProperty("like_rank")
public Integer getLikeRank() {
return likeRank;
}
@JsonProperty("like_rank")
public void setLikeRank(Integer likeRank) {
this.likeRank = likeRank;
}
@JsonProperty("trash_rank")
public Integer getTrashRank() {
return trashRank;
}
@JsonProperty("trash_rank")
public void setTrashRank(Integer trashRank) {
this.trashRank = trashRank;
}
@JsonProperty("appearances")
public List<Series> getAppearances() {
return appearances;
}
@JsonProperty("appearances")
public void setAppearances(List<Series> appearances) {
this.appearances = appearances;
}
@JsonProperty("series")
public Series getSeries() {
return series;
}
@JsonProperty("series")
public void setSeries(Series series) {
this.series = series;
}
@Override
public boolean equals(Object o) {
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(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, 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
public String toString() {
return "Waifu{" +
"id=" + id +
", slug='" + slug + '\'' +
", creator=" + creator +
", name='" + name + '\'' +
", originalName='" + originalName + '\'' +
", romajiName='" + romajiName + '\'' +
", displayPicture='" + displayPicture + '\'' +
", description='" + description + '\'' +
", weight=" + weight +
", height=" + height +
", bust=" + bust +
", hip=" + hip +
", waist=" + waist +
", bloodType=" + bloodType +
", origin='" + origin + '\'' +
", age=" + age +
", birthdayMonth='" + birthdayMonth + '\'' +
", birthdayDay=" + birthdayDay +
", birthdayYear=" + birthdayYear +
", likes=" + likes +
", trash=" + trash +
", url='" + url + '\'' +
", husbando=" + husbando +
", nsfw=" + nsfw +
", popularityRank=" + popularityRank +
", likeRank=" + likeRank +
", trashRank=" + trashRank +
", appearances=" + appearances +
", series=" + series +
'}';
}
public record Waifu(
Integer id,
String slug,
Creator creator,
String name,
@JsonProperty("original_name") String originalName,
@JsonProperty("romaji_name") String romajiName,
@JsonProperty("display_picture") String displayPicture,
String description,
Double weight,
Double height,
Double bust,
Double hip,
Double waist,
@JsonProperty("blood_type") Waifu.BloodType bloodType,
String origin,
Integer age,
@JsonProperty("birthday_month") String birthdayMonth,
@JsonProperty("birthday_day") Integer birthdayDay,
@JsonProperty("birthday_year") String birthdayYear,
Integer likes,
Integer trash,
String url,
Boolean husbando,
Boolean nsfw,
@JsonProperty("popularity_rank") String popularityRank,
@JsonProperty("like_rank") Integer likeRank,
@JsonProperty("trash_rank") String trashRank,
List<Series> appearances,
Series series
) {
/**
* {@link BloodType}

@ -1,12 +1,8 @@
package me.goudham.domain.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 java.util.Objects;
/**
* {@link WaifuImage}
* <p>Contains a thumbnail and full res image link for an image in a given Waifus gallery</p>
@ -27,97 +23,5 @@ import java.util.Objects;
"image",
"nsfw"
})
public class WaifuImage {
/**
* ID in the database
*
*/
@JsonProperty("id")
@JsonPropertyDescription("ID in the database")
private Integer id;
/**
* URL of the thumbnail to display
*
*/
@JsonProperty("thumbnail")
@JsonPropertyDescription("URL of the thumbnail to display")
private String thumbnail;
/**
* Final URL of the original resolution image
*
*/
@JsonProperty("image")
@JsonPropertyDescription("Final URL of the original resolution image")
private String image;
/**
* If image is NSFW or not
*
*/
@JsonProperty("nsfw")
@JsonPropertyDescription("If image is NSFW or not")
private String nsfw;
@JsonProperty("id")
public Integer getId() {
return id;
}
@JsonProperty("id")
public void setId(Integer id) {
this.id = id;
}
@JsonProperty("thumbnail")
public String getThumbnail() {
return thumbnail;
}
@JsonProperty("thumbnail")
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
@JsonProperty("image")
public String getImage() {
return image;
}
@JsonProperty("image")
public void setImage(String image) {
this.image = image;
}
@JsonProperty("nsfw")
public String getNsfw() { return nsfw; }
@JsonProperty("nsfw")
public void setNsfw(String nsfw) { this.nsfw = nsfw; }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
WaifuImage that = (WaifuImage) o;
return Objects.equals(id, that.id) && Objects.equals(thumbnail, that.thumbnail) && Objects.equals(image, that.image) && Objects.equals(nsfw, that.nsfw);
}
@Override
public int hashCode() {
return Objects.hash(id, thumbnail, image, nsfw);
}
@Override
public String toString() {
return "WaifuImage{" +
"id=" + id +
", thumbnail='" + thumbnail + '\'' +
", image='" + image + '\'' +
", nsfw='" + nsfw + '\'' +
'}';
}
}
public record WaifuImage(Integer id, String thumbnail, String image, Boolean nsfw) { }

Loading…
Cancel
Save