Now, we have to model the domain related to the application. In this case, we are going to implement a blog in which two classes are involved:
We create both classes with the POJO approach in org.romulus.blog.domain package.
public class Post {
private Date postedOn;
private String title;
private String content;
private ArrayList<Comment> comments = new ArrayList<Comment>();
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getPostedOn() {
return postedOn;
}
public void setPostedOn(Date postedOn) {
this.postedOn = postedOn;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public ArrayList<Comment> getComments() {
return comments;
}
public void setComments(ArrayList<Comment> comments) {
this.comments = comments;
}
}
public class Comment {
private String text;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
0 Ficheros adjuntos