Announcement Announcement Module
No announcement yet.
Interceptor to add argument to method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interceptor to add argument to method

    Does anyone know if it is possible to write a interceptor can help adding argument to a method call transparently?

    e.g. xxxMethod(Arg 1)

    finally return, it is

    xxxMethod(Arg 1, Arg 2)

    Anyone can give me some hints?

    Thanks a million! :oops:

  • #2
    You can redirect a method call from one method to another, returning the value of the target method. So you could redirect from foo(String) to foo(String, int). However, the foo(String, int) method must exist - a MethodInterceptor wll not allow you to add new methods to an object.

    You can make an object implement additional methods defined on a interface using introductions. See section for more info on introductions.