multiple formal parameters? [message #578460] |
Fri, 16 April 2004 10:16 |
Michael Moser Messages: 914 Registered: July 2009 |
Senior Member |
|
|
I am frustrated - I don't get it!
I want to specify an advice that has TWO parameters and I need access
to BOTH parameters in the advice.
I was able to phrase that as an "anonymous" pointcut (I think that's
the name for something like this):
....
before(IEvent evt, boolean flag): target(evt) && call(*
IEvent.setHandled(boolean)) && args(flag) {
...
}
....
But now I would like to specify this as a NAMED pointcut (1st to make
this more readable and 2nd to reuse the pointcut in more than one
advice):
I defined the pointcut:
....
pointcut eventSetHandled(IEvent evt, boolean flag): target(evt) &&
call(* IEvent.setHandled(boolean)) && args(flag);
And now I want to specify the advice. But how do I phrase this? I
tried:
before(IEvent evt, boolean flag): eventSetHandled(IEvent, boolean)
{ ... }
before(IEvent evt, boolean flag): eventSetHandled(IEvent evt,
boolean flag) { ... }
before(IEvent evt, boolean flag): eventSetHandled(evt, flag) {
.... }
???
None of the above work, i.e. all variants just yield compile errors!
How do I phrase this? What do I need to specify to get hold of more
than a single parameter of a named pointcut??? Or is this not possible
at all?
Alas, all the examples given in the AspectJ manual only show a single
parameter...
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.03941 seconds