-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost.java
More file actions
49 lines (40 loc) · 1.16 KB
/
Post.java
File metadata and controls
49 lines (40 loc) · 1.16 KB
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
import java.time.LocalDateTime;
public class Post {
private String postId;
private String userId;
private String content;
private LocalDateTime timestamp;
public Post(String postId, String userId, String content) {
this.postId = postId;
this.userId = userId;
this.content = content;
this.timestamp = LocalDateTime.now();
}
public Post(String postId, String userId, String content, LocalDateTime timestamp) {
this.postId = postId;
this.userId = userId;
this.content = content;
this.timestamp = timestamp;
}
public String getPostId() {
return postId;
}
public String getUserId() {
return userId;
}
public String getContent() {
return content;
}
public LocalDateTime getTimestamp() {
return timestamp;
}
@Override
public String toString() {
return "Post{" +
"postId='" + postId + '\'' +
", userId='" + userId + '\'' +
", content='" + content + '\'' +
", timestamp=" + timestamp +
'}';
}
}