View Javadoc
1   package ejava.examples.ejbsessionbank.bo;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.Collection;
6   
7   public class Owner implements Serializable {
8   	private static final long serialVersionUID = 1L;
9   	private long id;
10      private String firstName;
11      private String lastName;
12      private String ssn;
13      private Collection<Account> accounts = new ArrayList<Account>();
14  
15      public Owner() {}
16      public Owner(long id) {
17          this.id = id;
18      }
19      public Owner(long id, String firstName, String lastName) {
20          this(id);
21          this.firstName = firstName;
22          this.lastName = lastName;
23      }
24      
25      public long getId() {
26          return id;
27      }
28      protected void setId(long id) {
29          this.id = id;
30      }
31      public String getFirstName() {
32          return firstName;
33      }
34      public void setFirstName(String firstName) {
35          this.firstName = firstName;
36      }
37      public String getLastName() {
38          return lastName;
39      }
40      public void setLastName(String lastName) {
41          this.lastName = lastName;
42      }
43      public String getSsn() {
44          return ssn;
45      }
46      public void setSsn(String ssn) {
47          this.ssn = ssn;
48      }
49      public Collection<Account> getAccounts() {
50          return accounts;
51      }
52      public void setAccounts(Collection<Account> accounts) {
53          this.accounts = accounts;
54      }
55     
56      public String toString() {
57          StringBuilder text = new StringBuilder();
58          text.append("id=" + id);
59          text.append(", " + firstName + " " + lastName);
60          text.append(", ssn=" + ssn);
61          text.append(", accounts("+ accounts.size() + ")={");
62          for(Account a : accounts) {
63              text.append(a + ", ");
64          }
65          text.append("}");
66          return text.toString();
67      }
68  }