Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java.lang.reflect.Proxy

Reply
Thread Tools

java.lang.reflect.Proxy

 
 
Ovidiu
Guest
Posts: n/a
 
      08-10-2004
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,


 
Reply With Quote
 
 
 
 
John C. Bollinger
Guest
Posts: n/a
 
      08-10-2004
Ovidiu wrote:

> 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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments