I’d like to access the classname of the underlying class which is an instance of java.lang.reflect.Proxy
.
Is this possible?
Advertisement
Answer
You can get the InvocationHandler
with which the proxy was created, by calling Proxy.getInvocationHandler(proxy)
Note that in the case of java.lang.reflect.Proxy
there is no underlying class per se. The proxy is defined by:
- interface(s)
- invocation handler
And the wrapped class is usually passed to the concrete invocation handler.