[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] identifying a call within a method and harves t the parameter
|
i read that a year ago or so. but most of it vanished from my memory
again. thank you for reminding me.
it works now.
ciao robertj
I think this is a case for the wormhole pattern (from Ramnivas' great
book AspectJ in Action). I am guessing the reason what you have doesn't
match is because you want the args(_param) to match the withincode, but
it is being applied to the call(createValue) which has no args. AFAIK,
you cannot pick up args using withincode.
(I haven't tried this, YMMV but I think it should be close to what you
want.)
pointcut processingParam(Parameter _param):
execution (public Result Processor.process(_param));
pointcut creatingValueWhileProcessing:
call(public Value Processor.createValue()) &&
withincode(public Result Processor.process(Parameter));
pointcut wormhole(Parameter _param): cflow(processingParam(_param)) &&
creatingValueWhileProcessing();
Value around(Parameter _param): wormhole(Parameter) {
// advice code here
}
Check out Ramnivas' book www.manning.com/laddad for more on the wormhole
pattern.