public class Account {
private double balance;
private boolean accountClosed = false;
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public boolean isAccountClosed() {
return accountClosed;
}
public void deposit(double amount){
this.balance +- amount;
}
}
public aspect AccountAspect {
pointcut demo(Account account, double credit) : execution(void
Account.deposit(double)) &&
target(account) &&
args(credit);
before(Account account, double credit) : demo(account, credit){
if(account.isAccountClosed()){
//i need something here to stop the deposit method from
executing.
}
}
}
Hi friends,
I have my class Account and Aspect AccountAspect as shown above. The
account class has a method called deposit. It also has an attribute called
isAccountClosed. what i need to do is, whenever the deposit method is called, i
need to check whether the account is closed and if it is closed, i need to stop
executing the code inside the depoist method. I do not know how i can get this
done in AspectJ. My main program which calls these methods is a class called
Bank.java, it just calls the methods in the Account class. I would really
appreciate it if someone could help me out here.
Thanks in advance,
Nuwan
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now.
http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users