⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base.java

📁 struts+hibernate在线考试系统exam
💻 JAVA
字号:
package cn.hxex.exam.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;

/**
 * The base Entity Object
 * 
 * It also generate the Base ActionForm that
 * was extends from ValidatorForm.
 * 
 * @struts.form
 *  name="baseForm"
 *  extends="org.apache.struts.validator.ValidatorForm"
 * 
 * @author galaxy
 *
 */
public class Base implements Serializable
{
	
	/**
	 * The Generated SerialVersionUID
	 */
	private static final long serialVersionUID = -2906321889142722731L;

	/**
	 * The identify of the object
	 * 
	 * @hibernate.id
	 *  generator-class="uuid.hex"
	 *  column="ID"
	 */
	protected String id;

	/**
	 * Get the ID of test paper.
	 * 
	 * @struts.form-field
	 *  form-name="baseForm"
	 * 
	 * @return ID
	 */
	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}
	
	/**
	 * Common implement equals method
	 */
	@Override
	public boolean equals( Object obj )
	{
		if( this==obj ) return true;
		
		if( !( obj instanceof Base ) )
			return false;
		
		Base target = (Base)obj;
		
		if( this.getId()!=null && this.getId().length()>0 )
		{
			return this.getId().equals( target.getId() );
		}
		
		if( target.getId()!=null && target.getId().length()>0 )
		{
			return false;
		}
		
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	/**
	 * Generate the hash code
	 */
	@Override
	public int hashCode()
	{
		if( this.getId()!=null && this.getId().length()>0 )
		{
			return this.getId().hashCode();
		}
			
		return HashCodeBuilder.reflectionHashCode(this);
	}

	/**
	 * Common implement toString method
	 */
	@Override
	public String toString()
	{
		return ReflectionToStringBuilder.toString( this );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -