
de.blackrose01.model.game.GameVersion Maven / Gradle / Ivy
package de.blackrose01.model.game;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import java.io.Serializable;
import java.util.Objects;
/**
* Details about game editions and versions.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class GameVersion implements Serializable {
@JsonIgnore
@JsonProperty(value = "id")
private long id;
@JsonProperty(value = "game")
private Object game;
@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 GameVersion() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@JsonIgnore
public long getGame() {
return Long.parseLong(String.valueOf(game));
}
@JsonIgnore
public Game getGameObject() {
return new ObjectMapper().convertValue(game, Game.class);
}
public void setGame(Object game) {
this.game = game;
}
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;
GameVersion that = (GameVersion) o;
return id == that.id &&
createdAt == that.createdAt &&
updatedAt == that.updatedAt &&
Objects.equals(game, that.game) &&
Objects.equals(url, that.url) &&
Objects.equals(checksum, that.checksum);
}
@Override
public int hashCode() {
return Objects.hash(id, game, url, createdAt, updatedAt, checksum);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy