Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] COmbining pointcuts in the same advice

Mouna,

 

You can use p2(*) or p2(Type) to use the pointcut without binding. However, if you want to use t2 in the body of your advice you need to bind it. It can be possible to use thisJoinPoint.getArgs() to get arguments, or perhaps (p2(*) || p1(*)) && args(t) if you want the single argument in either case.

 


From: aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of mouna SAHIB
Sent: Wednesday, May 03, 2006 3:16 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] COmbining pointcuts in the same advice

 

Hi all,
I have some pointcuts in my aspect:

pointcut p1(<argumentType t>): execution (...) && args(t);
after(<argumentType t>): p1(t){
//some code
}


pointcut p2(<argumentType t2>): execution (...) && args(t2);
after(<argumentType t2>): p2(t2){
//some code
}

and would rather like to do something like this:

pointcut p2 (<argumentType t2>): execution(...)&& args(t2);
after() : p2(t2) || p1(<argumentType t>){
//some code
}

but I don't kknow how to declare arguments in the pointcut and advice in this case!
If I do like above, I can't use t2 in the advice body ! What can I do it please?
Thanks for suggestion
Mouna


Back to the top