📄 news.java
字号:
package org.yeeku.model;
import java.util.Date;
import java.util.Set;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
* @hibernate.class table="news"
* @struts.form include-all="false" extends="BaseForm"
*/
public class News extends BaseObject {
private Long id;// pk,required
private String title;// required
private String content;// required
private User poster;// fk,required
private Date postDate;// required
private Date lastModifyDate;// required
private Category category;// required
private Set newsReviews;
public News() {
}
/**
* @return Returns the newsReview.
*/
public Set getNewsReviews() {
return newsReviews;
}
/**
* @param newsReview
* The newsReview to set.
*/
public void setNewsReviews(Set newsReviews) {
this.newsReviews = newsReviews;
}
/**
* @hibernate.many-to-one column="id" not-null="true"
*/
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
/**
* @hibernate.property column="last_modify_date" not-null="true"
*/
public Date getLastModifyDate() {
return lastModifyDate;
}
public void setLastModifyDate(Date lastModifyDate) {
this.lastModifyDate = lastModifyDate;
}
/**
* @hibernate.property column="post_date" not-null="true"
*/
public Date getPostDate() {
return postDate;
}
public void setPostDate(Date postDate) {
this.postDate = postDate;
}
/**
* @hibernate.many-to-one column="username" not-null="true"
*/
public User getPoster() {
return poster;
}
public void setPoster(User poster) {
this.poster = poster;
}
/**
* @hibernate.property column="content" length="3000" not-null="true"
*/
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
/**
* @return Returns the id.
* @hibernate.id column="id" generator-class="increment"
* unsaved-value="null"
*/
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* @hibernate.property column="title" length="50" not-null="true"
*/
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/**
* @see java.lang.Object#equals(Object)
*/
public boolean equals(Object object) {
if (!(object instanceof News)) {
return false;
}
News rhs = (News) object;
return this.poster.equals(rhs.getPoster())
&& this.postDate.equals(rhs.getPostDate());
/*
* return new EqualsBuilder().append(this.newsReviews, rhs.newsReviews)
* .append(this.title, rhs.title).append(this.category,
* rhs.category).append(this.content, rhs.content).append(
* this.postDate, rhs.postDate).append( this.lastModifyDate,
* rhs.lastModifyDate).append( this.id, rhs.id).append(this.poster,
* rhs.poster) .isEquals();
*/
}
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return this.poster.hashCode() + this.postDate.hashCode();
/*
* return new HashCodeBuilder(1595611275, -1477459617).append(
* this.newsReviews).append(this.title).append(this.category)
* .append(this.content).append(this.postDate).append(
* this.lastModifyDate).append(this.id)
* .append(this.poster).toHashCode();
*/
}
/**
* @see java.lang.Object#toString()
*/
public String toString() {
return new ToStringBuilder(this).append("id", this.id).append("title",
this.title).append("postDate", this.postDate).append("content",
this.content).append("lastModifyDate", this.lastModifyDate)
.append("poster", this.poster)
.append("category", this.category).append("newsReviews",
this.newsReviews).toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -