1 package org.apache.ojb.otm; 2 3 17 18 import java.util.ArrayList ; 19 import java.io.Serializable ; 20 21 public class Person implements Serializable 22 { 23 24 private int id; 25 private String firstname; 26 private String lastname; 27 private Integer mainAddressId; 28 private Address mainAddress; 29 private ArrayList otherAddresses; 30 31 public Person() 32 { 33 } 34 35 public Person(String firstname, String lastname) 36 { 37 this.firstname = firstname; 38 this.lastname = lastname; 39 } 40 41 public int getId() 42 { 43 return id; 44 } 45 46 public void setId(int id) 47 { 48 this.id = id; 49 } 50 51 public String getFirstname() 52 { 53 return firstname; 54 } 55 56 public void setFirstname(String firstname) 57 { 58 this.firstname = firstname; 59 } 60 61 public String getLastname() 62 { 63 return lastname; 64 } 65 66 public void setLastname(String lastname) 67 { 68 this.lastname = lastname; 69 } 70 71 public Integer getMainAddressId() 72 { 73 return mainAddressId; 74 } 75 76 public void setMainAddressId(Integer mainAddressId) 77 { 78 this.mainAddressId = mainAddressId; 79 } 80 81 public Address getMainAddress() 82 { 83 return mainAddress; 84 } 85 86 public void setMainAddress(Address mainAddress) 87 { 88 this.mainAddress = mainAddress; 89 } 90 91 public ArrayList getOtherAddresses() 92 { 93 return otherAddresses; 94 } 95 96 public void setOtherAddresses(ArrayList otherAddresses) 97 { 98 this.otherAddresses = otherAddresses; 99 } 100 101 public void addOtherAddress(String desc, Address address) 102 { 103 if (otherAddresses == null) 104 { 105 otherAddresses = new ArrayList (); 106 } 107 AddressDesc addrDesc = new AddressDesc(desc, address); 108 this.otherAddresses.add(addrDesc); 109 addrDesc.setPerson(this); 110 } 111 112 } 113 | Popular Tags |