开发者

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

开发者 https://www.devze.com 2022-12-26 00:31 出处:网络
Given: Obj开发者_JAVA技巧ect innerProxy = ... Object proxy = java.lang.reflect.Proxy. newProxyInstance(Thread.currentThread().getContextClassLoader(),

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

精彩评论

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