Lets say i have a Proxy to an object, can I somehow get access to the object via reflection or other technique ?
-
when you say a Proxy, you mean the pattern or some java class?Student– Student2010-09-10 12:38:24 +00:00Commented Sep 10, 2010 at 12:38
-
By proxy i mean the java class(technology) when you have a remote object and you can use it remotely via a proxy classMarek Szanyi– Marek Szanyi2010-09-10 12:43:42 +00:00Commented Sep 10, 2010 at 12:43
Add a comment
|
3 Answers
No, as a Proxy is not even itself a "true" object. From the javadoc, you can see that the only object you can easily access is the invocation handler. Once this handler is reached, it's a matter of implementation :
- you may encounter n invocation handler that keeps a reference to proxied object (as an example for kind of a decorator)
- but you can also have no other reference (as an example, when implementing the Null object pattern using proxy).
Comments
If you have a proxy to an object you can use the proxy to access the object.
proxy - An interface for a service, especially for one that is remote, resource-intensive, or otherwise difficult to use directly. (wiktionary)