-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost.java
More file actions
31 lines (27 loc) · 857 Bytes
/
Copy pathPost.java
File metadata and controls
31 lines (27 loc) · 857 Bytes
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
import java.io.Serializable;
/** Implementation of a post made by user. */
public class Post implements Serializable {
private int globalPostId;
private Account poster;
private String content;
/** Get the account that made the post. */
public Account getPoster() {
return this.poster;
}
/**
* Constructor
*
* @param globalPostId
* @param poster Account of user that made the post.
* @param content Content of post.
*/
public Post(int globalPostId, Account poster, String content) {
this.globalPostId = globalPostId;
this.poster = poster;
this.content = content;
}
/** Get string represantion of post to display to user. */
public String render() {
return "{" + this.poster.getName() + "} says:\n" + this.content + "\n";
}
}