Package org.example.model
Class Post
java.lang.Object
org.example.model.Post
Represents a social network post entity.
Contains information about the author, content, likes, and timestamps.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetId()intgetLikes()booleanisEdited()Helper method to check if the post was edited.booleanvoidvoidsetContent(String content) voidsetCreatedAt(LocalDateTime createdAt) voidsetId(int id) voidsetLikedByMe(boolean likedByMe) voidsetLikes(int likes) voidsetUpdatedAt(LocalDateTime updatedAt)
-
Constructor Details
-
Post
public Post()Default constructor for frameworks or manual initialization. -
Post
Constructor for creating a new post with minimal required data.- Parameters:
author- Nickname of the creator.content- Text content of the post.
-
-
Method Details
-
getId
public int getId() -
setId
public void setId(int id) -
getAuthor
-
setAuthor
-
getContent
-
setContent
-
getLikes
public int getLikes() -
setLikes
public void setLikes(int likes) -
isLikedByMe
public boolean isLikedByMe() -
setLikedByMe
public void setLikedByMe(boolean likedByMe) -
getCreatedAt
-
setCreatedAt
-
getUpdatedAt
-
setUpdatedAt
-
isEdited
public boolean isEdited()Helper method to check if the post was edited.- Returns:
- true if updated_at is different from created_at.
-