
de.blackrose01.model.Collection Maven / Gradle / Ivy
package de.blackrose01.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import de.blackrose01.model.game.Game;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
/**
* Collection, AKA Series
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Collection implements Serializable {
@JsonIgnore
@JsonProperty(value = "id")
private long id;
@JsonProperty(value = "games")
private List games;
@JsonIgnore
@JsonProperty(value = "name")
private String name;
@JsonIgnore
@JsonProperty(value = "slug")
private String slug;
@JsonIgnore
@JsonProperty(value = "url")
private String url;
@JsonIgnore
@JsonProperty(value = "created_at")
private long createdAt;
@JsonIgnore
@JsonProperty(value = "updated_at")
private long updatedAt;
@JsonIgnore
@JsonProperty(value = "checksum")
private String checksum;
public Collection() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@JsonIgnore
public List getGames() {
return new ObjectMapper().convertValue(games, new TypeReference>() {
});
}
@JsonIgnore
public List getGamesObject() {
return new ObjectMapper().convertValue(games, new TypeReference>() {
});
}
public void setGames(List games) {
this.games = games;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSlug() {
return slug;
}
public void setSlug(String slug) {
this.slug = slug;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public long getCreatedAt() {
return createdAt;
}
public void setCreatedAt(long createdAt) {
this.createdAt = createdAt;
}
public long getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(long updatedAt) {
this.updatedAt = updatedAt;
}
public String getChecksum() {
return checksum;
}
public void setChecksum(String checksum) {
this.checksum = checksum;
}
@Override
public String toString() {
return new Gson().toJson(this);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Collection that = (Collection) o;
return id == that.id &&
createdAt == that.createdAt &&
updatedAt == that.updatedAt &&
Objects.equals(games, that.games) &&
Objects.equals(name, that.name) &&
Objects.equals(slug, that.slug) &&
Objects.equals(url, that.url) &&
Objects.equals(checksum, that.checksum);
}
@Override
public int hashCode() {
return Objects.hash(id, games, name, slug, url, createdAt, updatedAt, checksum);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy