6

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?

ripper234
  • 222,824
  • 274
  • 634
  • 905

1 Answers1

22

You can use Proxy.getInvocationHandler():

InvocationHandler innerProxy = Proxy.getInvocationHandler(proxy);
axtavt
  • 239,438
  • 41
  • 511
  • 482