本文整理汇总了Java中net.sf.cglib.proxy.Factory.newInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Factory.newInstance方法的具体用法?Java Factory.newInstance怎么用?Java Factory.newInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.cglib.proxy.Factory
的用法示例。
在下文中一共展示了Factory.newInstance方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProxy
import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
public static HibernateProxy getProxy(
final Factory factory,
final Class persistentClass,
final Class[] interfaces,
final Method getIdentifierMethod,
final Method setIdentifierMethod,
final Serializable id,
final SessionImplementor session)
throws HibernateException {
final CGLIBLazyInitializer instance = new CGLIBLazyInitializer(
persistentClass, interfaces, id, getIdentifierMethod, setIdentifierMethod, session
);
final HibernateProxy proxy = (HibernateProxy) factory.newInstance(instance);
instance.constructed = true;
return proxy;
}
示例2: proxifyBean
import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T> T proxifyBean(T bean) throws IllegalAccessException, InstantiationException {
if (!isEnhanceable(bean.getClass())) {
return bean;
}
Factory factory = getFactory(bean.getClass());
Callback[] callbacks = getCallbacks(bean);
T newInstance = (T) factory.newInstance(callbacks);
ExceptionMethodInterceptor exceptionCallback = (ExceptionMethodInterceptor) callbacks[1];
// By default the ExceptionMethodInterceptor is not active to allow calling setters in class constructor
// After class instance creation it should be immediately activated
exceptionCallback.setActive(true);
return newInstance;
}
示例3: createUsingFactory
import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
protected <T extends InteractionAwareFixture> T createUsingFactory(Callback callback, Factory factory, Class<?>[] constructorTypes, Object[] constructorArgs) {
Callback[] callbacks = new Callback[] { callback };
T result;
if (constructorArgs != null && constructorArgs.length > 0) {
result = (T) factory.newInstance(constructorTypes, constructorArgs, callbacks);
} else {
result = (T) factory.newInstance(callbacks);
}
return result;
}
示例4: newInstance
import net.sf.cglib.proxy.Factory; //导入方法依赖的package包/类
static JedisWrapperDoNotUse newInstance(final Factory factory, final Jedis realJedis) {
return (JedisWrapperDoNotUse) factory.newInstance(new JedisWrapperMethodInterceptor(realJedis));
}