KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ojb > otm > Person


1 package org.apache.ojb.otm;
2
3 /* Copyright 2002-2005 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 import java.util.ArrayList JavaDoc;
19 import java.io.Serializable JavaDoc;
20
21 public class Person implements Serializable JavaDoc
22 {
23
24     private int id;
25     private String JavaDoc firstname;
26     private String JavaDoc lastname;
27     private Integer JavaDoc mainAddressId;
28     private Address mainAddress;
29     private ArrayList JavaDoc otherAddresses;
30
31     public Person()
32     {
33     }
34
35     public Person(String JavaDoc firstname, String JavaDoc 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 JavaDoc getFirstname()
52     {
53         return firstname;
54     }
55
56     public void setFirstname(String JavaDoc firstname)
57     {
58         this.firstname = firstname;
59     }
60
61     public String JavaDoc getLastname()
62     {
63         return lastname;
64     }
65
66     public void setLastname(String JavaDoc lastname)
67     {
68         this.lastname = lastname;
69     }
70
71     public Integer JavaDoc getMainAddressId()
72     {
73         return mainAddressId;
74     }
75
76     public void setMainAddressId(Integer JavaDoc 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 JavaDoc getOtherAddresses()
92     {
93         return otherAddresses;
94     }
95
96     public void setOtherAddresses(ArrayList JavaDoc otherAddresses)
97     {
98         this.otherAddresses = otherAddresses;
99     }
100
101     public void addOtherAddress(String JavaDoc desc, Address address)
102     {
103         if (otherAddresses == null)
104         {
105             otherAddresses = new ArrayList JavaDoc();
106         }
107         AddressDesc addrDesc = new AddressDesc(desc, address);
108         this.otherAddresses.add(addrDesc);
109         addrDesc.setPerson(this);
110     }
111
112 }
113
Popular Tags