How do I get the underlying type of a proxy object in java?

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.

Leave a Comment