View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "AD.java".  Description:
15   * "Composite class AD"
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2013.  All Rights Reserved.
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  package ca.uhn.hl7v2.model.v27.datatype;
34  
35  import ca.uhn.hl7v2.model.DataTypeException;
36  import ca.uhn.hl7v2.model.Message;
37  import ca.uhn.hl7v2.model.Type;
38  import ca.uhn.hl7v2.model.AbstractComposite;
39  
40  
41  /**
42   * <p>Represents an HL7 AD (Address) data type. 
43   * This type consists of the following components:</p>
44   * <ul>
45   * <li>Street Address (ST)
46   * <li>Other Designation (ST)
47   * <li>City (ST)
48   * <li>State or Province (ST)
49   * <li>Zip or Postal Code (ST)
50   * <li>Country (ID)
51   * <li>Address Type (ID)
52   * <li>Other Geographic Designation (ST)
53   * </ul>
54   */
55  @SuppressWarnings("unused")
56  public class AD extends AbstractComposite {
57  
58      private Type[] data;
59  
60      /** 
61       * Creates a new AD type
62       */
63      public AD(Message message) {
64          super(message);
65          init();
66      }
67  
68      private void init() {
69          data = new Type[8];    
70          data[0] = new ST(getMessage());
71          data[1] = new ST(getMessage());
72          data[2] = new ST(getMessage());
73          data[3] = new ST(getMessage());
74          data[4] = new ST(getMessage());
75          data[5] = new ID(getMessage(), 399);
76          data[6] = new ID(getMessage(), 190);
77          data[7] = new ST(getMessage());
78      }
79  
80  
81      /**
82       * Returns an array containing the data elements.
83       */
84      public Type[] getComponents() { 
85          return this.data; 
86      }
87  
88      /**
89       * Returns an individual data component.
90       *
91       * @param number The component number (0-indexed)
92       * @throws DataTypeException if the given element number is out of range.
93       */
94      public Type getComponent(int number) throws DataTypeException { 
95  
96          try { 
97              return this.data[number]; 
98          } catch (ArrayIndexOutOfBoundsException e) { 
99              throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
100         } 
101     } 
102 
103 
104     /**
105      * Returns Street Address (component 1).  This is a convenience method that saves you from 
106      * casting and handling an exception.
107      */
108     public ST getStreetAddress() {
109        return getTyped(0, ST.class);
110     }
111 
112     
113     /**
114      * Returns Street Address (component 1).  This is a convenience method that saves you from 
115      * casting and handling an exception.
116      */
117     public ST getAd1_StreetAddress() {
118        return getTyped(0, ST.class);
119     }
120 
121 
122     /**
123      * Returns Other Designation (component 2).  This is a convenience method that saves you from 
124      * casting and handling an exception.
125      */
126     public ST getOtherDesignation() {
127        return getTyped(1, ST.class);
128     }
129 
130     
131     /**
132      * Returns Other Designation (component 2).  This is a convenience method that saves you from 
133      * casting and handling an exception.
134      */
135     public ST getAd2_OtherDesignation() {
136        return getTyped(1, ST.class);
137     }
138 
139 
140     /**
141      * Returns City (component 3).  This is a convenience method that saves you from 
142      * casting and handling an exception.
143      */
144     public ST getCity() {
145        return getTyped(2, ST.class);
146     }
147 
148     
149     /**
150      * Returns City (component 3).  This is a convenience method that saves you from 
151      * casting and handling an exception.
152      */
153     public ST getAd3_City() {
154        return getTyped(2, ST.class);
155     }
156 
157 
158     /**
159      * Returns State or Province (component 4).  This is a convenience method that saves you from 
160      * casting and handling an exception.
161      */
162     public ST getStateOrProvince() {
163        return getTyped(3, ST.class);
164     }
165 
166     
167     /**
168      * Returns State or Province (component 4).  This is a convenience method that saves you from 
169      * casting and handling an exception.
170      */
171     public ST getAd4_StateOrProvince() {
172        return getTyped(3, ST.class);
173     }
174 
175 
176     /**
177      * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
178      * casting and handling an exception.
179      */
180     public ST getZipOrPostalCode() {
181        return getTyped(4, ST.class);
182     }
183 
184     
185     /**
186      * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
187      * casting and handling an exception.
188      */
189     public ST getAd5_ZipOrPostalCode() {
190        return getTyped(4, ST.class);
191     }
192 
193 
194     /**
195      * Returns Country (component 6).  This is a convenience method that saves you from 
196      * casting and handling an exception.
197      */
198     public ID getCountry() {
199        return getTyped(5, ID.class);
200     }
201 
202     
203     /**
204      * Returns Country (component 6).  This is a convenience method that saves you from 
205      * casting and handling an exception.
206      */
207     public ID getAd6_Country() {
208        return getTyped(5, ID.class);
209     }
210 
211 
212     /**
213      * Returns Address Type (component 7).  This is a convenience method that saves you from 
214      * casting and handling an exception.
215      */
216     public ID getAddressType() {
217        return getTyped(6, ID.class);
218     }
219 
220     
221     /**
222      * Returns Address Type (component 7).  This is a convenience method that saves you from 
223      * casting and handling an exception.
224      */
225     public ID getAd7_AddressType() {
226        return getTyped(6, ID.class);
227     }
228 
229 
230     /**
231      * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
232      * casting and handling an exception.
233      */
234     public ST getOtherGeographicDesignation() {
235        return getTyped(7, ST.class);
236     }
237 
238     
239     /**
240      * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
241      * casting and handling an exception.
242      */
243     public ST getAd8_OtherGeographicDesignation() {
244        return getTyped(7, ST.class);
245     }
246 
247 
248 
249 }
250