-
Notifications
You must be signed in to change notification settings - Fork 359
/
Copy pathPost.java
64 lines (51 loc) · 1.49 KB
/
Post.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
package com.openshift.fordevelopers;
import java.util.Date;
import java.util.Objects;
import io.quarkus.mongodb.panache.MongoEntity;
import io.quarkus.mongodb.panache.PanacheMongoEntity;
import io.quarkus.runtime.annotations.RegisterForReflection;
@RegisterForReflection
@MongoEntity(collection = "Posts")
public class Post extends PanacheMongoEntity {
private String title;
private String content;
private long timestamp;
public Post() {
}
public Post(String title, String content) {
this.title = title;
this.content = content;
this.timestamp = new Date().getTime();
}
public String getTitle() {
return title;
}
public String getContent() {
return content;
}
public Long getTimestamp() {
return timestamp;
}
public void setTitle(String title) {
this.title = title;
}
public void setContent(String content) {
this.content = content;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Post)) {
return false;
}
Post other = (Post) obj;
return Objects.equals(this.title, other.title) && Objects.equals(this.content, other.content)
&& Objects.equals(this.timestamp, other.timestamp);
}
@Override
public int hashCode() {
return Objects.hash(this.title, this.content, this.timestamp);
}
}