how would I archieve AspectJ CFLOW like behaviour? My guess would be adding both roles into a team and work with a team field. Is there a more elegant way of doing this?
That's funny, just today I implemented a team that does
exactly, what in AspectJ you would use a cflow for.
Assuming the two triggers are in different classes it is as easy as:
team class Outer {
protected team class Interceptor1 playedBy Base1 {
trigger1 <- replace baseMethod1;
callin void trigger1() {
within (this)
base.trigger1();
}
protected class Interceptor2 playedBy Base2 {
targetMethod <- before baseMethod2;
}
}
}
...
new Outer().activate();
The key here is that the nested team Interceptor1 is not active
by default but only while trigger1() is being executed.
I think everything is nicely kept local in one spot.
Would this work for your use cases?
best
Stephan
PS: I should definitely put this into the wiki.
Thanks for bringing this up.