views:

29

answers:

1

Given:

Object innerProxy = ...
Object proxy = java.lang.reflect.Proxy.
                newProxyInstance(Thread.currentThread().getContextClassLoader(),
                                 new Class[]{type},
                                 innerProxy);

How can I extract the innerProxy object from proxy?

+3  A: 

You can use Proxy.getInvocationHandler():

InvocationHandler innerProxy = Proxy.getInvocationHandler(proxy);
axtavt