guava 动态代理

JDK:

    Foo foo = (Foo) Proxy.newProxyInstance(
    Foo.class.getClassLoader(),
    new Class<?>[] {Foo.class},
    invocationHandler);

 

Guava 简化操作(其实使用的还是JDK自带的动态代理方式):

 

Foo foo = Reflection.newProxy(Foo.class, invocationHandler);

 

你可能感兴趣的:(guava)