any.java

来自「JSP+SQL编写的人力资源管理系统」· Java 代码 · 共 55 行

JAVA
55
字号
//$Id: Any.java,v 1.3.2.1 2003/11/06 13:43:22 oneovthafew Exp $
package net.sf.hibernate.mapping;

import net.sf.hibernate.Hibernate;
import net.sf.hibernate.type.ObjectType;
import net.sf.hibernate.type.Type;

/**
 * A Hibernate "any" type (ie. polymorphic association to 
 * one-of-several tables).
 * @author Gavin King
 */
public class Any extends SimpleValue {
	
	private Type identifierType;
	private Type metaType = Hibernate.CLASS;

	public Any(Table table) {
		super(table);
	}

	/**
	 * Returns the identifier type.
	 */
	public Type getIdentifierType() {
		return identifierType;
	}

	/**
	 * Sets the identifier type.
	 */
	public void setIdentifierType(Type identifierType) {
		this.identifierType = identifierType;
	}
	
	public Type getType() {
		return new ObjectType(metaType, identifierType);
	}
	
	public void setType(Type type) {
		throw new UnsupportedOperationException("cannot set type of an Any");
	}
	
	public void setTypeByReflection(Class propertyClass, String propertyName) {}

	public Type getMetaType() {
		return metaType;
	}

	public void setMetaType(Type type) {
		metaType = type;
	}

}

⌨️ 快捷键说明

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