private Object newProxy(final Object handle, final InvocationHandler invocationHandler) { ClassLoader loader = handle.getClass().getClassLoader(); if (loader == null) { loader = ClassLoader.getSystemClassLoader(); } if (!Proxy.isProxyClass(handle.getClass())) { final Object proxy = LocalBeanProxyFactory.Unsafe.allocateInstance(getProxy(handle.getClass(), loader)); DynamicSubclass.setHandler(proxy, invocationHandler); return proxy; } return Proxy.newProxyInstance(loader, handle.getClass().getInterfaces(), invocationHandler); }
private Object newProxy(final Object handle, final InvocationHandler invocationHandler) { ClassLoader loader = handle.getClass().getClassLoader(); if (loader == null) { loader = ClassLoader.getSystemClassLoader(); } if (!Proxy.isProxyClass(handle.getClass())) { final Object proxy = LocalBeanProxyFactory.Unsafe.allocateInstance(getProxy(handle.getClass(), loader)); DynamicSubclass.setHandler(proxy, invocationHandler); return proxy; } return Proxy.newProxyInstance(loader, getAPi(handle.getClass()), invocationHandler); }
public static Object constructProxy(final Class clazz, final InvocationHandler handler) throws IllegalStateException { final Object instance = Unsafe.allocateInstance(clazz); Unsafe.setValue(getDeclaredField(clazz, BUSSINESS_HANDLER_NAME), instance, handler); Unsafe.setValue(getDeclaredField(clazz, NON_BUSINESS_HANDLER_NAME), instance, NON_BUSINESS_HANDLER); return instance; }
public static Object constructProxy(final Class clazz, final InvocationHandler handler) throws IllegalStateException { final Object instance = Unsafe.allocateInstance(clazz); Unsafe.setValue(getDeclaredField(clazz, BUSSINESS_HANDLER_NAME), instance, handler); Unsafe.setValue(getDeclaredField(clazz, NON_BUSINESS_HANDLER_NAME), instance, NON_BUSINESS_HANDLER); return instance; }