|
| 1 | +package com.gabriel_torelo.game_list.entities; |
| 2 | + |
| 3 | +import jakarta.persistence.Column; |
| 4 | +import jakarta.persistence.Entity; |
| 5 | +import jakarta.persistence.GeneratedValue; |
| 6 | +import jakarta.persistence.GenerationType; |
| 7 | +import jakarta.persistence.Id; |
| 8 | +import jakarta.persistence.Table; |
| 9 | + |
| 10 | +@Entity |
| 11 | +@Table(name = "tb_game") |
| 12 | +public class Game { |
| 13 | + |
| 14 | + @Id |
| 15 | + @GeneratedValue(strategy = GenerationType.IDENTITY) |
| 16 | + private Long id; |
| 17 | + private String title; |
| 18 | + |
| 19 | + @Column(name = "game_year") |
| 20 | + private Integer year; |
| 21 | + private String gender; |
| 22 | + private String platforms; |
| 23 | + private Double score; |
| 24 | + private String imgUrl; |
| 25 | + private String shortDescription; |
| 26 | + private String longDescription; |
| 27 | + |
| 28 | + public Game() { |
| 29 | + } |
| 30 | + |
| 31 | + public Game(Long id, String title, Integer year, String gender, String platforms, Double score, String imgUrl, |
| 32 | + String shortDescription, String longDescription) { |
| 33 | + this.id = id; |
| 34 | + this.title = title; |
| 35 | + this.year = year; |
| 36 | + this.gender = gender; |
| 37 | + this.platforms = platforms; |
| 38 | + this.score = score; |
| 39 | + this.imgUrl = imgUrl; |
| 40 | + this.shortDescription = shortDescription; |
| 41 | + this.longDescription = longDescription; |
| 42 | + } |
| 43 | + |
| 44 | + public Long getId() { |
| 45 | + return id; |
| 46 | + } |
| 47 | + |
| 48 | + public void setId(Long id) { |
| 49 | + this.id = id; |
| 50 | + } |
| 51 | + |
| 52 | + public String getTitle() { |
| 53 | + return title; |
| 54 | + } |
| 55 | + |
| 56 | + public void setTitle(String title) { |
| 57 | + this.title = title; |
| 58 | + } |
| 59 | + |
| 60 | + public Integer getYear() { |
| 61 | + return year; |
| 62 | + } |
| 63 | + |
| 64 | + public void setYear(Integer year) { |
| 65 | + this.year = year; |
| 66 | + } |
| 67 | + |
| 68 | + public String getGender() { |
| 69 | + return gender; |
| 70 | + } |
| 71 | + |
| 72 | + public void setGender(String gender) { |
| 73 | + this.gender = gender; |
| 74 | + } |
| 75 | + |
| 76 | + public String getPlatforms() { |
| 77 | + return platforms; |
| 78 | + } |
| 79 | + |
| 80 | + public void setPlatforms(String platforms) { |
| 81 | + this.platforms = platforms; |
| 82 | + } |
| 83 | + |
| 84 | + public Double getScore() { |
| 85 | + return score; |
| 86 | + } |
| 87 | + |
| 88 | + public void setScore(Double score) { |
| 89 | + this.score = score; |
| 90 | + } |
| 91 | + |
| 92 | + public String getImgUrl() { |
| 93 | + return imgUrl; |
| 94 | + } |
| 95 | + |
| 96 | + public void setImgUrl(String imgUrl) { |
| 97 | + this.imgUrl = imgUrl; |
| 98 | + } |
| 99 | + |
| 100 | + public String getShortDescription() { |
| 101 | + return shortDescription; |
| 102 | + } |
| 103 | + |
| 104 | + public void setShortDescription(String shortDescription) { |
| 105 | + this.shortDescription = shortDescription; |
| 106 | + } |
| 107 | + |
| 108 | + public String getLongDescription() { |
| 109 | + return longDescription; |
| 110 | + } |
| 111 | + |
| 112 | + public void setLongDescription(String longDescription) { |
| 113 | + this.longDescription = longDescription; |
| 114 | + } |
| 115 | + |
| 116 | + @Override |
| 117 | + public int hashCode() { |
| 118 | + final int prime = 31; |
| 119 | + int result = 1; |
| 120 | + result = prime * result + ((id == null) ? 0 : id.hashCode()); |
| 121 | + return result; |
| 122 | + } |
| 123 | + |
| 124 | + @Override |
| 125 | + public boolean equals(Object obj) { |
| 126 | + if (this == obj) |
| 127 | + return true; |
| 128 | + if (obj == null) |
| 129 | + return false; |
| 130 | + if (getClass() != obj.getClass()) |
| 131 | + return false; |
| 132 | + Game other = (Game) obj; |
| 133 | + if (id == null) { |
| 134 | + if (other.id != null) |
| 135 | + return false; |
| 136 | + } else if (!id.equals(other.id)) |
| 137 | + return false; |
| 138 | + return true; |
| 139 | + } |
| 140 | +} |
0 commit comments