1 |
package com.instantiations.example.customer; |
2 |
|
3 |
import com.instantiations.example.account.*; |
4 |
import java.util.*; |
5 |
|
6 |
/** |
7 |
* The class <code>Customer</code> exists for two purposes. The first is to |
8 |
* define an object that can be created in a factory class. The second is to |
9 |
* create a cyclic dependency between the <code>customer</code> and |
10 |
* <code>account</code> projects. |
11 |
* @author Brad Billings |
12 |
*/ |
13 |
public class Customer |
14 |
{ |
15 |
private String name; |
16 |
|
17 |
private String zip; |
18 |
|
19 |
private ArrayList accounts = new ArrayList(); |
20 |
|
21 |
public Customer(String name, String zip) |
22 |
{ |
23 |
this.name = name; |
24 |
this.zip = zip; |
25 |
} |
26 |
|
27 |
public String getName() |
28 |
{ |
29 |
return name; |
30 |
} |
31 |
|
32 |
public String getZip() |
33 |
{ |
34 |
return zip; |
35 |
} |
36 |
|
37 |
public void addAccount(Account account) |
38 |
{ |
39 |
accounts.add(account); |
40 |
} |
41 |
|
42 |
public Account[] getAccounts() |
43 |
{ |
44 |
return (Account[]) accounts.toArray(new Account[accounts.size()]); |
45 |
} |
46 |
} |