1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.datatype;
17
18 import java.util.Vector;
19
20 /***
21 * Represents a postal address. Essentially holds a simple set of AddressLines,
22 * but can be adorned with an optional useType attribute and sortcode. The
23 * useType attribute is used to describe the type of the address in
24 * freeform text. Examples are "headquarters", "billing department", etc.
25 * The sortCode values are not significant, but can be used by user-interfaces
26 * that present contact information in some ordered fashion, thereby using the
27 * sortCode values.
28 *
29 * @author Steve Viens (sviens@apache.org)
30 */
31 public class Address implements RegistryObject
32 {
33 String useType;
34 String sortCode;
35 String tModelKey;
36 Vector addressLineVector;
37
38 /***
39 * Constructs a new Address with no address-lines and no useType or sortCode
40 * attribute.
41 */
42 public Address()
43 {
44 }
45
46 /***
47 * Constructs a new Address with no address-lines, but with the given useType
48 * and sortCode attributes.
49 *
50 * @param type The usetype of the new address, or null if the address
51 * doesn't have a usetype.
52 * @param sort The sortcode of the new address, or null if the address
53 * doesn't have a sortcode.
54 */
55 public Address(String type,String sort)
56 {
57 this.useType = type;
58 this.sortCode = sort;
59 }
60
61 /***
62 * Sets the usetype of this address to the given usetype. If the new usetype
63 * is null, this address doesn't have a usetype anymore.
64 *
65 * @param type The new usetype of this address, or null if the address
66 * doesn't have an usetype anymore.
67 */
68 public void setUseType(String type)
69 {
70 this.useType = type;
71 }
72
73 /***
74 * Returns the usetype of this address.
75 *
76 * @return The usetype of this address, or null if this address doesn't have
77 * an usetype.
78 */
79 public String getUseType()
80 {
81 return this.useType;
82 }
83
84 /***
85 * Sets the sortcode of this address to the given sortcode. If the new
86 * sortcode is null, this address doesn't have a sortcode anymore.
87 *
88 * @param sort The new sortcode of this address, or null if the address
89 * doesn't have a sortcode anymore.
90 */
91 public void setSortCode(String sort)
92 {
93 this.sortCode = sort;
94 }
95
96 /***
97 * Returns the sortcode of this address.
98 *
99 * @return The sortcode of this address, or null if the address doesn't
100 * have a sortcode.
101 */
102 public String getSortCode()
103 {
104 return this.sortCode;
105 }
106
107 /***
108 * Sets the key of this tModel to the given key.
109 *
110 * @param key The new key of this tModel.
111 */
112 public void setTModelKey(String key)
113 {
114 this.tModelKey = key;
115 }
116
117 /***
118 * Returns the String of this Address.
119 *
120 * @return The key of this tModel.
121 */
122 public String getTModelKey()
123 {
124 return this.tModelKey;
125 }
126
127 /***
128 * Add a new addressline to this address. The addressline is added at the
129 * end of the already existing set of addresslines.
130 *
131 * @param line The addressline to be added to this address.
132 */
133 public void addAddressLine(AddressLine line)
134 {
135 if (this.addressLineVector == null)
136 this.addressLineVector = new Vector();
137 this.addressLineVector.add(line);
138 }
139
140 /***
141 * Add a collection of new addresslines to this address. The new
142 * addresslines are added at the end of the set of the already existing
143 * addresslines.
144 *
145 * @param lines The collection of addresslines to add.
146 */
147 public void setAddressLineVector(Vector lines)
148 {
149 if (this.addressLineVector == null)
150 this.addressLineVector = new Vector();
151 this.addressLineVector = lines;
152 }
153
154 /***
155 * Returns the addresslines of this address.
156 *
157 * @return The addresslines of this address. If this address doesn't have
158 * any addresslines, an empty enumeration of addresslines is returned.
159 */
160 public Vector getAddressLineVector()
161 {
162 return this.addressLineVector;
163 }
164 }