java.lang.reflect.Proxy

O

Ovidiu

Hello,

The proxy class is relatively flexible and straightforward to use, but
there are some distinct limitations on its use for method interposing. One
limitation is that the method must be called through an instance of the
proxy class. So nested methods calls, for instance, would not be
intercepted. Another limitation is that the method must have been defined in
an Interface that is implemented by the object being proxied. It can not be
called through an instance of a class that does not implement an interface.
Do you have an answer for this problem?

Regards,
 
J

John C. Bollinger

Ovidiu said:
The proxy class is relatively flexible and straightforward to use, but
there are some distinct limitations on its use for method interposing. One
limitation is that the method must be called through an instance of the
proxy class. So nested methods calls, for instance, would not be
intercepted. Another limitation is that the method must have been defined in
an Interface that is implemented by the object being proxied. It can not be
called through an instance of a class that does not implement an interface.
Do you have an answer for this problem?

The Proxy class is not intended for what you want to use it for. If you
are not satisfied with its limitations then you need to find something
else. Try AspectJ instead. (http://eclipse.org/aspectj/) [Beware:
this may be considerably larger than you want to deal with.]
Alternatively, write your own wrappers by hand, perhaps with the help of
a good IDE to reduce the drudgery.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top