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 + -
显示快捷键?