📄 key.java
字号:
//$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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -