Announcement Announcement Module
No announcement yet.
Add parameter to proxied method Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add parameter to proxied method

    I'm currently proxying a class method using Spring AOP, using around advice. I'm wondering if it is possible to have the proxy method contain an extra parameter which isn't passed to the proxied method.

    For example, I have a class called com.test.MyClass. Inside, there is one public method called doStuff(*) which is proxied. I'd like to be able to expose a proxy method with the signature doStuff(*, String) (containing an additional parameter of type String), where all parameters but the last are passed to the proxied method. The reason for this is that I'd like to use the last parameter as part of the aspect logic without having to redo the signatures and calls the existing doStuff() method.

    Normally, one wouldn't care about this, as the method being proxied could just be refactored. However, the doStuff() method doesn't care about this aspected functionality at all (hence why I'm using AOP), and because this method is used by Java and as an exposed method through DWR (an ajax implementation) I'd really like to not change it.

    I haven't read anything I could find through google or this forum to indicate that adding parameters to a proxy is possible, but I figure if anyone would know, they might be reading here.

    Anyone have any ideas about how to implement this in a way which doesn't require the proxied method to be refactored?


  • #2
    Take a look at introductions.