JDK:
Foo foo = (Foo) Proxy.newProxyInstance(
Foo.class.getClassLoader(),
new Class<?>[] {Foo.class},
invocationHandler);
Guava 简化操作(其实使用的还是JDK自带的动态代理方式):
Foo foo = Reflection.newProxy(Foo.class, invocationHandler);
JDK:
Foo foo = (Foo) Proxy.newProxyInstance(
Foo.class.getClassLoader(),
new Class<?>[] {Foo.class},
invocationHandler);
Guava 简化操作(其实使用的还是JDK自带的动态代理方式):
Foo foo = Reflection.newProxy(Foo.class, invocationHandler);