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