How can I get a call 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 innerProxy object from proxy ?

+4
source share
1 answer

You can use Proxy.getInvocationHandler() :

 InvocationHandler innerProxy = Proxy.getInvocationHandler(proxy); 
+14
source

Source: https://habr.com/ru/post/1306103/


All Articles