开发者

How can I get the invocation handler for a Java proxy?

Given:

Obj开发者_JAVA技巧ect innerProxy = ...
Object proxy = java.lang.reflect.Proxy.
                newProxyInstance(Thread.currentThread().getContextClassLoader(),
                                 new Class[]{type},
                                 innerProxy);

How can I extract the innerProxy object from proxy?


You can use Proxy.getInvocationHandler():

InvocationHandler innerProxy = Proxy.getInvocationHandler(proxy);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜