Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 983
ripper234 Avatar asked Apr 06 '10 10:04

ripper234


1 Answers

You can use Proxy.getInvocationHandler():

InvocationHandler innerProxy = Proxy.getInvocationHandler(proxy);
like image 93
axtavt Avatar answered Oct 03 '22 07:10

axtavt