Home

 

Customer class

This class handles the data and processes the logic of the customer entity in the ITSO Bank application. A customer can have many accounts, therefore it handles the relationship with the Account class. Example | 3 shows some of the relevant Java source code in simplified format of the Customer class.

Example 8-3 Customer class

package itso.rad75.bank.model;
public class Customer {
	public Customer(String ssn, String title, String firstName, 
					String lastName) {
		this.setSsn(ssn);
		this.setTitle(title);
		this.setFirstName(firstName);
		this.setLastName(lastName);
		this.setAccounts(new ArrayList<Account>());	
	}
	public void addAccount(Account account) throws AccountAlreadyExistException 
	{
		if (!this.getAccounts().contains(account)) {
			this.getAccounts().add(account);
		......
	}	
	......
}

ibm.com/redbooks