-
Notifications
You must be signed in to change notification settings - Fork 1
/
Hero.java
113 lines (90 loc) · 1.95 KB
/
Hero.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package io.quarkus.sample.superheroes.hero;
import java.util.Objects;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.Size;
/**
* JPA entity class for a Hero. Re-used in the API layer.
*/
@Entity
public class Hero {
@Id
@GeneratedValue
private Long id;
@NotNull
@Size(min = 3, max = 50)
private String name;
private String otherName;
@NotNull
@Positive
private Integer level;
private String picture;
@Column(columnDefinition = "TEXT")
private String powers;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getOtherName() {
return this.otherName;
}
public void setOtherName(String otherName) {
this.otherName = otherName;
}
public Integer getLevel() {
return this.level;
}
public void setLevel(Integer level) {
this.level = level;
}
public String getPicture() {
return this.picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public String getPowers() {
return this.powers;
}
public void setPowers(String powers) {
this.powers = powers;
}
@Override
public String toString() {
return "Hero{" +
"id=" + this.id +
", name='" + this.name + '\'' +
", otherName='" + this.otherName + '\'' +
", level=" + this.level +
", picture='" + this.picture + '\'' +
", powers='" + this.powers + '\'' +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Hero hero = (Hero) o;
return this.id.equals(hero.id);
}
@Override
public int hashCode() {
return Objects.hash(this.id);
}
}