key.java

来自「人力资源管理系统主要包括:人员管理、招聘管理、培训管理、奖惩管理和薪金管理五大管」· Java 代码 · 共 63 行

JAVA
63
字号
//$Id: Key.java,v 1.7.2.2 2003/08/09 11:24:49 turin42 Exp $package net.sf.hibernate.engine;import java.io.Serializable;import net.sf.hibernate.AssertionFailure;import net.sf.hibernate.persister.ClassPersister;/** * A globally unique identifier of an instance. * * Consisting of the user-visible identifier and the identifier space (eg. tablename). * * @author Gavin King */public final class Key implements Serializable {	private final Serializable id;	private final Serializable identifierSpace;	private final Class clazz;		private Key(Serializable id, Serializable identifierSpace, Class clazz) {		if (id==null) throw new AssertionFailure("null identifier");		this.id=id;		this.identifierSpace = identifierSpace;		this.clazz = clazz;	}		/**	 * Construct a unique identifier for an entity class instance	 */	public Key(Serializable id, ClassPersister p) {		this( id, p.getIdentifierSpace(), p.getMappedClass() );	}		/**	 * Get the user-visible identifier	 */	public Serializable getIdentifier() {		return id;	}		public Class getMappedClass() {		return clazz;	}		public boolean equals(Object other) {		Key otherKey = (Key) other;		return otherKey.identifierSpace.equals(this.identifierSpace) && otherKey.id.equals(this.id);	}		public int hashCode() { return id.hashCode(); }		public String toString() {		return id.toString();	}}

⌨️ 快捷键说明

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