|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttopdown.service.BankMemDB
An in-memory bank implementation.
| Field Summary | |
private static BankMemDB |
DB_INSTANCE
The bank singleton. |
private java.util.List |
m_accounts
The list of accounts managed by this bank. |
| Constructor Summary | |
private |
BankMemDB()
Creates a bank instance. |
| Method Summary | |
java.lang.String |
addNewAccount(java.lang.String name,
float initBalance)
Adds a new account. |
Account |
getAccount(java.lang.String id)
Returns the account that has the given ID. |
java.util.List |
getAccounts()
Returns a list of all account in the bank. |
static BankMemDB |
newInstance()
Provides access to the bank singleton. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static BankMemDB DB_INSTANCE
private java.util.List m_accounts
| Constructor Detail |
private BankMemDB()
| Method Detail |
public static BankMemDB newInstance()
public java.lang.String addNewAccount(java.lang.String name,
float initBalance)
throws AccountException
addNewAccount in interface Bankname - the account owner's name.initBalance - the initial balance for the account.
AccountException - if the initial balance is insufficent (<= 0).public Account getAccount(java.lang.String id)
getAccount in interface Bankid - the account ID.
public java.util.List getAccounts()
getAccounts in interface Bank
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||