1
0
mirror of synced 2026-08-03 16:56:56 +00:00

SEC-2194: Add Java Config samples

This commit is contained in:
Rob Winch
2013-08-01 14:14:18 -05:00
parent 36418b964d
commit 388a4dd9db
435 changed files with 71210 additions and 51 deletions
@@ -0,0 +1,32 @@
package bigbank;
import java.util.HashMap;
import java.util.Map;
public class BankDaoStub implements BankDao {
private long id = 0;
private final Map<Long, Account> accounts = new HashMap<Long, Account>();
public void createOrUpdateAccount(Account account) {
if (account.getId() == -1) {
id++;
account.setId(id);
}
accounts.put(new Long(account.getId()), account);
System.out.println("SAVE: " + account);
}
public Account[] findAccounts() {
Account[] accounts = this.accounts.values().toArray(new Account[] {});
System.out.println("Returning " + accounts.length + " account(s):");
for (Account account : accounts) {
System.out.println(" > " + account);
}
return accounts;
}
public Account readAccount(Long id) {
return accounts.get(id);
}
}