Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Execution and Call pointcuts

Hi Everyone,

I want to pick out a join point that includes a call to an operation from 
within another operation. The "withincode" join point works fine by itself, 
but once I add the "call" statement it no longer works. What am I doing wrong?

public privileged aspect MoneyTransferAspect {

pointcut withdrawBefore(MoneyTransfer s, String acc):
   withincode(public void MoneyTransfer.transfer(String)) &&
      call(public void AccountManager.withdraw(String)) &&
         target(s) && args(acc);

before (MoneyTransfer s, String acc): withdrawBefore(s,acc) {

     try {

            System.out.println("before" + acc);
        } catch( Exception e ) { e.printStackTrace(); }
    }
}

public class MoneyTransfer {

   AccountManager accMngr=new AccountManager();

 public void transfer (String acc)
   {
      accMngr.withdraw(acc);
      System.out.println( "MTS: " + acc );
   }
}



Back to the top