I think this problem could be "partially" solved with the use of CLIB instead of Dynamic Proxies : since the target class will be subclassed, calls to this() will first cause the overriden method to execute, thus allowing the AOP mechanism to work.
Unfortunately this is not possible. CGLIB proxies must delegate to the target object as it's not possible to add behaviour to an existing object. e.g.
Code:
class AdvisedFoo extends Foo {
Foo target;
void fooBar() {
// do before advice
// do around advice
target.fooBar();
// do after advice
}
}
As you can see CGLIB is really no help at all and Andreas solution is looking pretty nice.
Ollie