【Java开源代码栏目提醒】:网学会员为广大网友收集整理了,Weblog.java,希望对大家有所帮助!
package com.weblog.model;
// Writed 2006-5-25 13:30:26 by 37signals.cn
/**
* @struts.form include-all="true" extends="BaseForm"
* @hibernate.class table="weblog"
*
*/
public class Weblog extends com.weblog.model.BaseObject implements
java.io.Serializable {
//字段
private Long id;
private String name;
private String description;
// Constructors
/** 缺省构造器 */
public Weblog() {
}
/** 完整构造器 **/
public Weblog(String name, String description) {
this.name = name;
this.description = description;
}
//属性访问
/**
* *
*
* @hibernate.id generator-class="native" type="java.lang.Long" column="ID"
*
*/
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
/**
* *
*
* @hibernate.property column="NAME" length="50"
*
*/
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
/**
* *
*
* @hibernate.property column="DESCRIPTION" length="255"
*
*/
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
/**
* toString
*
* @return String
*/
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(getClass().getName()).append("@").append(
Long.toHexString(hashCode())).append(" [");
buffer.append("name").append("='").append(getName()).append("' ");
buffer.append("description").append("='").append(getDescription())
.append("' ");
buffer.append("]");
return buffer.toString();
}
public boolean equals(Object other) {
if ((this == other))
return true;
if ((other == null))
return false;
if (!(other instanceof Weblog))
return false;
Weblog castOther = (Weblog) other;
return ((this.getId() == castOther.getId()) || (this.getId() != null
&& castOther.getId() != null && this.getId().equals(
castOther.getId())))
&& ((this.getName() == castOther.getName()) || (this.getName() != null
&& castOther.getName() != null && this.getName()
.equals(castOther.getName())))
&& ((this.getDescription() == castOther.getDescription()) || (this
.getDescription() != null
&& castOther.getDescription() != null && this
.getDescription().equals(castOther.getDescription())));
}
public int hashCode() {
int result = 17;
result = 37 * result + (getId() == null ? 0 : this.getId().hashCode());
result = 37 * result
+ (getName() == null ? 0 : this.getName().hashCode());
result = 37
* result
+ (getDescription() == null ? 0 : this.getDescription()
.hashCode());
return result;
}
}
上一篇:
WebExceptionUtils.java
下一篇:
市政公用事业管理体制创新问题研究