[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] capturing a tricky joinpoint
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
harikishore.tadigotla@xxxxxxxxxxx wrote:
> Eric,
> In that case can you please point me to some links to
> stateful aspects? thanks
Hmmm... I don't know any publications that would be of much value
here. There are great theoretical works by Douence et al. (see
http://portal.acm.org/citation.cfm?id=976288). However in AspectJ I
think that would rather recude to a pattern: You need...
- - a state variable in the aspect
- - transitions in the form of advice that change this state
The aspect then reflects basically a finite state machine matching an
input "string" of joinpoints.
aspect MatchesAB {
static int state = 0;
after(): if(state==0) && call(Foo.a()) {
state = 1;
}
after(): if(state==1) && call(Foo.b()) {
state = 2;
}
after(int newVal): set(MatchesAB.state) && args(newVal) {
if(newVal==2) {//if "final state"
//do whatever to do
}
}
}
It gets more complicated if you want to match on non-static states (I
mean with exposed objects), because in that case you might want to
associate the state with certain objects.
Hope that helps.
Eric
- --
Eric Bodden
Chair I2 for Programming Languages and Program Analysis
RWTH Aachen University
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3
iQA/AwUBQlHLwMwiFCm7RlWCEQIYgwCfb/bqMahHGORRkP38kf89u+959osAoIrA
RIhe5nk1bX4ocr3uRbPW/l8k
=FRQl
-----END PGP SIGNATURE-----