cglibproxyfactory.java

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

JAVA
49
字号
//$Id: CGLIBProxyFactory.java,v 1.1.2.1 2004/01/27 07:35:06 oneovthafew Exp $
package net.sf.hibernate.proxy;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Set;

import net.sf.cglib.proxy.Factory;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.engine.SessionImplementor;

/**
 * @author Gavin King
 */
public class CGLIBProxyFactory implements ProxyFactory {
	
	protected static final Class[] NO_CLASSES = new Class[0];
	
	private Class persistentClass;
	private Class[] interfaces;
	private Method getIdentifierMethod;
	private Method setIdentifierMethod;
	private Factory factory;
	
	public void postInstantiate(
		Class persistentClass,
		Set interfaces,
		Method getIdentifierMethod,
		Method setIdentifierMethod)
		throws HibernateException {
		
		this.persistentClass = persistentClass;
		this.interfaces = (Class[]) interfaces.toArray(NO_CLASSES);
		this.getIdentifierMethod = getIdentifierMethod;
		this.setIdentifierMethod = setIdentifierMethod;
		factory = CGLIBLazyInitializer.getProxyFactory(persistentClass, this.interfaces);

	}

	public HibernateProxy getProxy(Serializable id, SessionImplementor session)
		throws HibernateException {
		
		return CGLIBLazyInitializer.getProxy(
			factory, persistentClass, interfaces, getIdentifierMethod, setIdentifierMethod, id, session
		);
	}

}

⌨️ 快捷键说明

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