Commit 5db3fc88 authored by Oskars's avatar Oskars
Browse files

Add: set and get methods to Post class

parent 9bae22b4
......@@ -34,6 +34,10 @@ public class Post {
this.postType = (postType !=null)? postType : PostType.PRIVATE;
}
public void setLikes(int count) {
countOfLikes = (count >= 0)? count: 0;
}
//GETTERS
public String getMsg(){
return msg;
......@@ -43,6 +47,14 @@ public class Post {
return postType;
}
public LocalDate getDate() {
return date;
}
public int getLikes() {
return countOfLikes;
}
//OTHER METHODS
public String toString() {
return "PostType: " + postType + ", Message: " + msg + ", Date: " + date.toString() + ", Likes: " + countOfLikes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment