@Test public void testPrivateInnerClass() { createProxy(new PrivateInnerClass()).toString(); assertEquals("toString = PrivateInnerClass", buff.toString()); }
@Override @SuppressWarnings("unchecked") public <T> T createProxy(T obj, final InvocationHandler handler) { Class<?> c = obj.getClass(); net.sf.cglib.proxy.InvocationHandler cglibHandler = new net.sf.cglib.proxy.InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return handler.invoke(proxy, method, args); } }; Class<?> proxyClass = createProxyClass(c); Factory proxy = (Factory) newInstance(c, proxyClass); proxy.setCallbacks(new Callback[] { cglibHandler, NoOp.INSTANCE }); return (T) proxy; }
CglibProxyFactory extends ProxyFactory { @Override @SuppressWarnings("unchecked") public <T> T createProxy(T obj, final InvocationHandler handler) { Class<?> c = obj.getClass(); net.sf.cglib.proxy.InvocationHandler cglibHandler = new net.sf.cglib.proxy.InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return handler.invoke(proxy, method, args); } }; Class<?> proxyClass = createProxyClass(c); Factory proxy = (Factory) newInstance(c, proxyClass); proxy.setCallbacks(new Callback[] { cglibHandler, NoOp.INSTANCE }); return (T) proxy; } }
CglibProxyFactory extends ProxyFactory { @Override @SuppressWarnings("unchecked") public <T> T createProxy(T obj, final InvocationHandler handler) { Class<?> c = obj.getClass(); net.sf.cglib.proxy.InvocationHandler cglibHandler = new net.sf.cglib.proxy.InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return handler.invoke(proxy, method, args); } }; Class<?> proxyClass = createProxyClass(c); Factory proxy = (Factory) newInstance(c, proxyClass); proxy.setCallbacks(new Callback[] { cglibHandler, NoOp.INSTANCE }); return (T) proxy; }  }
CglibProxyFactory extends ProxyFactory { @Override @SuppressWarnings("unchecked") public <T> T createProxy(T obj, final InvocationHandler handler) { Class<?> c = obj.getClass(); net.sf.cglib.proxy.InvocationHandler cglibHandler = new net.sf.cglib.proxy.InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return handler.invoke(proxy, method, args); } }; Class<?> proxyClass = createProxyClass(c); Factory proxy = (Factory) newInstance(c, proxyClass); proxy.setCallbacks(new Callback[] { cglibHandler, NoOp.INSTANCE }); return (T) proxy; }  ObjectCreator getObjectCreator(); void setUseObjenesis(boolean useObjenesis); @Override @SuppressWarnings("unchecked") T createProxy(T obj, final InvocationHandler handler); }
CglibProxyFactory extends ProxyFactory { @Override @SuppressWarnings("unchecked") public <T> T createProxy(T obj, final InvocationHandler handler) { Class<?> c = obj.getClass(); net.sf.cglib.proxy.InvocationHandler cglibHandler = new net.sf.cglib.proxy.InvocationHandler() { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return handler.invoke(proxy, method, args); } }; Class<?> proxyClass = createProxyClass(c); Factory proxy = (Factory) newInstance(c, proxyClass); proxy.setCallbacks(new Callback[] { cglibHandler, NoOp.INSTANCE }); return (T) proxy; }  ObjectCreator getObjectCreator(); void setUseObjenesis(boolean useObjenesis); @Override @SuppressWarnings("unchecked") T createProxy(T obj, final InvocationHandler handler);  }