import java.util.Date; /** * 文章实体类(MVC-模型层) */ public class Article { private String title; // 标题 private String content; // 内容 private String author; // 新增:作者 private Date publishDate; // 新增:发布日期 // 全参构造器 public Article(String title, String content, String author, Date publishDate) { this.title = title; this.content = content; this.author = author; this.publishDate = publishDate; } // 空参构造器 public Article() {} // Getter & Setter public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public Date getPublishDate() { return publishDate; } public void setPublishDate(Date publishDate) { this.publishDate = publishDate; } @Override public String toString() { return "Article{" + "title='" + title + '\'' + ", content='" + content + '\'' + ", author='" + author + '\'' + ", publishDate=" + publishDate + '}'; } }