Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] syntax for combining two @AfterReturning

Hi

I have several point cuts , like so
 
@AfterReturning(
            pointcut = "execution(public   * func1( .. ))  " +    " && args(id)   " ,         returning="name")
    public void provideAdviseUponExecutionOfF1 ( int id , JoinPoint jp, String name) {
            print  //  employeeid is  id, and employeename is name
}
       
@AfterReturning(
            pointcut = "execution(public   * func2( .. ))  " +    " && args(id)   " ,            returning="name")
    public void provideAdviseUponExecutionOfF2 ( int id , JoinPoint jp, String name) {
            print //  department ID  is  id, and departmentname is name
}

What I want is :

@AfterReturning(  either of the above )  {

   if ( jp.getSignature().getName())   equals func2    then print  //  department is  id, and departmentname is name

   else print      //  employeeid is  id, and employeename is name

}

I cannot replace the function names func1 and func2 by *, since I have got many methods and I don't want to intercept every method. That is, wildcarding the function names will not work .

What is the syntax for combining pointcuts ?

Thank You.

Back to the top