java.lang.reflect.Proxy

Discussion in 'Java' started by Ovidiu, Aug 10, 2004.

  1. Ovidiu

    Ovidiu Guest

    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,
    Ovidiu, Aug 10, 2004
    #1
    1. Advertising

  2. 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
    John C. Bollinger, Aug 10, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. snatchitup
    Replies:
    3
    Views:
    1,923
    Larry A. Barowski
    Dec 4, 2003
  2. David C. Partridge
    Replies:
    1
    Views:
    3,252
    Chris Smith
    Apr 13, 2004
  3. Nikita A. Visnevski

    Problem with java.lang.reflect.Proxy

    Nikita A. Visnevski, Apr 22, 2004, in forum: Java
    Replies:
    1
    Views:
    1,744
    Nikita A. Visnevski
    Apr 22, 2004
  4. ualex
    Replies:
    2
    Views:
    920
    Mandar Amdekar
    Jan 2, 2006
  5. Karsten Wutzke
    Replies:
    1
    Views:
    871
    Steven Simpson
    Aug 20, 2007
Loading...

Share This Page