Commit 9bae22b4 authored by Oskars's avatar Oskars
Browse files

Change: added PostType class, changed Post class

parent 634cefca
......@@ -8,16 +8,21 @@ public class Post {
private String msg;
private LocalDate date;
private int countOfLikes;
private PostType postType;
//CONSTRUCTORS
public Post(){
msg = "Empty";
date = LocalDate.now();
countOfLikes = 0;
postType= PostType.PRIVATE;
}
public Post(String msg) {
public Post(String msg, PostType postType) {
this.msg = (msg != null) ? msg : "";
this.postType = (postType != null)? postType : PostType.PRIVATE;
date = LocalDate.now();
countOfLikes = 0;
}
//SETTERS
......@@ -25,14 +30,22 @@ public class Post {
this.msg = (msg != null)? msg : "";
}
public void setPostType(PostType postType) {
this.postType = (postType !=null)? postType : PostType.PRIVATE;
}
//GETTERS
public String getMsg(){
return msg;
}
public PostType getPostType() {
return postType;
}
//OTHER METHODS
public String toString() {
return "Message: " + msg + ", Date: " + date.toString() + ", Likes: " + countOfLikes;
return "PostType: " + postType + ", Message: " + msg + ", Date: " + date.toString() + ", Likes: " + countOfLikes;
}
}
package model;
public enum PostType {
PRIVATE,
PUBLIC
}
package model.users;
public class PostType {
enum Access{
PRIVATE,
PUBLIC
}
}
......@@ -62,4 +62,6 @@ public class PrivateUser extends User {
}
}
}
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