Methods Summary |
---|
private void | checkForNegativeAmount(Money amount)
int cents = amount.getCents();
if (0 > cents) {
throw new NegativeAmountException();
}
|
private void | checkForOverdraft(Money amount)
if (amount.greaterThan(_balance)) {
throw new OverdraftException(false);
}
return;
|
public synchronized Money | getBalance()
return _balance;
|
public synchronized void | makeDeposit(Money amount)
checkForNegativeAmount(amount);
_balance.add(amount);
return;
|
public synchronized void | makeWithdrawal(Money amount)
checkForNegativeAmount(amount);
checkForOverdraft(amount);
_balance.subtract(amount);
return;
|
public void | setFactory(LockingFactory factory)
_factory = factory;
|
public void | unreferenced()
if (null == _factory) {
return;
}
try {
_factory.serverNoLongerActive(_accountName);
} catch (RemoteException e) {/* Factory is having issues*/
}
_factory = null;
|