001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * A type of a manufactured item that is used in the provision of healthcare without being substantially changed through that activity. The device may be a medical or non-medical device.
070 */
071@ResourceDef(name="Device", profile="http://hl7.org/fhir/StructureDefinition/Device")
072public class Device extends DomainResource {
073
074    public enum UDIEntryType {
075        /**
076         * a barcodescanner captured the data from the device label.
077         */
078        BARCODE, 
079        /**
080         * An RFID chip reader captured the data from the device label.
081         */
082        RFID, 
083        /**
084         * The data was read from the label by a person and manually entered. (e.g.  via a keyboard).
085         */
086        MANUAL, 
087        /**
088         * The data originated from a patient's implant card and was read by an operator.
089         */
090        CARD, 
091        /**
092         * The data originated from a patient source and was not directly scanned or read from a label or card.
093         */
094        SELFREPORTED, 
095        /**
096         * The method of data capture has not been determined.
097         */
098        UNKNOWN, 
099        /**
100         * added to help the parsers with the generic types
101         */
102        NULL;
103        public static UDIEntryType fromCode(String codeString) throws FHIRException {
104            if (codeString == null || "".equals(codeString))
105                return null;
106        if ("barcode".equals(codeString))
107          return BARCODE;
108        if ("rfid".equals(codeString))
109          return RFID;
110        if ("manual".equals(codeString))
111          return MANUAL;
112        if ("card".equals(codeString))
113          return CARD;
114        if ("self-reported".equals(codeString))
115          return SELFREPORTED;
116        if ("unknown".equals(codeString))
117          return UNKNOWN;
118        if (Configuration.isAcceptInvalidEnums())
119          return null;
120        else
121          throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
122        }
123        public String toCode() {
124          switch (this) {
125            case BARCODE: return "barcode";
126            case RFID: return "rfid";
127            case MANUAL: return "manual";
128            case CARD: return "card";
129            case SELFREPORTED: return "self-reported";
130            case UNKNOWN: return "unknown";
131            default: return "?";
132          }
133        }
134        public String getSystem() {
135          switch (this) {
136            case BARCODE: return "http://hl7.org/fhir/udi-entry-type";
137            case RFID: return "http://hl7.org/fhir/udi-entry-type";
138            case MANUAL: return "http://hl7.org/fhir/udi-entry-type";
139            case CARD: return "http://hl7.org/fhir/udi-entry-type";
140            case SELFREPORTED: return "http://hl7.org/fhir/udi-entry-type";
141            case UNKNOWN: return "http://hl7.org/fhir/udi-entry-type";
142            default: return "?";
143          }
144        }
145        public String getDefinition() {
146          switch (this) {
147            case BARCODE: return "a barcodescanner captured the data from the device label.";
148            case RFID: return "An RFID chip reader captured the data from the device label.";
149            case MANUAL: return "The data was read from the label by a person and manually entered. (e.g.  via a keyboard).";
150            case CARD: return "The data originated from a patient's implant card and was read by an operator.";
151            case SELFREPORTED: return "The data originated from a patient source and was not directly scanned or read from a label or card.";
152            case UNKNOWN: return "The method of data capture has not been determined.";
153            default: return "?";
154          }
155        }
156        public String getDisplay() {
157          switch (this) {
158            case BARCODE: return "Barcode";
159            case RFID: return "RFID";
160            case MANUAL: return "Manual";
161            case CARD: return "Card";
162            case SELFREPORTED: return "Self Reported";
163            case UNKNOWN: return "Unknown";
164            default: return "?";
165          }
166        }
167    }
168
169  public static class UDIEntryTypeEnumFactory implements EnumFactory<UDIEntryType> {
170    public UDIEntryType fromCode(String codeString) throws IllegalArgumentException {
171      if (codeString == null || "".equals(codeString))
172            if (codeString == null || "".equals(codeString))
173                return null;
174        if ("barcode".equals(codeString))
175          return UDIEntryType.BARCODE;
176        if ("rfid".equals(codeString))
177          return UDIEntryType.RFID;
178        if ("manual".equals(codeString))
179          return UDIEntryType.MANUAL;
180        if ("card".equals(codeString))
181          return UDIEntryType.CARD;
182        if ("self-reported".equals(codeString))
183          return UDIEntryType.SELFREPORTED;
184        if ("unknown".equals(codeString))
185          return UDIEntryType.UNKNOWN;
186        throw new IllegalArgumentException("Unknown UDIEntryType code '"+codeString+"'");
187        }
188        public Enumeration<UDIEntryType> fromType(Base code) throws FHIRException {
189          if (code == null)
190            return null;
191          if (code.isEmpty())
192            return new Enumeration<UDIEntryType>(this);
193          String codeString = ((PrimitiveType) code).asStringValue();
194          if (codeString == null || "".equals(codeString))
195            return null;
196        if ("barcode".equals(codeString))
197          return new Enumeration<UDIEntryType>(this, UDIEntryType.BARCODE);
198        if ("rfid".equals(codeString))
199          return new Enumeration<UDIEntryType>(this, UDIEntryType.RFID);
200        if ("manual".equals(codeString))
201          return new Enumeration<UDIEntryType>(this, UDIEntryType.MANUAL);
202        if ("card".equals(codeString))
203          return new Enumeration<UDIEntryType>(this, UDIEntryType.CARD);
204        if ("self-reported".equals(codeString))
205          return new Enumeration<UDIEntryType>(this, UDIEntryType.SELFREPORTED);
206        if ("unknown".equals(codeString))
207          return new Enumeration<UDIEntryType>(this, UDIEntryType.UNKNOWN);
208        throw new FHIRException("Unknown UDIEntryType code '"+codeString+"'");
209        }
210    public String toCode(UDIEntryType code) {
211      if (code == UDIEntryType.BARCODE)
212        return "barcode";
213      if (code == UDIEntryType.RFID)
214        return "rfid";
215      if (code == UDIEntryType.MANUAL)
216        return "manual";
217      if (code == UDIEntryType.CARD)
218        return "card";
219      if (code == UDIEntryType.SELFREPORTED)
220        return "self-reported";
221      if (code == UDIEntryType.UNKNOWN)
222        return "unknown";
223      return "?";
224      }
225    public String toSystem(UDIEntryType code) {
226      return code.getSystem();
227      }
228    }
229
230    public enum FHIRDeviceStatus {
231        /**
232         * The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.
233         */
234        ACTIVE, 
235        /**
236         * The device is no longer available for use (e.g. lost, expired, damaged).  Note: For *implanted devices*  this means that the device has been removed from the patient.
237         */
238        INACTIVE, 
239        /**
240         * The device was entered in error and voided.
241         */
242        ENTEREDINERROR, 
243        /**
244         * The status of the device has not been determined.
245         */
246        UNKNOWN, 
247        /**
248         * added to help the parsers with the generic types
249         */
250        NULL;
251        public static FHIRDeviceStatus fromCode(String codeString) throws FHIRException {
252            if (codeString == null || "".equals(codeString))
253                return null;
254        if ("active".equals(codeString))
255          return ACTIVE;
256        if ("inactive".equals(codeString))
257          return INACTIVE;
258        if ("entered-in-error".equals(codeString))
259          return ENTEREDINERROR;
260        if ("unknown".equals(codeString))
261          return UNKNOWN;
262        if (Configuration.isAcceptInvalidEnums())
263          return null;
264        else
265          throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
266        }
267        public String toCode() {
268          switch (this) {
269            case ACTIVE: return "active";
270            case INACTIVE: return "inactive";
271            case ENTEREDINERROR: return "entered-in-error";
272            case UNKNOWN: return "unknown";
273            default: return "?";
274          }
275        }
276        public String getSystem() {
277          switch (this) {
278            case ACTIVE: return "http://hl7.org/fhir/device-status";
279            case INACTIVE: return "http://hl7.org/fhir/device-status";
280            case ENTEREDINERROR: return "http://hl7.org/fhir/device-status";
281            case UNKNOWN: return "http://hl7.org/fhir/device-status";
282            default: return "?";
283          }
284        }
285        public String getDefinition() {
286          switch (this) {
287            case ACTIVE: return "The device is available for use.  Note: For *implanted devices*  this means that the device is implanted in the patient.";
288            case INACTIVE: return "The device is no longer available for use (e.g. lost, expired, damaged).  Note: For *implanted devices*  this means that the device has been removed from the patient.";
289            case ENTEREDINERROR: return "The device was entered in error and voided.";
290            case UNKNOWN: return "The status of the device has not been determined.";
291            default: return "?";
292          }
293        }
294        public String getDisplay() {
295          switch (this) {
296            case ACTIVE: return "Active";
297            case INACTIVE: return "Inactive";
298            case ENTEREDINERROR: return "Entered in Error";
299            case UNKNOWN: return "Unknown";
300            default: return "?";
301          }
302        }
303    }
304
305  public static class FHIRDeviceStatusEnumFactory implements EnumFactory<FHIRDeviceStatus> {
306    public FHIRDeviceStatus fromCode(String codeString) throws IllegalArgumentException {
307      if (codeString == null || "".equals(codeString))
308            if (codeString == null || "".equals(codeString))
309                return null;
310        if ("active".equals(codeString))
311          return FHIRDeviceStatus.ACTIVE;
312        if ("inactive".equals(codeString))
313          return FHIRDeviceStatus.INACTIVE;
314        if ("entered-in-error".equals(codeString))
315          return FHIRDeviceStatus.ENTEREDINERROR;
316        if ("unknown".equals(codeString))
317          return FHIRDeviceStatus.UNKNOWN;
318        throw new IllegalArgumentException("Unknown FHIRDeviceStatus code '"+codeString+"'");
319        }
320        public Enumeration<FHIRDeviceStatus> fromType(Base code) throws FHIRException {
321          if (code == null)
322            return null;
323          if (code.isEmpty())
324            return new Enumeration<FHIRDeviceStatus>(this);
325          String codeString = ((PrimitiveType) code).asStringValue();
326          if (codeString == null || "".equals(codeString))
327            return null;
328        if ("active".equals(codeString))
329          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ACTIVE);
330        if ("inactive".equals(codeString))
331          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.INACTIVE);
332        if ("entered-in-error".equals(codeString))
333          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.ENTEREDINERROR);
334        if ("unknown".equals(codeString))
335          return new Enumeration<FHIRDeviceStatus>(this, FHIRDeviceStatus.UNKNOWN);
336        throw new FHIRException("Unknown FHIRDeviceStatus code '"+codeString+"'");
337        }
338    public String toCode(FHIRDeviceStatus code) {
339      if (code == FHIRDeviceStatus.ACTIVE)
340        return "active";
341      if (code == FHIRDeviceStatus.INACTIVE)
342        return "inactive";
343      if (code == FHIRDeviceStatus.ENTEREDINERROR)
344        return "entered-in-error";
345      if (code == FHIRDeviceStatus.UNKNOWN)
346        return "unknown";
347      return "?";
348      }
349    public String toSystem(FHIRDeviceStatus code) {
350      return code.getSystem();
351      }
352    }
353
354    public enum DeviceNameType {
355        /**
356         * UDI Label name.
357         */
358        UDILABELNAME, 
359        /**
360         * User Friendly name.
361         */
362        USERFRIENDLYNAME, 
363        /**
364         * Patient Reported name.
365         */
366        PATIENTREPORTEDNAME, 
367        /**
368         * Manufacturer name.
369         */
370        MANUFACTURERNAME, 
371        /**
372         * Model name.
373         */
374        MODELNAME, 
375        /**
376         * other.
377         */
378        OTHER, 
379        /**
380         * added to help the parsers with the generic types
381         */
382        NULL;
383        public static DeviceNameType fromCode(String codeString) throws FHIRException {
384            if (codeString == null || "".equals(codeString))
385                return null;
386        if ("udi-label-name".equals(codeString))
387          return UDILABELNAME;
388        if ("user-friendly-name".equals(codeString))
389          return USERFRIENDLYNAME;
390        if ("patient-reported-name".equals(codeString))
391          return PATIENTREPORTEDNAME;
392        if ("manufacturer-name".equals(codeString))
393          return MANUFACTURERNAME;
394        if ("model-name".equals(codeString))
395          return MODELNAME;
396        if ("other".equals(codeString))
397          return OTHER;
398        if (Configuration.isAcceptInvalidEnums())
399          return null;
400        else
401          throw new FHIRException("Unknown DeviceNameType code '"+codeString+"'");
402        }
403        public String toCode() {
404          switch (this) {
405            case UDILABELNAME: return "udi-label-name";
406            case USERFRIENDLYNAME: return "user-friendly-name";
407            case PATIENTREPORTEDNAME: return "patient-reported-name";
408            case MANUFACTURERNAME: return "manufacturer-name";
409            case MODELNAME: return "model-name";
410            case OTHER: return "other";
411            default: return "?";
412          }
413        }
414        public String getSystem() {
415          switch (this) {
416            case UDILABELNAME: return "http://hl7.org/fhir/device-nametype";
417            case USERFRIENDLYNAME: return "http://hl7.org/fhir/device-nametype";
418            case PATIENTREPORTEDNAME: return "http://hl7.org/fhir/device-nametype";
419            case MANUFACTURERNAME: return "http://hl7.org/fhir/device-nametype";
420            case MODELNAME: return "http://hl7.org/fhir/device-nametype";
421            case OTHER: return "http://hl7.org/fhir/device-nametype";
422            default: return "?";
423          }
424        }
425        public String getDefinition() {
426          switch (this) {
427            case UDILABELNAME: return "UDI Label name.";
428            case USERFRIENDLYNAME: return "User Friendly name.";
429            case PATIENTREPORTEDNAME: return "Patient Reported name.";
430            case MANUFACTURERNAME: return "Manufacturer name.";
431            case MODELNAME: return "Model name.";
432            case OTHER: return "other.";
433            default: return "?";
434          }
435        }
436        public String getDisplay() {
437          switch (this) {
438            case UDILABELNAME: return "UDI Label name";
439            case USERFRIENDLYNAME: return "User Friendly name";
440            case PATIENTREPORTEDNAME: return "Patient Reported name";
441            case MANUFACTURERNAME: return "Manufacturer name";
442            case MODELNAME: return "Model name";
443            case OTHER: return "other";
444            default: return "?";
445          }
446        }
447    }
448
449  public static class DeviceNameTypeEnumFactory implements EnumFactory<DeviceNameType> {
450    public DeviceNameType fromCode(String codeString) throws IllegalArgumentException {
451      if (codeString == null || "".equals(codeString))
452            if (codeString == null || "".equals(codeString))
453                return null;
454        if ("udi-label-name".equals(codeString))
455          return DeviceNameType.UDILABELNAME;
456        if ("user-friendly-name".equals(codeString))
457          return DeviceNameType.USERFRIENDLYNAME;
458        if ("patient-reported-name".equals(codeString))
459          return DeviceNameType.PATIENTREPORTEDNAME;
460        if ("manufacturer-name".equals(codeString))
461          return DeviceNameType.MANUFACTURERNAME;
462        if ("model-name".equals(codeString))
463          return DeviceNameType.MODELNAME;
464        if ("other".equals(codeString))
465          return DeviceNameType.OTHER;
466        throw new IllegalArgumentException("Unknown DeviceNameType code '"+codeString+"'");
467        }
468        public Enumeration<DeviceNameType> fromType(Base code) throws FHIRException {
469          if (code == null)
470            return null;
471          if (code.isEmpty())
472            return new Enumeration<DeviceNameType>(this);
473          String codeString = ((PrimitiveType) code).asStringValue();
474          if (codeString == null || "".equals(codeString))
475            return null;
476        if ("udi-label-name".equals(codeString))
477          return new Enumeration<DeviceNameType>(this, DeviceNameType.UDILABELNAME);
478        if ("user-friendly-name".equals(codeString))
479          return new Enumeration<DeviceNameType>(this, DeviceNameType.USERFRIENDLYNAME);
480        if ("patient-reported-name".equals(codeString))
481          return new Enumeration<DeviceNameType>(this, DeviceNameType.PATIENTREPORTEDNAME);
482        if ("manufacturer-name".equals(codeString))
483          return new Enumeration<DeviceNameType>(this, DeviceNameType.MANUFACTURERNAME);
484        if ("model-name".equals(codeString))
485          return new Enumeration<DeviceNameType>(this, DeviceNameType.MODELNAME);
486        if ("other".equals(codeString))
487          return new Enumeration<DeviceNameType>(this, DeviceNameType.OTHER);
488        throw new FHIRException("Unknown DeviceNameType code '"+codeString+"'");
489        }
490    public String toCode(DeviceNameType code) {
491      if (code == DeviceNameType.UDILABELNAME)
492        return "udi-label-name";
493      if (code == DeviceNameType.USERFRIENDLYNAME)
494        return "user-friendly-name";
495      if (code == DeviceNameType.PATIENTREPORTEDNAME)
496        return "patient-reported-name";
497      if (code == DeviceNameType.MANUFACTURERNAME)
498        return "manufacturer-name";
499      if (code == DeviceNameType.MODELNAME)
500        return "model-name";
501      if (code == DeviceNameType.OTHER)
502        return "other";
503      return "?";
504      }
505    public String toSystem(DeviceNameType code) {
506      return code.getSystem();
507      }
508    }
509
510    @Block()
511    public static class DeviceUdiCarrierComponent extends BackboneElement implements IBaseBackboneElement {
512        /**
513         * The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
514         */
515        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
516        @Description(shortDefinition="Mandatory fixed portion of UDI", formalDefinition="The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device." )
517        protected StringType deviceIdentifier;
518
519        /**
520         * Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
5211) GS1: 
522http://hl7.org/fhir/NamingSystem/gs1-di, 
5232) HIBCC:
524http://hl7.org/fhir/NamingSystem/hibcc-dI, 
5253) ICCBBA for blood containers:
526http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
5274) ICCBA for other devices:
528http://hl7.org/fhir/NamingSystem/iccbba-other-di.
529         */
530        @Child(name = "issuer", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
531        @Description(shortDefinition="UDI Issuing Organization", formalDefinition="Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di." )
532        protected UriType issuer;
533
534        /**
535         * The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
536         */
537        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=false)
538        @Description(shortDefinition="Regional UDI authority", formalDefinition="The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi." )
539        protected UriType jurisdiction;
540
541        /**
542         * The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
543         */
544        @Child(name = "carrierAIDC", type = {Base64BinaryType.class}, order=4, min=0, max=1, modifier=false, summary=true)
545        @Description(shortDefinition="UDI Machine Readable Barcode String", formalDefinition="The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded." )
546        protected Base64BinaryType carrierAIDC;
547
548        /**
549         * The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
550         */
551        @Child(name = "carrierHRF", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
552        @Description(shortDefinition="UDI Human Readable Barcode String", formalDefinition="The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device." )
553        protected StringType carrierHRF;
554
555        /**
556         * A coded entry to indicate how the data was entered.
557         */
558        @Child(name = "entryType", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
559        @Description(shortDefinition="barcode | rfid | manual +", formalDefinition="A coded entry to indicate how the data was entered." )
560        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/udi-entry-type")
561        protected Enumeration<UDIEntryType> entryType;
562
563        private static final long serialVersionUID = -191630425L;
564
565    /**
566     * Constructor
567     */
568      public DeviceUdiCarrierComponent() {
569        super();
570      }
571
572        /**
573         * @return {@link #deviceIdentifier} (The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
574         */
575        public StringType getDeviceIdentifierElement() { 
576          if (this.deviceIdentifier == null)
577            if (Configuration.errorOnAutoCreate())
578              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.deviceIdentifier");
579            else if (Configuration.doAutoCreate())
580              this.deviceIdentifier = new StringType(); // bb
581          return this.deviceIdentifier;
582        }
583
584        public boolean hasDeviceIdentifierElement() { 
585          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
586        }
587
588        public boolean hasDeviceIdentifier() { 
589          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
590        }
591
592        /**
593         * @param value {@link #deviceIdentifier} (The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
594         */
595        public DeviceUdiCarrierComponent setDeviceIdentifierElement(StringType value) { 
596          this.deviceIdentifier = value;
597          return this;
598        }
599
600        /**
601         * @return The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
602         */
603        public String getDeviceIdentifier() { 
604          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
605        }
606
607        /**
608         * @param value The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.
609         */
610        public DeviceUdiCarrierComponent setDeviceIdentifier(String value) { 
611          if (Utilities.noString(value))
612            this.deviceIdentifier = null;
613          else {
614            if (this.deviceIdentifier == null)
615              this.deviceIdentifier = new StringType();
616            this.deviceIdentifier.setValue(value);
617          }
618          return this;
619        }
620
621        /**
622         * @return {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6231) GS1: 
624http://hl7.org/fhir/NamingSystem/gs1-di, 
6252) HIBCC:
626http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6273) ICCBBA for blood containers:
628http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6294) ICCBA for other devices:
630http://hl7.org/fhir/NamingSystem/iccbba-other-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
631         */
632        public UriType getIssuerElement() { 
633          if (this.issuer == null)
634            if (Configuration.errorOnAutoCreate())
635              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.issuer");
636            else if (Configuration.doAutoCreate())
637              this.issuer = new UriType(); // bb
638          return this.issuer;
639        }
640
641        public boolean hasIssuerElement() { 
642          return this.issuer != null && !this.issuer.isEmpty();
643        }
644
645        public boolean hasIssuer() { 
646          return this.issuer != null && !this.issuer.isEmpty();
647        }
648
649        /**
650         * @param value {@link #issuer} (Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6511) GS1: 
652http://hl7.org/fhir/NamingSystem/gs1-di, 
6532) HIBCC:
654http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6553) ICCBBA for blood containers:
656http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6574) ICCBA for other devices:
658http://hl7.org/fhir/NamingSystem/iccbba-other-di.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
659         */
660        public DeviceUdiCarrierComponent setIssuerElement(UriType value) { 
661          this.issuer = value;
662          return this;
663        }
664
665        /**
666         * @return Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6671) GS1: 
668http://hl7.org/fhir/NamingSystem/gs1-di, 
6692) HIBCC:
670http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6713) ICCBBA for blood containers:
672http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6734) ICCBA for other devices:
674http://hl7.org/fhir/NamingSystem/iccbba-other-di.
675         */
676        public String getIssuer() { 
677          return this.issuer == null ? null : this.issuer.getValue();
678        }
679
680        /**
681         * @param value Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
6821) GS1: 
683http://hl7.org/fhir/NamingSystem/gs1-di, 
6842) HIBCC:
685http://hl7.org/fhir/NamingSystem/hibcc-dI, 
6863) ICCBBA for blood containers:
687http://hl7.org/fhir/NamingSystem/iccbba-blood-di, 
6884) ICCBA for other devices:
689http://hl7.org/fhir/NamingSystem/iccbba-other-di.
690         */
691        public DeviceUdiCarrierComponent setIssuer(String value) { 
692          if (Utilities.noString(value))
693            this.issuer = null;
694          else {
695            if (this.issuer == null)
696              this.issuer = new UriType();
697            this.issuer.setValue(value);
698          }
699          return this;
700        }
701
702        /**
703         * @return {@link #jurisdiction} (The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
704         */
705        public UriType getJurisdictionElement() { 
706          if (this.jurisdiction == null)
707            if (Configuration.errorOnAutoCreate())
708              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.jurisdiction");
709            else if (Configuration.doAutoCreate())
710              this.jurisdiction = new UriType(); // bb
711          return this.jurisdiction;
712        }
713
714        public boolean hasJurisdictionElement() { 
715          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
716        }
717
718        public boolean hasJurisdiction() { 
719          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
720        }
721
722        /**
723         * @param value {@link #jurisdiction} (The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
724         */
725        public DeviceUdiCarrierComponent setJurisdictionElement(UriType value) { 
726          this.jurisdiction = value;
727          return this;
728        }
729
730        /**
731         * @return The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
732         */
733        public String getJurisdiction() { 
734          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
735        }
736
737        /**
738         * @param value The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.
739         */
740        public DeviceUdiCarrierComponent setJurisdiction(String value) { 
741          if (Utilities.noString(value))
742            this.jurisdiction = null;
743          else {
744            if (this.jurisdiction == null)
745              this.jurisdiction = new UriType();
746            this.jurisdiction.setValue(value);
747          }
748          return this;
749        }
750
751        /**
752         * @return {@link #carrierAIDC} (The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
753         */
754        public Base64BinaryType getCarrierAIDCElement() { 
755          if (this.carrierAIDC == null)
756            if (Configuration.errorOnAutoCreate())
757              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierAIDC");
758            else if (Configuration.doAutoCreate())
759              this.carrierAIDC = new Base64BinaryType(); // bb
760          return this.carrierAIDC;
761        }
762
763        public boolean hasCarrierAIDCElement() { 
764          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
765        }
766
767        public boolean hasCarrierAIDC() { 
768          return this.carrierAIDC != null && !this.carrierAIDC.isEmpty();
769        }
770
771        /**
772         * @param value {@link #carrierAIDC} (The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getCarrierAIDC" gives direct access to the value
773         */
774        public DeviceUdiCarrierComponent setCarrierAIDCElement(Base64BinaryType value) { 
775          this.carrierAIDC = value;
776          return this;
777        }
778
779        /**
780         * @return The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
781         */
782        public byte[] getCarrierAIDC() { 
783          return this.carrierAIDC == null ? null : this.carrierAIDC.getValue();
784        }
785
786        /**
787         * @param value The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.
788         */
789        public DeviceUdiCarrierComponent setCarrierAIDC(byte[] value) { 
790          if (value == null)
791            this.carrierAIDC = null;
792          else {
793            if (this.carrierAIDC == null)
794              this.carrierAIDC = new Base64BinaryType();
795            this.carrierAIDC.setValue(value);
796          }
797          return this;
798        }
799
800        /**
801         * @return {@link #carrierHRF} (The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
802         */
803        public StringType getCarrierHRFElement() { 
804          if (this.carrierHRF == null)
805            if (Configuration.errorOnAutoCreate())
806              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.carrierHRF");
807            else if (Configuration.doAutoCreate())
808              this.carrierHRF = new StringType(); // bb
809          return this.carrierHRF;
810        }
811
812        public boolean hasCarrierHRFElement() { 
813          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
814        }
815
816        public boolean hasCarrierHRF() { 
817          return this.carrierHRF != null && !this.carrierHRF.isEmpty();
818        }
819
820        /**
821         * @param value {@link #carrierHRF} (The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.). This is the underlying object with id, value and extensions. The accessor "getCarrierHRF" gives direct access to the value
822         */
823        public DeviceUdiCarrierComponent setCarrierHRFElement(StringType value) { 
824          this.carrierHRF = value;
825          return this;
826        }
827
828        /**
829         * @return The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
830         */
831        public String getCarrierHRF() { 
832          return this.carrierHRF == null ? null : this.carrierHRF.getValue();
833        }
834
835        /**
836         * @param value The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.
837         */
838        public DeviceUdiCarrierComponent setCarrierHRF(String value) { 
839          if (Utilities.noString(value))
840            this.carrierHRF = null;
841          else {
842            if (this.carrierHRF == null)
843              this.carrierHRF = new StringType();
844            this.carrierHRF.setValue(value);
845          }
846          return this;
847        }
848
849        /**
850         * @return {@link #entryType} (A coded entry to indicate how the data was entered.). This is the underlying object with id, value and extensions. The accessor "getEntryType" gives direct access to the value
851         */
852        public Enumeration<UDIEntryType> getEntryTypeElement() { 
853          if (this.entryType == null)
854            if (Configuration.errorOnAutoCreate())
855              throw new Error("Attempt to auto-create DeviceUdiCarrierComponent.entryType");
856            else if (Configuration.doAutoCreate())
857              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory()); // bb
858          return this.entryType;
859        }
860
861        public boolean hasEntryTypeElement() { 
862          return this.entryType != null && !this.entryType.isEmpty();
863        }
864
865        public boolean hasEntryType() { 
866          return this.entryType != null && !this.entryType.isEmpty();
867        }
868
869        /**
870         * @param value {@link #entryType} (A coded entry to indicate how the data was entered.). This is the underlying object with id, value and extensions. The accessor "getEntryType" gives direct access to the value
871         */
872        public DeviceUdiCarrierComponent setEntryTypeElement(Enumeration<UDIEntryType> value) { 
873          this.entryType = value;
874          return this;
875        }
876
877        /**
878         * @return A coded entry to indicate how the data was entered.
879         */
880        public UDIEntryType getEntryType() { 
881          return this.entryType == null ? null : this.entryType.getValue();
882        }
883
884        /**
885         * @param value A coded entry to indicate how the data was entered.
886         */
887        public DeviceUdiCarrierComponent setEntryType(UDIEntryType value) { 
888          if (value == null)
889            this.entryType = null;
890          else {
891            if (this.entryType == null)
892              this.entryType = new Enumeration<UDIEntryType>(new UDIEntryTypeEnumFactory());
893            this.entryType.setValue(value);
894          }
895          return this;
896        }
897
898        protected void listChildren(List<Property> children) {
899          super.listChildren(children);
900          children.add(new Property("deviceIdentifier", "string", "The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.", 0, 1, deviceIdentifier));
901          children.add(new Property("issuer", "uri", "Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di.", 0, 1, issuer));
902          children.add(new Property("jurisdiction", "uri", "The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.", 0, 1, jurisdiction));
903          children.add(new Property("carrierAIDC", "base64Binary", "The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.", 0, 1, carrierAIDC));
904          children.add(new Property("carrierHRF", "string", "The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.", 0, 1, carrierHRF));
905          children.add(new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType));
906        }
907
908        @Override
909        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
910          switch (_hash) {
911          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.", 0, 1, deviceIdentifier);
912          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :\n1) GS1: \nhttp://hl7.org/fhir/NamingSystem/gs1-di, \n2) HIBCC:\nhttp://hl7.org/fhir/NamingSystem/hibcc-dI, \n3) ICCBBA for blood containers:\nhttp://hl7.org/fhir/NamingSystem/iccbba-blood-di, \n4) ICCBA for other devices:\nhttp://hl7.org/fhir/NamingSystem/iccbba-other-di.", 0, 1, issuer);
913          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.", 0, 1, jurisdiction);
914          case -768521825: /*carrierAIDC*/  return new Property("carrierAIDC", "base64Binary", "The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - e.g., a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.", 0, 1, carrierAIDC);
915          case 806499972: /*carrierHRF*/  return new Property("carrierHRF", "string", "The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.", 0, 1, carrierHRF);
916          case -479362356: /*entryType*/  return new Property("entryType", "code", "A coded entry to indicate how the data was entered.", 0, 1, entryType);
917          default: return super.getNamedProperty(_hash, _name, _checkValid);
918          }
919
920        }
921
922      @Override
923      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
924        switch (hash) {
925        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
926        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
927        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
928        case -768521825: /*carrierAIDC*/ return this.carrierAIDC == null ? new Base[0] : new Base[] {this.carrierAIDC}; // Base64BinaryType
929        case 806499972: /*carrierHRF*/ return this.carrierHRF == null ? new Base[0] : new Base[] {this.carrierHRF}; // StringType
930        case -479362356: /*entryType*/ return this.entryType == null ? new Base[0] : new Base[] {this.entryType}; // Enumeration<UDIEntryType>
931        default: return super.getProperty(hash, name, checkValid);
932        }
933
934      }
935
936      @Override
937      public Base setProperty(int hash, String name, Base value) throws FHIRException {
938        switch (hash) {
939        case 1322005407: // deviceIdentifier
940          this.deviceIdentifier = castToString(value); // StringType
941          return value;
942        case -1179159879: // issuer
943          this.issuer = castToUri(value); // UriType
944          return value;
945        case -507075711: // jurisdiction
946          this.jurisdiction = castToUri(value); // UriType
947          return value;
948        case -768521825: // carrierAIDC
949          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
950          return value;
951        case 806499972: // carrierHRF
952          this.carrierHRF = castToString(value); // StringType
953          return value;
954        case -479362356: // entryType
955          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
956          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
957          return value;
958        default: return super.setProperty(hash, name, value);
959        }
960
961      }
962
963      @Override
964      public Base setProperty(String name, Base value) throws FHIRException {
965        if (name.equals("deviceIdentifier")) {
966          this.deviceIdentifier = castToString(value); // StringType
967        } else if (name.equals("issuer")) {
968          this.issuer = castToUri(value); // UriType
969        } else if (name.equals("jurisdiction")) {
970          this.jurisdiction = castToUri(value); // UriType
971        } else if (name.equals("carrierAIDC")) {
972          this.carrierAIDC = castToBase64Binary(value); // Base64BinaryType
973        } else if (name.equals("carrierHRF")) {
974          this.carrierHRF = castToString(value); // StringType
975        } else if (name.equals("entryType")) {
976          value = new UDIEntryTypeEnumFactory().fromType(castToCode(value));
977          this.entryType = (Enumeration) value; // Enumeration<UDIEntryType>
978        } else
979          return super.setProperty(name, value);
980        return value;
981      }
982
983      @Override
984      public Base makeProperty(int hash, String name) throws FHIRException {
985        switch (hash) {
986        case 1322005407:  return getDeviceIdentifierElement();
987        case -1179159879:  return getIssuerElement();
988        case -507075711:  return getJurisdictionElement();
989        case -768521825:  return getCarrierAIDCElement();
990        case 806499972:  return getCarrierHRFElement();
991        case -479362356:  return getEntryTypeElement();
992        default: return super.makeProperty(hash, name);
993        }
994
995      }
996
997      @Override
998      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
999        switch (hash) {
1000        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
1001        case -1179159879: /*issuer*/ return new String[] {"uri"};
1002        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
1003        case -768521825: /*carrierAIDC*/ return new String[] {"base64Binary"};
1004        case 806499972: /*carrierHRF*/ return new String[] {"string"};
1005        case -479362356: /*entryType*/ return new String[] {"code"};
1006        default: return super.getTypesForProperty(hash, name);
1007        }
1008
1009      }
1010
1011      @Override
1012      public Base addChild(String name) throws FHIRException {
1013        if (name.equals("deviceIdentifier")) {
1014          throw new FHIRException("Cannot call addChild on a primitive type Device.deviceIdentifier");
1015        }
1016        else if (name.equals("issuer")) {
1017          throw new FHIRException("Cannot call addChild on a primitive type Device.issuer");
1018        }
1019        else if (name.equals("jurisdiction")) {
1020          throw new FHIRException("Cannot call addChild on a primitive type Device.jurisdiction");
1021        }
1022        else if (name.equals("carrierAIDC")) {
1023          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierAIDC");
1024        }
1025        else if (name.equals("carrierHRF")) {
1026          throw new FHIRException("Cannot call addChild on a primitive type Device.carrierHRF");
1027        }
1028        else if (name.equals("entryType")) {
1029          throw new FHIRException("Cannot call addChild on a primitive type Device.entryType");
1030        }
1031        else
1032          return super.addChild(name);
1033      }
1034
1035      public DeviceUdiCarrierComponent copy() {
1036        DeviceUdiCarrierComponent dst = new DeviceUdiCarrierComponent();
1037        copyValues(dst);
1038        return dst;
1039      }
1040
1041      public void copyValues(DeviceUdiCarrierComponent dst) {
1042        super.copyValues(dst);
1043        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
1044        dst.issuer = issuer == null ? null : issuer.copy();
1045        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
1046        dst.carrierAIDC = carrierAIDC == null ? null : carrierAIDC.copy();
1047        dst.carrierHRF = carrierHRF == null ? null : carrierHRF.copy();
1048        dst.entryType = entryType == null ? null : entryType.copy();
1049      }
1050
1051      @Override
1052      public boolean equalsDeep(Base other_) {
1053        if (!super.equalsDeep(other_))
1054          return false;
1055        if (!(other_ instanceof DeviceUdiCarrierComponent))
1056          return false;
1057        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
1058        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(issuer, o.issuer, true)
1059           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(carrierAIDC, o.carrierAIDC, true)
1060           && compareDeep(carrierHRF, o.carrierHRF, true) && compareDeep(entryType, o.entryType, true);
1061      }
1062
1063      @Override
1064      public boolean equalsShallow(Base other_) {
1065        if (!super.equalsShallow(other_))
1066          return false;
1067        if (!(other_ instanceof DeviceUdiCarrierComponent))
1068          return false;
1069        DeviceUdiCarrierComponent o = (DeviceUdiCarrierComponent) other_;
1070        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(issuer, o.issuer, true)
1071           && compareValues(jurisdiction, o.jurisdiction, true) && compareValues(carrierAIDC, o.carrierAIDC, true)
1072           && compareValues(carrierHRF, o.carrierHRF, true) && compareValues(entryType, o.entryType, true);
1073      }
1074
1075      public boolean isEmpty() {
1076        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, issuer, jurisdiction
1077          , carrierAIDC, carrierHRF, entryType);
1078      }
1079
1080  public String fhirType() {
1081    return "Device.udiCarrier";
1082
1083  }
1084
1085  }
1086
1087    @Block()
1088    public static class DeviceDeviceNameComponent extends BackboneElement implements IBaseBackboneElement {
1089        /**
1090         * The name that identifies the device.
1091         */
1092        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1093        @Description(shortDefinition="The name that identifies the device", formalDefinition="The name that identifies the device." )
1094        protected StringType name;
1095
1096        /**
1097         * The type of deviceName.
1098UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1099         */
1100        @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1101        @Description(shortDefinition="udi-label-name | user-friendly-name | patient-reported-name | manufacturer-name | model-name | other", formalDefinition="The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName." )
1102        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-nametype")
1103        protected Enumeration<DeviceNameType> type;
1104
1105        private static final long serialVersionUID = 918983440L;
1106
1107    /**
1108     * Constructor
1109     */
1110      public DeviceDeviceNameComponent() {
1111        super();
1112      }
1113
1114    /**
1115     * Constructor
1116     */
1117      public DeviceDeviceNameComponent(StringType name, Enumeration<DeviceNameType> type) {
1118        super();
1119        this.name = name;
1120        this.type = type;
1121      }
1122
1123        /**
1124         * @return {@link #name} (The name that identifies the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1125         */
1126        public StringType getNameElement() { 
1127          if (this.name == null)
1128            if (Configuration.errorOnAutoCreate())
1129              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.name");
1130            else if (Configuration.doAutoCreate())
1131              this.name = new StringType(); // bb
1132          return this.name;
1133        }
1134
1135        public boolean hasNameElement() { 
1136          return this.name != null && !this.name.isEmpty();
1137        }
1138
1139        public boolean hasName() { 
1140          return this.name != null && !this.name.isEmpty();
1141        }
1142
1143        /**
1144         * @param value {@link #name} (The name that identifies the device.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1145         */
1146        public DeviceDeviceNameComponent setNameElement(StringType value) { 
1147          this.name = value;
1148          return this;
1149        }
1150
1151        /**
1152         * @return The name that identifies the device.
1153         */
1154        public String getName() { 
1155          return this.name == null ? null : this.name.getValue();
1156        }
1157
1158        /**
1159         * @param value The name that identifies the device.
1160         */
1161        public DeviceDeviceNameComponent setName(String value) { 
1162            if (this.name == null)
1163              this.name = new StringType();
1164            this.name.setValue(value);
1165          return this;
1166        }
1167
1168        /**
1169         * @return {@link #type} (The type of deviceName.
1170UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1171         */
1172        public Enumeration<DeviceNameType> getTypeElement() { 
1173          if (this.type == null)
1174            if (Configuration.errorOnAutoCreate())
1175              throw new Error("Attempt to auto-create DeviceDeviceNameComponent.type");
1176            else if (Configuration.doAutoCreate())
1177              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory()); // bb
1178          return this.type;
1179        }
1180
1181        public boolean hasTypeElement() { 
1182          return this.type != null && !this.type.isEmpty();
1183        }
1184
1185        public boolean hasType() { 
1186          return this.type != null && !this.type.isEmpty();
1187        }
1188
1189        /**
1190         * @param value {@link #type} (The type of deviceName.
1191UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1192         */
1193        public DeviceDeviceNameComponent setTypeElement(Enumeration<DeviceNameType> value) { 
1194          this.type = value;
1195          return this;
1196        }
1197
1198        /**
1199         * @return The type of deviceName.
1200UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1201         */
1202        public DeviceNameType getType() { 
1203          return this.type == null ? null : this.type.getValue();
1204        }
1205
1206        /**
1207         * @param value The type of deviceName.
1208UDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.
1209         */
1210        public DeviceDeviceNameComponent setType(DeviceNameType value) { 
1211            if (this.type == null)
1212              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory());
1213            this.type.setValue(value);
1214          return this;
1215        }
1216
1217        protected void listChildren(List<Property> children) {
1218          super.listChildren(children);
1219          children.add(new Property("name", "string", "The name that identifies the device.", 0, 1, name));
1220          children.add(new Property("type", "code", "The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.", 0, 1, type));
1221        }
1222
1223        @Override
1224        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1225          switch (_hash) {
1226          case 3373707: /*name*/  return new Property("name", "string", "The name that identifies the device.", 0, 1, name);
1227          case 3575610: /*type*/  return new Property("type", "code", "The type of deviceName.\nUDILabelName | UserFriendlyName | PatientReportedName | ManufactureDeviceName | ModelName.", 0, 1, type);
1228          default: return super.getNamedProperty(_hash, _name, _checkValid);
1229          }
1230
1231        }
1232
1233      @Override
1234      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1235        switch (hash) {
1236        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1237        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceNameType>
1238        default: return super.getProperty(hash, name, checkValid);
1239        }
1240
1241      }
1242
1243      @Override
1244      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1245        switch (hash) {
1246        case 3373707: // name
1247          this.name = castToString(value); // StringType
1248          return value;
1249        case 3575610: // type
1250          value = new DeviceNameTypeEnumFactory().fromType(castToCode(value));
1251          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1252          return value;
1253        default: return super.setProperty(hash, name, value);
1254        }
1255
1256      }
1257
1258      @Override
1259      public Base setProperty(String name, Base value) throws FHIRException {
1260        if (name.equals("name")) {
1261          this.name = castToString(value); // StringType
1262        } else if (name.equals("type")) {
1263          value = new DeviceNameTypeEnumFactory().fromType(castToCode(value));
1264          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1265        } else
1266          return super.setProperty(name, value);
1267        return value;
1268      }
1269
1270      @Override
1271      public Base makeProperty(int hash, String name) throws FHIRException {
1272        switch (hash) {
1273        case 3373707:  return getNameElement();
1274        case 3575610:  return getTypeElement();
1275        default: return super.makeProperty(hash, name);
1276        }
1277
1278      }
1279
1280      @Override
1281      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1282        switch (hash) {
1283        case 3373707: /*name*/ return new String[] {"string"};
1284        case 3575610: /*type*/ return new String[] {"code"};
1285        default: return super.getTypesForProperty(hash, name);
1286        }
1287
1288      }
1289
1290      @Override
1291      public Base addChild(String name) throws FHIRException {
1292        if (name.equals("name")) {
1293          throw new FHIRException("Cannot call addChild on a primitive type Device.name");
1294        }
1295        else if (name.equals("type")) {
1296          throw new FHIRException("Cannot call addChild on a primitive type Device.type");
1297        }
1298        else
1299          return super.addChild(name);
1300      }
1301
1302      public DeviceDeviceNameComponent copy() {
1303        DeviceDeviceNameComponent dst = new DeviceDeviceNameComponent();
1304        copyValues(dst);
1305        return dst;
1306      }
1307
1308      public void copyValues(DeviceDeviceNameComponent dst) {
1309        super.copyValues(dst);
1310        dst.name = name == null ? null : name.copy();
1311        dst.type = type == null ? null : type.copy();
1312      }
1313
1314      @Override
1315      public boolean equalsDeep(Base other_) {
1316        if (!super.equalsDeep(other_))
1317          return false;
1318        if (!(other_ instanceof DeviceDeviceNameComponent))
1319          return false;
1320        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1321        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
1322      }
1323
1324      @Override
1325      public boolean equalsShallow(Base other_) {
1326        if (!super.equalsShallow(other_))
1327          return false;
1328        if (!(other_ instanceof DeviceDeviceNameComponent))
1329          return false;
1330        DeviceDeviceNameComponent o = (DeviceDeviceNameComponent) other_;
1331        return compareValues(name, o.name, true) && compareValues(type, o.type, true);
1332      }
1333
1334      public boolean isEmpty() {
1335        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
1336      }
1337
1338  public String fhirType() {
1339    return "Device.deviceName";
1340
1341  }
1342
1343  }
1344
1345    @Block()
1346    public static class DeviceSpecializationComponent extends BackboneElement implements IBaseBackboneElement {
1347        /**
1348         * The standard that is used to operate and communicate.
1349         */
1350        @Child(name = "systemType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1351        @Description(shortDefinition="The standard that is used to operate and communicate", formalDefinition="The standard that is used to operate and communicate." )
1352        protected CodeableConcept systemType;
1353
1354        /**
1355         * The version of the standard that is used to operate and communicate.
1356         */
1357        @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1358        @Description(shortDefinition="The version of the standard that is used to operate and communicate", formalDefinition="The version of the standard that is used to operate and communicate." )
1359        protected StringType version;
1360
1361        private static final long serialVersionUID = 1557342629L;
1362
1363    /**
1364     * Constructor
1365     */
1366      public DeviceSpecializationComponent() {
1367        super();
1368      }
1369
1370    /**
1371     * Constructor
1372     */
1373      public DeviceSpecializationComponent(CodeableConcept systemType) {
1374        super();
1375        this.systemType = systemType;
1376      }
1377
1378        /**
1379         * @return {@link #systemType} (The standard that is used to operate and communicate.)
1380         */
1381        public CodeableConcept getSystemType() { 
1382          if (this.systemType == null)
1383            if (Configuration.errorOnAutoCreate())
1384              throw new Error("Attempt to auto-create DeviceSpecializationComponent.systemType");
1385            else if (Configuration.doAutoCreate())
1386              this.systemType = new CodeableConcept(); // cc
1387          return this.systemType;
1388        }
1389
1390        public boolean hasSystemType() { 
1391          return this.systemType != null && !this.systemType.isEmpty();
1392        }
1393
1394        /**
1395         * @param value {@link #systemType} (The standard that is used to operate and communicate.)
1396         */
1397        public DeviceSpecializationComponent setSystemType(CodeableConcept value) { 
1398          this.systemType = value;
1399          return this;
1400        }
1401
1402        /**
1403         * @return {@link #version} (The version of the standard that is used to operate and communicate.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1404         */
1405        public StringType getVersionElement() { 
1406          if (this.version == null)
1407            if (Configuration.errorOnAutoCreate())
1408              throw new Error("Attempt to auto-create DeviceSpecializationComponent.version");
1409            else if (Configuration.doAutoCreate())
1410              this.version = new StringType(); // bb
1411          return this.version;
1412        }
1413
1414        public boolean hasVersionElement() { 
1415          return this.version != null && !this.version.isEmpty();
1416        }
1417
1418        public boolean hasVersion() { 
1419          return this.version != null && !this.version.isEmpty();
1420        }
1421
1422        /**
1423         * @param value {@link #version} (The version of the standard that is used to operate and communicate.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1424         */
1425        public DeviceSpecializationComponent setVersionElement(StringType value) { 
1426          this.version = value;
1427          return this;
1428        }
1429
1430        /**
1431         * @return The version of the standard that is used to operate and communicate.
1432         */
1433        public String getVersion() { 
1434          return this.version == null ? null : this.version.getValue();
1435        }
1436
1437        /**
1438         * @param value The version of the standard that is used to operate and communicate.
1439         */
1440        public DeviceSpecializationComponent setVersion(String value) { 
1441          if (Utilities.noString(value))
1442            this.version = null;
1443          else {
1444            if (this.version == null)
1445              this.version = new StringType();
1446            this.version.setValue(value);
1447          }
1448          return this;
1449        }
1450
1451        protected void listChildren(List<Property> children) {
1452          super.listChildren(children);
1453          children.add(new Property("systemType", "CodeableConcept", "The standard that is used to operate and communicate.", 0, 1, systemType));
1454          children.add(new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version));
1455        }
1456
1457        @Override
1458        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1459          switch (_hash) {
1460          case 642893321: /*systemType*/  return new Property("systemType", "CodeableConcept", "The standard that is used to operate and communicate.", 0, 1, systemType);
1461          case 351608024: /*version*/  return new Property("version", "string", "The version of the standard that is used to operate and communicate.", 0, 1, version);
1462          default: return super.getNamedProperty(_hash, _name, _checkValid);
1463          }
1464
1465        }
1466
1467      @Override
1468      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1469        switch (hash) {
1470        case 642893321: /*systemType*/ return this.systemType == null ? new Base[0] : new Base[] {this.systemType}; // CodeableConcept
1471        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1472        default: return super.getProperty(hash, name, checkValid);
1473        }
1474
1475      }
1476
1477      @Override
1478      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1479        switch (hash) {
1480        case 642893321: // systemType
1481          this.systemType = castToCodeableConcept(value); // CodeableConcept
1482          return value;
1483        case 351608024: // version
1484          this.version = castToString(value); // StringType
1485          return value;
1486        default: return super.setProperty(hash, name, value);
1487        }
1488
1489      }
1490
1491      @Override
1492      public Base setProperty(String name, Base value) throws FHIRException {
1493        if (name.equals("systemType")) {
1494          this.systemType = castToCodeableConcept(value); // CodeableConcept
1495        } else if (name.equals("version")) {
1496          this.version = castToString(value); // StringType
1497        } else
1498          return super.setProperty(name, value);
1499        return value;
1500      }
1501
1502      @Override
1503      public Base makeProperty(int hash, String name) throws FHIRException {
1504        switch (hash) {
1505        case 642893321:  return getSystemType();
1506        case 351608024:  return getVersionElement();
1507        default: return super.makeProperty(hash, name);
1508        }
1509
1510      }
1511
1512      @Override
1513      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1514        switch (hash) {
1515        case 642893321: /*systemType*/ return new String[] {"CodeableConcept"};
1516        case 351608024: /*version*/ return new String[] {"string"};
1517        default: return super.getTypesForProperty(hash, name);
1518        }
1519
1520      }
1521
1522      @Override
1523      public Base addChild(String name) throws FHIRException {
1524        if (name.equals("systemType")) {
1525          this.systemType = new CodeableConcept();
1526          return this.systemType;
1527        }
1528        else if (name.equals("version")) {
1529          throw new FHIRException("Cannot call addChild on a primitive type Device.version");
1530        }
1531        else
1532          return super.addChild(name);
1533      }
1534
1535      public DeviceSpecializationComponent copy() {
1536        DeviceSpecializationComponent dst = new DeviceSpecializationComponent();
1537        copyValues(dst);
1538        return dst;
1539      }
1540
1541      public void copyValues(DeviceSpecializationComponent dst) {
1542        super.copyValues(dst);
1543        dst.systemType = systemType == null ? null : systemType.copy();
1544        dst.version = version == null ? null : version.copy();
1545      }
1546
1547      @Override
1548      public boolean equalsDeep(Base other_) {
1549        if (!super.equalsDeep(other_))
1550          return false;
1551        if (!(other_ instanceof DeviceSpecializationComponent))
1552          return false;
1553        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1554        return compareDeep(systemType, o.systemType, true) && compareDeep(version, o.version, true);
1555      }
1556
1557      @Override
1558      public boolean equalsShallow(Base other_) {
1559        if (!super.equalsShallow(other_))
1560          return false;
1561        if (!(other_ instanceof DeviceSpecializationComponent))
1562          return false;
1563        DeviceSpecializationComponent o = (DeviceSpecializationComponent) other_;
1564        return compareValues(version, o.version, true);
1565      }
1566
1567      public boolean isEmpty() {
1568        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(systemType, version);
1569      }
1570
1571  public String fhirType() {
1572    return "Device.specialization";
1573
1574  }
1575
1576  }
1577
1578    @Block()
1579    public static class DeviceVersionComponent extends BackboneElement implements IBaseBackboneElement {
1580        /**
1581         * The type of the device version, e.g. manufacturer, approved, internal.
1582         */
1583        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1584        @Description(shortDefinition="The type of the device version, e.g. manufacturer, approved, internal", formalDefinition="The type of the device version, e.g. manufacturer, approved, internal." )
1585        protected CodeableConcept type;
1586
1587        /**
1588         * A single component of the device version.
1589         */
1590        @Child(name = "component", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
1591        @Description(shortDefinition="A single component of the device version", formalDefinition="A single component of the device version." )
1592        protected Identifier component;
1593
1594        /**
1595         * The version text.
1596         */
1597        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1598        @Description(shortDefinition="The version text", formalDefinition="The version text." )
1599        protected StringType value;
1600
1601        private static final long serialVersionUID = 645214295L;
1602
1603    /**
1604     * Constructor
1605     */
1606      public DeviceVersionComponent() {
1607        super();
1608      }
1609
1610    /**
1611     * Constructor
1612     */
1613      public DeviceVersionComponent(StringType value) {
1614        super();
1615        this.value = value;
1616      }
1617
1618        /**
1619         * @return {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
1620         */
1621        public CodeableConcept getType() { 
1622          if (this.type == null)
1623            if (Configuration.errorOnAutoCreate())
1624              throw new Error("Attempt to auto-create DeviceVersionComponent.type");
1625            else if (Configuration.doAutoCreate())
1626              this.type = new CodeableConcept(); // cc
1627          return this.type;
1628        }
1629
1630        public boolean hasType() { 
1631          return this.type != null && !this.type.isEmpty();
1632        }
1633
1634        /**
1635         * @param value {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
1636         */
1637        public DeviceVersionComponent setType(CodeableConcept value) { 
1638          this.type = value;
1639          return this;
1640        }
1641
1642        /**
1643         * @return {@link #component} (A single component of the device version.)
1644         */
1645        public Identifier getComponent() { 
1646          if (this.component == null)
1647            if (Configuration.errorOnAutoCreate())
1648              throw new Error("Attempt to auto-create DeviceVersionComponent.component");
1649            else if (Configuration.doAutoCreate())
1650              this.component = new Identifier(); // cc
1651          return this.component;
1652        }
1653
1654        public boolean hasComponent() { 
1655          return this.component != null && !this.component.isEmpty();
1656        }
1657
1658        /**
1659         * @param value {@link #component} (A single component of the device version.)
1660         */
1661        public DeviceVersionComponent setComponent(Identifier value) { 
1662          this.component = value;
1663          return this;
1664        }
1665
1666        /**
1667         * @return {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1668         */
1669        public StringType getValueElement() { 
1670          if (this.value == null)
1671            if (Configuration.errorOnAutoCreate())
1672              throw new Error("Attempt to auto-create DeviceVersionComponent.value");
1673            else if (Configuration.doAutoCreate())
1674              this.value = new StringType(); // bb
1675          return this.value;
1676        }
1677
1678        public boolean hasValueElement() { 
1679          return this.value != null && !this.value.isEmpty();
1680        }
1681
1682        public boolean hasValue() { 
1683          return this.value != null && !this.value.isEmpty();
1684        }
1685
1686        /**
1687         * @param value {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1688         */
1689        public DeviceVersionComponent setValueElement(StringType value) { 
1690          this.value = value;
1691          return this;
1692        }
1693
1694        /**
1695         * @return The version text.
1696         */
1697        public String getValue() { 
1698          return this.value == null ? null : this.value.getValue();
1699        }
1700
1701        /**
1702         * @param value The version text.
1703         */
1704        public DeviceVersionComponent setValue(String value) { 
1705            if (this.value == null)
1706              this.value = new StringType();
1707            this.value.setValue(value);
1708          return this;
1709        }
1710
1711        protected void listChildren(List<Property> children) {
1712          super.listChildren(children);
1713          children.add(new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type));
1714          children.add(new Property("component", "Identifier", "A single component of the device version.", 0, 1, component));
1715          children.add(new Property("value", "string", "The version text.", 0, 1, value));
1716        }
1717
1718        @Override
1719        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1720          switch (_hash) {
1721          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type);
1722          case -1399907075: /*component*/  return new Property("component", "Identifier", "A single component of the device version.", 0, 1, component);
1723          case 111972721: /*value*/  return new Property("value", "string", "The version text.", 0, 1, value);
1724          default: return super.getNamedProperty(_hash, _name, _checkValid);
1725          }
1726
1727        }
1728
1729      @Override
1730      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1731        switch (hash) {
1732        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1733        case -1399907075: /*component*/ return this.component == null ? new Base[0] : new Base[] {this.component}; // Identifier
1734        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
1735        default: return super.getProperty(hash, name, checkValid);
1736        }
1737
1738      }
1739
1740      @Override
1741      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1742        switch (hash) {
1743        case 3575610: // type
1744          this.type = castToCodeableConcept(value); // CodeableConcept
1745          return value;
1746        case -1399907075: // component
1747          this.component = castToIdentifier(value); // Identifier
1748          return value;
1749        case 111972721: // value
1750          this.value = castToString(value); // StringType
1751          return value;
1752        default: return super.setProperty(hash, name, value);
1753        }
1754
1755      }
1756
1757      @Override
1758      public Base setProperty(String name, Base value) throws FHIRException {
1759        if (name.equals("type")) {
1760          this.type = castToCodeableConcept(value); // CodeableConcept
1761        } else if (name.equals("component")) {
1762          this.component = castToIdentifier(value); // Identifier
1763        } else if (name.equals("value")) {
1764          this.value = castToString(value); // StringType
1765        } else
1766          return super.setProperty(name, value);
1767        return value;
1768      }
1769
1770      @Override
1771      public Base makeProperty(int hash, String name) throws FHIRException {
1772        switch (hash) {
1773        case 3575610:  return getType();
1774        case -1399907075:  return getComponent();
1775        case 111972721:  return getValueElement();
1776        default: return super.makeProperty(hash, name);
1777        }
1778
1779      }
1780
1781      @Override
1782      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1783        switch (hash) {
1784        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1785        case -1399907075: /*component*/ return new String[] {"Identifier"};
1786        case 111972721: /*value*/ return new String[] {"string"};
1787        default: return super.getTypesForProperty(hash, name);
1788        }
1789
1790      }
1791
1792      @Override
1793      public Base addChild(String name) throws FHIRException {
1794        if (name.equals("type")) {
1795          this.type = new CodeableConcept();
1796          return this.type;
1797        }
1798        else if (name.equals("component")) {
1799          this.component = new Identifier();
1800          return this.component;
1801        }
1802        else if (name.equals("value")) {
1803          throw new FHIRException("Cannot call addChild on a primitive type Device.value");
1804        }
1805        else
1806          return super.addChild(name);
1807      }
1808
1809      public DeviceVersionComponent copy() {
1810        DeviceVersionComponent dst = new DeviceVersionComponent();
1811        copyValues(dst);
1812        return dst;
1813      }
1814
1815      public void copyValues(DeviceVersionComponent dst) {
1816        super.copyValues(dst);
1817        dst.type = type == null ? null : type.copy();
1818        dst.component = component == null ? null : component.copy();
1819        dst.value = value == null ? null : value.copy();
1820      }
1821
1822      @Override
1823      public boolean equalsDeep(Base other_) {
1824        if (!super.equalsDeep(other_))
1825          return false;
1826        if (!(other_ instanceof DeviceVersionComponent))
1827          return false;
1828        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1829        return compareDeep(type, o.type, true) && compareDeep(component, o.component, true) && compareDeep(value, o.value, true)
1830          ;
1831      }
1832
1833      @Override
1834      public boolean equalsShallow(Base other_) {
1835        if (!super.equalsShallow(other_))
1836          return false;
1837        if (!(other_ instanceof DeviceVersionComponent))
1838          return false;
1839        DeviceVersionComponent o = (DeviceVersionComponent) other_;
1840        return compareValues(value, o.value, true);
1841      }
1842
1843      public boolean isEmpty() {
1844        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, component, value);
1845      }
1846
1847  public String fhirType() {
1848    return "Device.version";
1849
1850  }
1851
1852  }
1853
1854    @Block()
1855    public static class DevicePropertyComponent extends BackboneElement implements IBaseBackboneElement {
1856        /**
1857         * Code that specifies the property DeviceDefinitionPropetyCode (Extensible).
1858         */
1859        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1860        @Description(shortDefinition="Code that specifies the property DeviceDefinitionPropetyCode (Extensible)", formalDefinition="Code that specifies the property DeviceDefinitionPropetyCode (Extensible)." )
1861        protected CodeableConcept type;
1862
1863        /**
1864         * Property value as a quantity.
1865         */
1866        @Child(name = "valueQuantity", type = {Quantity.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1867        @Description(shortDefinition="Property value as a quantity", formalDefinition="Property value as a quantity." )
1868        protected List<Quantity> valueQuantity;
1869
1870        /**
1871         * Property value as a code, e.g., NTP4 (synced to NTP).
1872         */
1873        @Child(name = "valueCode", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1874        @Description(shortDefinition="Property value as a code, e.g., NTP4 (synced to NTP)", formalDefinition="Property value as a code, e.g., NTP4 (synced to NTP)." )
1875        protected List<CodeableConcept> valueCode;
1876
1877        private static final long serialVersionUID = 1512172633L;
1878
1879    /**
1880     * Constructor
1881     */
1882      public DevicePropertyComponent() {
1883        super();
1884      }
1885
1886    /**
1887     * Constructor
1888     */
1889      public DevicePropertyComponent(CodeableConcept type) {
1890        super();
1891        this.type = type;
1892      }
1893
1894        /**
1895         * @return {@link #type} (Code that specifies the property DeviceDefinitionPropetyCode (Extensible).)
1896         */
1897        public CodeableConcept getType() { 
1898          if (this.type == null)
1899            if (Configuration.errorOnAutoCreate())
1900              throw new Error("Attempt to auto-create DevicePropertyComponent.type");
1901            else if (Configuration.doAutoCreate())
1902              this.type = new CodeableConcept(); // cc
1903          return this.type;
1904        }
1905
1906        public boolean hasType() { 
1907          return this.type != null && !this.type.isEmpty();
1908        }
1909
1910        /**
1911         * @param value {@link #type} (Code that specifies the property DeviceDefinitionPropetyCode (Extensible).)
1912         */
1913        public DevicePropertyComponent setType(CodeableConcept value) { 
1914          this.type = value;
1915          return this;
1916        }
1917
1918        /**
1919         * @return {@link #valueQuantity} (Property value as a quantity.)
1920         */
1921        public List<Quantity> getValueQuantity() { 
1922          if (this.valueQuantity == null)
1923            this.valueQuantity = new ArrayList<Quantity>();
1924          return this.valueQuantity;
1925        }
1926
1927        /**
1928         * @return Returns a reference to <code>this</code> for easy method chaining
1929         */
1930        public DevicePropertyComponent setValueQuantity(List<Quantity> theValueQuantity) { 
1931          this.valueQuantity = theValueQuantity;
1932          return this;
1933        }
1934
1935        public boolean hasValueQuantity() { 
1936          if (this.valueQuantity == null)
1937            return false;
1938          for (Quantity item : this.valueQuantity)
1939            if (!item.isEmpty())
1940              return true;
1941          return false;
1942        }
1943
1944        public Quantity addValueQuantity() { //3
1945          Quantity t = new Quantity();
1946          if (this.valueQuantity == null)
1947            this.valueQuantity = new ArrayList<Quantity>();
1948          this.valueQuantity.add(t);
1949          return t;
1950        }
1951
1952        public DevicePropertyComponent addValueQuantity(Quantity t) { //3
1953          if (t == null)
1954            return this;
1955          if (this.valueQuantity == null)
1956            this.valueQuantity = new ArrayList<Quantity>();
1957          this.valueQuantity.add(t);
1958          return this;
1959        }
1960
1961        /**
1962         * @return The first repetition of repeating field {@link #valueQuantity}, creating it if it does not already exist
1963         */
1964        public Quantity getValueQuantityFirstRep() { 
1965          if (getValueQuantity().isEmpty()) {
1966            addValueQuantity();
1967          }
1968          return getValueQuantity().get(0);
1969        }
1970
1971        /**
1972         * @return {@link #valueCode} (Property value as a code, e.g., NTP4 (synced to NTP).)
1973         */
1974        public List<CodeableConcept> getValueCode() { 
1975          if (this.valueCode == null)
1976            this.valueCode = new ArrayList<CodeableConcept>();
1977          return this.valueCode;
1978        }
1979
1980        /**
1981         * @return Returns a reference to <code>this</code> for easy method chaining
1982         */
1983        public DevicePropertyComponent setValueCode(List<CodeableConcept> theValueCode) { 
1984          this.valueCode = theValueCode;
1985          return this;
1986        }
1987
1988        public boolean hasValueCode() { 
1989          if (this.valueCode == null)
1990            return false;
1991          for (CodeableConcept item : this.valueCode)
1992            if (!item.isEmpty())
1993              return true;
1994          return false;
1995        }
1996
1997        public CodeableConcept addValueCode() { //3
1998          CodeableConcept t = new CodeableConcept();
1999          if (this.valueCode == null)
2000            this.valueCode = new ArrayList<CodeableConcept>();
2001          this.valueCode.add(t);
2002          return t;
2003        }
2004
2005        public DevicePropertyComponent addValueCode(CodeableConcept t) { //3
2006          if (t == null)
2007            return this;
2008          if (this.valueCode == null)
2009            this.valueCode = new ArrayList<CodeableConcept>();
2010          this.valueCode.add(t);
2011          return this;
2012        }
2013
2014        /**
2015         * @return The first repetition of repeating field {@link #valueCode}, creating it if it does not already exist
2016         */
2017        public CodeableConcept getValueCodeFirstRep() { 
2018          if (getValueCode().isEmpty()) {
2019            addValueCode();
2020          }
2021          return getValueCode().get(0);
2022        }
2023
2024        protected void listChildren(List<Property> children) {
2025          super.listChildren(children);
2026          children.add(new Property("type", "CodeableConcept", "Code that specifies the property DeviceDefinitionPropetyCode (Extensible).", 0, 1, type));
2027          children.add(new Property("valueQuantity", "Quantity", "Property value as a quantity.", 0, java.lang.Integer.MAX_VALUE, valueQuantity));
2028          children.add(new Property("valueCode", "CodeableConcept", "Property value as a code, e.g., NTP4 (synced to NTP).", 0, java.lang.Integer.MAX_VALUE, valueCode));
2029        }
2030
2031        @Override
2032        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2033          switch (_hash) {
2034          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property DeviceDefinitionPropetyCode (Extensible).", 0, 1, type);
2035          case -2029823716: /*valueQuantity*/  return new Property("valueQuantity", "Quantity", "Property value as a quantity.", 0, java.lang.Integer.MAX_VALUE, valueQuantity);
2036          case -766209282: /*valueCode*/  return new Property("valueCode", "CodeableConcept", "Property value as a code, e.g., NTP4 (synced to NTP).", 0, java.lang.Integer.MAX_VALUE, valueCode);
2037          default: return super.getNamedProperty(_hash, _name, _checkValid);
2038          }
2039
2040        }
2041
2042      @Override
2043      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2044        switch (hash) {
2045        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2046        case -2029823716: /*valueQuantity*/ return this.valueQuantity == null ? new Base[0] : this.valueQuantity.toArray(new Base[this.valueQuantity.size()]); // Quantity
2047        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // CodeableConcept
2048        default: return super.getProperty(hash, name, checkValid);
2049        }
2050
2051      }
2052
2053      @Override
2054      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2055        switch (hash) {
2056        case 3575610: // type
2057          this.type = castToCodeableConcept(value); // CodeableConcept
2058          return value;
2059        case -2029823716: // valueQuantity
2060          this.getValueQuantity().add(castToQuantity(value)); // Quantity
2061          return value;
2062        case -766209282: // valueCode
2063          this.getValueCode().add(castToCodeableConcept(value)); // CodeableConcept
2064          return value;
2065        default: return super.setProperty(hash, name, value);
2066        }
2067
2068      }
2069
2070      @Override
2071      public Base setProperty(String name, Base value) throws FHIRException {
2072        if (name.equals("type")) {
2073          this.type = castToCodeableConcept(value); // CodeableConcept
2074        } else if (name.equals("valueQuantity")) {
2075          this.getValueQuantity().add(castToQuantity(value));
2076        } else if (name.equals("valueCode")) {
2077          this.getValueCode().add(castToCodeableConcept(value));
2078        } else
2079          return super.setProperty(name, value);
2080        return value;
2081      }
2082
2083      @Override
2084      public Base makeProperty(int hash, String name) throws FHIRException {
2085        switch (hash) {
2086        case 3575610:  return getType();
2087        case -2029823716:  return addValueQuantity(); 
2088        case -766209282:  return addValueCode(); 
2089        default: return super.makeProperty(hash, name);
2090        }
2091
2092      }
2093
2094      @Override
2095      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2096        switch (hash) {
2097        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2098        case -2029823716: /*valueQuantity*/ return new String[] {"Quantity"};
2099        case -766209282: /*valueCode*/ return new String[] {"CodeableConcept"};
2100        default: return super.getTypesForProperty(hash, name);
2101        }
2102
2103      }
2104
2105      @Override
2106      public Base addChild(String name) throws FHIRException {
2107        if (name.equals("type")) {
2108          this.type = new CodeableConcept();
2109          return this.type;
2110        }
2111        else if (name.equals("valueQuantity")) {
2112          return addValueQuantity();
2113        }
2114        else if (name.equals("valueCode")) {
2115          return addValueCode();
2116        }
2117        else
2118          return super.addChild(name);
2119      }
2120
2121      public DevicePropertyComponent copy() {
2122        DevicePropertyComponent dst = new DevicePropertyComponent();
2123        copyValues(dst);
2124        return dst;
2125      }
2126
2127      public void copyValues(DevicePropertyComponent dst) {
2128        super.copyValues(dst);
2129        dst.type = type == null ? null : type.copy();
2130        if (valueQuantity != null) {
2131          dst.valueQuantity = new ArrayList<Quantity>();
2132          for (Quantity i : valueQuantity)
2133            dst.valueQuantity.add(i.copy());
2134        };
2135        if (valueCode != null) {
2136          dst.valueCode = new ArrayList<CodeableConcept>();
2137          for (CodeableConcept i : valueCode)
2138            dst.valueCode.add(i.copy());
2139        };
2140      }
2141
2142      @Override
2143      public boolean equalsDeep(Base other_) {
2144        if (!super.equalsDeep(other_))
2145          return false;
2146        if (!(other_ instanceof DevicePropertyComponent))
2147          return false;
2148        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2149        return compareDeep(type, o.type, true) && compareDeep(valueQuantity, o.valueQuantity, true) && compareDeep(valueCode, o.valueCode, true)
2150          ;
2151      }
2152
2153      @Override
2154      public boolean equalsShallow(Base other_) {
2155        if (!super.equalsShallow(other_))
2156          return false;
2157        if (!(other_ instanceof DevicePropertyComponent))
2158          return false;
2159        DevicePropertyComponent o = (DevicePropertyComponent) other_;
2160        return true;
2161      }
2162
2163      public boolean isEmpty() {
2164        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, valueQuantity, valueCode
2165          );
2166      }
2167
2168  public String fhirType() {
2169    return "Device.property";
2170
2171  }
2172
2173  }
2174
2175    /**
2176     * Unique instance identifiers assigned to a device by manufacturers other organizations or owners.
2177     */
2178    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2179    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by manufacturers other organizations or owners." )
2180    protected List<Identifier> identifier;
2181
2182    /**
2183     * The reference to the definition for the device.
2184     */
2185    @Child(name = "definition", type = {DeviceDefinition.class}, order=1, min=0, max=1, modifier=false, summary=false)
2186    @Description(shortDefinition="The reference to the definition for the device", formalDefinition="The reference to the definition for the device." )
2187    protected Reference definition;
2188
2189    /**
2190     * Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.
2191     */
2192    @Child(name = "udiCarrier", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2193    @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string", formalDefinition="Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold." )
2194    protected List<DeviceUdiCarrierComponent> udiCarrier;
2195
2196    /**
2197     * Status of the Device availability.
2198     */
2199    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
2200    @Description(shortDefinition="active | inactive | entered-in-error | unknown", formalDefinition="Status of the Device availability." )
2201    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status")
2202    protected Enumeration<FHIRDeviceStatus> status;
2203
2204    /**
2205     * Reason for the dtatus of the Device availability.
2206     */
2207    @Child(name = "statusReason", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2208    @Description(shortDefinition="online | paused | standby | offline | not-ready | transduc-discon | hw-discon | off", formalDefinition="Reason for the dtatus of the Device availability." )
2209    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-status-reason")
2210    protected List<CodeableConcept> statusReason;
2211
2212    /**
2213     * The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.
2214     */
2215    @Child(name = "distinctIdentifier", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
2216    @Description(shortDefinition="The distinct identification string", formalDefinition="The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product." )
2217    protected StringType distinctIdentifier;
2218
2219    /**
2220     * A name of the manufacturer.
2221     */
2222    @Child(name = "manufacturer", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2223    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer." )
2224    protected StringType manufacturer;
2225
2226    /**
2227     * The date and time when the device was manufactured.
2228     */
2229    @Child(name = "manufactureDate", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
2230    @Description(shortDefinition="Date when the device was made", formalDefinition="The date and time when the device was manufactured." )
2231    protected DateTimeType manufactureDate;
2232
2233    /**
2234     * The date and time beyond which this device is no longer valid or should not be used (if applicable).
2235     */
2236    @Child(name = "expirationDate", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
2237    @Description(shortDefinition="Date and time of expiry of this device (if applicable)", formalDefinition="The date and time beyond which this device is no longer valid or should not be used (if applicable)." )
2238    protected DateTimeType expirationDate;
2239
2240    /**
2241     * Lot number assigned by the manufacturer.
2242     */
2243    @Child(name = "lotNumber", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
2244    @Description(shortDefinition="Lot number of manufacture", formalDefinition="Lot number assigned by the manufacturer." )
2245    protected StringType lotNumber;
2246
2247    /**
2248     * The serial number assigned by the organization when the device was manufactured.
2249     */
2250    @Child(name = "serialNumber", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=false)
2251    @Description(shortDefinition="Serial number assigned by the manufacturer", formalDefinition="The serial number assigned by the organization when the device was manufactured." )
2252    protected StringType serialNumber;
2253
2254    /**
2255     * This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.
2256     */
2257    @Child(name = "deviceName", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2258    @Description(shortDefinition="The name of the device as given by the manufacturer", formalDefinition="This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition." )
2259    protected List<DeviceDeviceNameComponent> deviceName;
2260
2261    /**
2262     * The manufacturer's model number for the device.
2263     */
2264    @Child(name = "modelNumber", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
2265    @Description(shortDefinition="The manufacturer's model number for the device", formalDefinition="The manufacturer's model number for the device." )
2266    protected StringType modelNumber;
2267
2268    /**
2269     * The part number or catalog number of the device.
2270     */
2271    @Child(name = "partNumber", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
2272    @Description(shortDefinition="The part number or catalog number of the device", formalDefinition="The part number or catalog number of the device." )
2273    protected StringType partNumber;
2274
2275    /**
2276     * The kind or type of device.
2277     */
2278    @Child(name = "type", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
2279    @Description(shortDefinition="The kind or type of device", formalDefinition="The kind or type of device." )
2280    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-type")
2281    protected CodeableConcept type;
2282
2283    /**
2284     * The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.
2285     */
2286    @Child(name = "specialization", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2287    @Description(shortDefinition="The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication", formalDefinition="The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication." )
2288    protected List<DeviceSpecializationComponent> specialization;
2289
2290    /**
2291     * The actual design of the device or software version running on the device.
2292     */
2293    @Child(name = "version", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2294    @Description(shortDefinition="The actual design of the device or software version running on the device", formalDefinition="The actual design of the device or software version running on the device." )
2295    protected List<DeviceVersionComponent> version;
2296
2297    /**
2298     * The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.
2299     */
2300    @Child(name = "property", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2301    @Description(shortDefinition="The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties", formalDefinition="The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties." )
2302    protected List<DevicePropertyComponent> property;
2303
2304    /**
2305     * Patient information, If the device is affixed to a person.
2306     */
2307    @Child(name = "patient", type = {Patient.class}, order=18, min=0, max=1, modifier=false, summary=false)
2308    @Description(shortDefinition="Patient to whom Device is affixed", formalDefinition="Patient information, If the device is affixed to a person." )
2309    protected Reference patient;
2310
2311    /**
2312     * An organization that is responsible for the provision and ongoing maintenance of the device.
2313     */
2314    @Child(name = "owner", type = {Organization.class}, order=19, min=0, max=1, modifier=false, summary=false)
2315    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
2316    protected Reference owner;
2317
2318    /**
2319     * Contact details for an organization or a particular human that is responsible for the device.
2320     */
2321    @Child(name = "contact", type = {ContactPoint.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2322    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
2323    protected List<ContactPoint> contact;
2324
2325    /**
2326     * The place where the device can be found.
2327     */
2328    @Child(name = "location", type = {Location.class}, order=21, min=0, max=1, modifier=false, summary=false)
2329    @Description(shortDefinition="Where the device is found", formalDefinition="The place where the device can be found." )
2330    protected Reference location;
2331
2332    /**
2333     * A network address on which the device may be contacted directly.
2334     */
2335    @Child(name = "url", type = {UriType.class}, order=22, min=0, max=1, modifier=false, summary=false)
2336    @Description(shortDefinition="Network address to contact device", formalDefinition="A network address on which the device may be contacted directly." )
2337    protected UriType url;
2338
2339    /**
2340     * Descriptive information, usage information or implantation information that is not captured in an existing element.
2341     */
2342    @Child(name = "note", type = {Annotation.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2343    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
2344    protected List<Annotation> note;
2345
2346    /**
2347     * Provides additional safety characteristics about a medical device.  For example devices containing latex.
2348     */
2349    @Child(name = "safety", type = {CodeableConcept.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2350    @Description(shortDefinition="Safety Characteristics of Device", formalDefinition="Provides additional safety characteristics about a medical device.  For example devices containing latex." )
2351    protected List<CodeableConcept> safety;
2352
2353    /**
2354     * The device that this device is attached to or is part of.
2355     */
2356    @Child(name = "parent", type = {Device.class}, order=25, min=0, max=1, modifier=false, summary=false)
2357    @Description(shortDefinition="The device that this device is attached to or is part of", formalDefinition="The device that this device is attached to or is part of." )
2358    protected Reference parent;
2359
2360    private static final long serialVersionUID = 634832360L;
2361
2362  /**
2363   * Constructor
2364   */
2365    public Device() {
2366      super();
2367    }
2368
2369    /**
2370     * @return {@link #identifier} (Unique instance identifiers assigned to a device by manufacturers other organizations or owners.)
2371     */
2372    public List<Identifier> getIdentifier() { 
2373      if (this.identifier == null)
2374        this.identifier = new ArrayList<Identifier>();
2375      return this.identifier;
2376    }
2377
2378    /**
2379     * @return Returns a reference to <code>this</code> for easy method chaining
2380     */
2381    public Device setIdentifier(List<Identifier> theIdentifier) { 
2382      this.identifier = theIdentifier;
2383      return this;
2384    }
2385
2386    public boolean hasIdentifier() { 
2387      if (this.identifier == null)
2388        return false;
2389      for (Identifier item : this.identifier)
2390        if (!item.isEmpty())
2391          return true;
2392      return false;
2393    }
2394
2395    public Identifier addIdentifier() { //3
2396      Identifier t = new Identifier();
2397      if (this.identifier == null)
2398        this.identifier = new ArrayList<Identifier>();
2399      this.identifier.add(t);
2400      return t;
2401    }
2402
2403    public Device addIdentifier(Identifier t) { //3
2404      if (t == null)
2405        return this;
2406      if (this.identifier == null)
2407        this.identifier = new ArrayList<Identifier>();
2408      this.identifier.add(t);
2409      return this;
2410    }
2411
2412    /**
2413     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2414     */
2415    public Identifier getIdentifierFirstRep() { 
2416      if (getIdentifier().isEmpty()) {
2417        addIdentifier();
2418      }
2419      return getIdentifier().get(0);
2420    }
2421
2422    /**
2423     * @return {@link #definition} (The reference to the definition for the device.)
2424     */
2425    public Reference getDefinition() { 
2426      if (this.definition == null)
2427        if (Configuration.errorOnAutoCreate())
2428          throw new Error("Attempt to auto-create Device.definition");
2429        else if (Configuration.doAutoCreate())
2430          this.definition = new Reference(); // cc
2431      return this.definition;
2432    }
2433
2434    public boolean hasDefinition() { 
2435      return this.definition != null && !this.definition.isEmpty();
2436    }
2437
2438    /**
2439     * @param value {@link #definition} (The reference to the definition for the device.)
2440     */
2441    public Device setDefinition(Reference value) { 
2442      this.definition = value;
2443      return this;
2444    }
2445
2446    /**
2447     * @return {@link #udiCarrier} (Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.)
2448     */
2449    public List<DeviceUdiCarrierComponent> getUdiCarrier() { 
2450      if (this.udiCarrier == null)
2451        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2452      return this.udiCarrier;
2453    }
2454
2455    /**
2456     * @return Returns a reference to <code>this</code> for easy method chaining
2457     */
2458    public Device setUdiCarrier(List<DeviceUdiCarrierComponent> theUdiCarrier) { 
2459      this.udiCarrier = theUdiCarrier;
2460      return this;
2461    }
2462
2463    public boolean hasUdiCarrier() { 
2464      if (this.udiCarrier == null)
2465        return false;
2466      for (DeviceUdiCarrierComponent item : this.udiCarrier)
2467        if (!item.isEmpty())
2468          return true;
2469      return false;
2470    }
2471
2472    public DeviceUdiCarrierComponent addUdiCarrier() { //3
2473      DeviceUdiCarrierComponent t = new DeviceUdiCarrierComponent();
2474      if (this.udiCarrier == null)
2475        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2476      this.udiCarrier.add(t);
2477      return t;
2478    }
2479
2480    public Device addUdiCarrier(DeviceUdiCarrierComponent t) { //3
2481      if (t == null)
2482        return this;
2483      if (this.udiCarrier == null)
2484        this.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
2485      this.udiCarrier.add(t);
2486      return this;
2487    }
2488
2489    /**
2490     * @return The first repetition of repeating field {@link #udiCarrier}, creating it if it does not already exist
2491     */
2492    public DeviceUdiCarrierComponent getUdiCarrierFirstRep() { 
2493      if (getUdiCarrier().isEmpty()) {
2494        addUdiCarrier();
2495      }
2496      return getUdiCarrier().get(0);
2497    }
2498
2499    /**
2500     * @return {@link #status} (Status of the Device availability.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2501     */
2502    public Enumeration<FHIRDeviceStatus> getStatusElement() { 
2503      if (this.status == null)
2504        if (Configuration.errorOnAutoCreate())
2505          throw new Error("Attempt to auto-create Device.status");
2506        else if (Configuration.doAutoCreate())
2507          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory()); // bb
2508      return this.status;
2509    }
2510
2511    public boolean hasStatusElement() { 
2512      return this.status != null && !this.status.isEmpty();
2513    }
2514
2515    public boolean hasStatus() { 
2516      return this.status != null && !this.status.isEmpty();
2517    }
2518
2519    /**
2520     * @param value {@link #status} (Status of the Device availability.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2521     */
2522    public Device setStatusElement(Enumeration<FHIRDeviceStatus> value) { 
2523      this.status = value;
2524      return this;
2525    }
2526
2527    /**
2528     * @return Status of the Device availability.
2529     */
2530    public FHIRDeviceStatus getStatus() { 
2531      return this.status == null ? null : this.status.getValue();
2532    }
2533
2534    /**
2535     * @param value Status of the Device availability.
2536     */
2537    public Device setStatus(FHIRDeviceStatus value) { 
2538      if (value == null)
2539        this.status = null;
2540      else {
2541        if (this.status == null)
2542          this.status = new Enumeration<FHIRDeviceStatus>(new FHIRDeviceStatusEnumFactory());
2543        this.status.setValue(value);
2544      }
2545      return this;
2546    }
2547
2548    /**
2549     * @return {@link #statusReason} (Reason for the dtatus of the Device availability.)
2550     */
2551    public List<CodeableConcept> getStatusReason() { 
2552      if (this.statusReason == null)
2553        this.statusReason = new ArrayList<CodeableConcept>();
2554      return this.statusReason;
2555    }
2556
2557    /**
2558     * @return Returns a reference to <code>this</code> for easy method chaining
2559     */
2560    public Device setStatusReason(List<CodeableConcept> theStatusReason) { 
2561      this.statusReason = theStatusReason;
2562      return this;
2563    }
2564
2565    public boolean hasStatusReason() { 
2566      if (this.statusReason == null)
2567        return false;
2568      for (CodeableConcept item : this.statusReason)
2569        if (!item.isEmpty())
2570          return true;
2571      return false;
2572    }
2573
2574    public CodeableConcept addStatusReason() { //3
2575      CodeableConcept t = new CodeableConcept();
2576      if (this.statusReason == null)
2577        this.statusReason = new ArrayList<CodeableConcept>();
2578      this.statusReason.add(t);
2579      return t;
2580    }
2581
2582    public Device addStatusReason(CodeableConcept t) { //3
2583      if (t == null)
2584        return this;
2585      if (this.statusReason == null)
2586        this.statusReason = new ArrayList<CodeableConcept>();
2587      this.statusReason.add(t);
2588      return this;
2589    }
2590
2591    /**
2592     * @return The first repetition of repeating field {@link #statusReason}, creating it if it does not already exist
2593     */
2594    public CodeableConcept getStatusReasonFirstRep() { 
2595      if (getStatusReason().isEmpty()) {
2596        addStatusReason();
2597      }
2598      return getStatusReason().get(0);
2599    }
2600
2601    /**
2602     * @return {@link #distinctIdentifier} (The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.). This is the underlying object with id, value and extensions. The accessor "getDistinctIdentifier" gives direct access to the value
2603     */
2604    public StringType getDistinctIdentifierElement() { 
2605      if (this.distinctIdentifier == null)
2606        if (Configuration.errorOnAutoCreate())
2607          throw new Error("Attempt to auto-create Device.distinctIdentifier");
2608        else if (Configuration.doAutoCreate())
2609          this.distinctIdentifier = new StringType(); // bb
2610      return this.distinctIdentifier;
2611    }
2612
2613    public boolean hasDistinctIdentifierElement() { 
2614      return this.distinctIdentifier != null && !this.distinctIdentifier.isEmpty();
2615    }
2616
2617    public boolean hasDistinctIdentifier() { 
2618      return this.distinctIdentifier != null && !this.distinctIdentifier.isEmpty();
2619    }
2620
2621    /**
2622     * @param value {@link #distinctIdentifier} (The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.). This is the underlying object with id, value and extensions. The accessor "getDistinctIdentifier" gives direct access to the value
2623     */
2624    public Device setDistinctIdentifierElement(StringType value) { 
2625      this.distinctIdentifier = value;
2626      return this;
2627    }
2628
2629    /**
2630     * @return The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.
2631     */
2632    public String getDistinctIdentifier() { 
2633      return this.distinctIdentifier == null ? null : this.distinctIdentifier.getValue();
2634    }
2635
2636    /**
2637     * @param value The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.
2638     */
2639    public Device setDistinctIdentifier(String value) { 
2640      if (Utilities.noString(value))
2641        this.distinctIdentifier = null;
2642      else {
2643        if (this.distinctIdentifier == null)
2644          this.distinctIdentifier = new StringType();
2645        this.distinctIdentifier.setValue(value);
2646      }
2647      return this;
2648    }
2649
2650    /**
2651     * @return {@link #manufacturer} (A name of the manufacturer.). This is the underlying object with id, value and extensions. The accessor "getManufacturer" gives direct access to the value
2652     */
2653    public StringType getManufacturerElement() { 
2654      if (this.manufacturer == null)
2655        if (Configuration.errorOnAutoCreate())
2656          throw new Error("Attempt to auto-create Device.manufacturer");
2657        else if (Configuration.doAutoCreate())
2658          this.manufacturer = new StringType(); // bb
2659      return this.manufacturer;
2660    }
2661
2662    public boolean hasManufacturerElement() { 
2663      return this.manufacturer != null && !this.manufacturer.isEmpty();
2664    }
2665
2666    public boolean hasManufacturer() { 
2667      return this.manufacturer != null && !this.manufacturer.isEmpty();
2668    }
2669
2670    /**
2671     * @param value {@link #manufacturer} (A name of the manufacturer.). This is the underlying object with id, value and extensions. The accessor "getManufacturer" gives direct access to the value
2672     */
2673    public Device setManufacturerElement(StringType value) { 
2674      this.manufacturer = value;
2675      return this;
2676    }
2677
2678    /**
2679     * @return A name of the manufacturer.
2680     */
2681    public String getManufacturer() { 
2682      return this.manufacturer == null ? null : this.manufacturer.getValue();
2683    }
2684
2685    /**
2686     * @param value A name of the manufacturer.
2687     */
2688    public Device setManufacturer(String value) { 
2689      if (Utilities.noString(value))
2690        this.manufacturer = null;
2691      else {
2692        if (this.manufacturer == null)
2693          this.manufacturer = new StringType();
2694        this.manufacturer.setValue(value);
2695      }
2696      return this;
2697    }
2698
2699    /**
2700     * @return {@link #manufactureDate} (The date and time when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getManufactureDate" gives direct access to the value
2701     */
2702    public DateTimeType getManufactureDateElement() { 
2703      if (this.manufactureDate == null)
2704        if (Configuration.errorOnAutoCreate())
2705          throw new Error("Attempt to auto-create Device.manufactureDate");
2706        else if (Configuration.doAutoCreate())
2707          this.manufactureDate = new DateTimeType(); // bb
2708      return this.manufactureDate;
2709    }
2710
2711    public boolean hasManufactureDateElement() { 
2712      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
2713    }
2714
2715    public boolean hasManufactureDate() { 
2716      return this.manufactureDate != null && !this.manufactureDate.isEmpty();
2717    }
2718
2719    /**
2720     * @param value {@link #manufactureDate} (The date and time when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getManufactureDate" gives direct access to the value
2721     */
2722    public Device setManufactureDateElement(DateTimeType value) { 
2723      this.manufactureDate = value;
2724      return this;
2725    }
2726
2727    /**
2728     * @return The date and time when the device was manufactured.
2729     */
2730    public Date getManufactureDate() { 
2731      return this.manufactureDate == null ? null : this.manufactureDate.getValue();
2732    }
2733
2734    /**
2735     * @param value The date and time when the device was manufactured.
2736     */
2737    public Device setManufactureDate(Date value) { 
2738      if (value == null)
2739        this.manufactureDate = null;
2740      else {
2741        if (this.manufactureDate == null)
2742          this.manufactureDate = new DateTimeType();
2743        this.manufactureDate.setValue(value);
2744      }
2745      return this;
2746    }
2747
2748    /**
2749     * @return {@link #expirationDate} (The date and time beyond which this device is no longer valid or should not be used (if applicable).). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
2750     */
2751    public DateTimeType getExpirationDateElement() { 
2752      if (this.expirationDate == null)
2753        if (Configuration.errorOnAutoCreate())
2754          throw new Error("Attempt to auto-create Device.expirationDate");
2755        else if (Configuration.doAutoCreate())
2756          this.expirationDate = new DateTimeType(); // bb
2757      return this.expirationDate;
2758    }
2759
2760    public boolean hasExpirationDateElement() { 
2761      return this.expirationDate != null && !this.expirationDate.isEmpty();
2762    }
2763
2764    public boolean hasExpirationDate() { 
2765      return this.expirationDate != null && !this.expirationDate.isEmpty();
2766    }
2767
2768    /**
2769     * @param value {@link #expirationDate} (The date and time beyond which this device is no longer valid or should not be used (if applicable).). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
2770     */
2771    public Device setExpirationDateElement(DateTimeType value) { 
2772      this.expirationDate = value;
2773      return this;
2774    }
2775
2776    /**
2777     * @return The date and time beyond which this device is no longer valid or should not be used (if applicable).
2778     */
2779    public Date getExpirationDate() { 
2780      return this.expirationDate == null ? null : this.expirationDate.getValue();
2781    }
2782
2783    /**
2784     * @param value The date and time beyond which this device is no longer valid or should not be used (if applicable).
2785     */
2786    public Device setExpirationDate(Date value) { 
2787      if (value == null)
2788        this.expirationDate = null;
2789      else {
2790        if (this.expirationDate == null)
2791          this.expirationDate = new DateTimeType();
2792        this.expirationDate.setValue(value);
2793      }
2794      return this;
2795    }
2796
2797    /**
2798     * @return {@link #lotNumber} (Lot number assigned by the manufacturer.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
2799     */
2800    public StringType getLotNumberElement() { 
2801      if (this.lotNumber == null)
2802        if (Configuration.errorOnAutoCreate())
2803          throw new Error("Attempt to auto-create Device.lotNumber");
2804        else if (Configuration.doAutoCreate())
2805          this.lotNumber = new StringType(); // bb
2806      return this.lotNumber;
2807    }
2808
2809    public boolean hasLotNumberElement() { 
2810      return this.lotNumber != null && !this.lotNumber.isEmpty();
2811    }
2812
2813    public boolean hasLotNumber() { 
2814      return this.lotNumber != null && !this.lotNumber.isEmpty();
2815    }
2816
2817    /**
2818     * @param value {@link #lotNumber} (Lot number assigned by the manufacturer.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value
2819     */
2820    public Device setLotNumberElement(StringType value) { 
2821      this.lotNumber = value;
2822      return this;
2823    }
2824
2825    /**
2826     * @return Lot number assigned by the manufacturer.
2827     */
2828    public String getLotNumber() { 
2829      return this.lotNumber == null ? null : this.lotNumber.getValue();
2830    }
2831
2832    /**
2833     * @param value Lot number assigned by the manufacturer.
2834     */
2835    public Device setLotNumber(String value) { 
2836      if (Utilities.noString(value))
2837        this.lotNumber = null;
2838      else {
2839        if (this.lotNumber == null)
2840          this.lotNumber = new StringType();
2841        this.lotNumber.setValue(value);
2842      }
2843      return this;
2844    }
2845
2846    /**
2847     * @return {@link #serialNumber} (The serial number assigned by the organization when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
2848     */
2849    public StringType getSerialNumberElement() { 
2850      if (this.serialNumber == null)
2851        if (Configuration.errorOnAutoCreate())
2852          throw new Error("Attempt to auto-create Device.serialNumber");
2853        else if (Configuration.doAutoCreate())
2854          this.serialNumber = new StringType(); // bb
2855      return this.serialNumber;
2856    }
2857
2858    public boolean hasSerialNumberElement() { 
2859      return this.serialNumber != null && !this.serialNumber.isEmpty();
2860    }
2861
2862    public boolean hasSerialNumber() { 
2863      return this.serialNumber != null && !this.serialNumber.isEmpty();
2864    }
2865
2866    /**
2867     * @param value {@link #serialNumber} (The serial number assigned by the organization when the device was manufactured.). This is the underlying object with id, value and extensions. The accessor "getSerialNumber" gives direct access to the value
2868     */
2869    public Device setSerialNumberElement(StringType value) { 
2870      this.serialNumber = value;
2871      return this;
2872    }
2873
2874    /**
2875     * @return The serial number assigned by the organization when the device was manufactured.
2876     */
2877    public String getSerialNumber() { 
2878      return this.serialNumber == null ? null : this.serialNumber.getValue();
2879    }
2880
2881    /**
2882     * @param value The serial number assigned by the organization when the device was manufactured.
2883     */
2884    public Device setSerialNumber(String value) { 
2885      if (Utilities.noString(value))
2886        this.serialNumber = null;
2887      else {
2888        if (this.serialNumber == null)
2889          this.serialNumber = new StringType();
2890        this.serialNumber.setValue(value);
2891      }
2892      return this;
2893    }
2894
2895    /**
2896     * @return {@link #deviceName} (This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.)
2897     */
2898    public List<DeviceDeviceNameComponent> getDeviceName() { 
2899      if (this.deviceName == null)
2900        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2901      return this.deviceName;
2902    }
2903
2904    /**
2905     * @return Returns a reference to <code>this</code> for easy method chaining
2906     */
2907    public Device setDeviceName(List<DeviceDeviceNameComponent> theDeviceName) { 
2908      this.deviceName = theDeviceName;
2909      return this;
2910    }
2911
2912    public boolean hasDeviceName() { 
2913      if (this.deviceName == null)
2914        return false;
2915      for (DeviceDeviceNameComponent item : this.deviceName)
2916        if (!item.isEmpty())
2917          return true;
2918      return false;
2919    }
2920
2921    public DeviceDeviceNameComponent addDeviceName() { //3
2922      DeviceDeviceNameComponent t = new DeviceDeviceNameComponent();
2923      if (this.deviceName == null)
2924        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2925      this.deviceName.add(t);
2926      return t;
2927    }
2928
2929    public Device addDeviceName(DeviceDeviceNameComponent t) { //3
2930      if (t == null)
2931        return this;
2932      if (this.deviceName == null)
2933        this.deviceName = new ArrayList<DeviceDeviceNameComponent>();
2934      this.deviceName.add(t);
2935      return this;
2936    }
2937
2938    /**
2939     * @return The first repetition of repeating field {@link #deviceName}, creating it if it does not already exist
2940     */
2941    public DeviceDeviceNameComponent getDeviceNameFirstRep() { 
2942      if (getDeviceName().isEmpty()) {
2943        addDeviceName();
2944      }
2945      return getDeviceName().get(0);
2946    }
2947
2948    /**
2949     * @return {@link #modelNumber} (The manufacturer's model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
2950     */
2951    public StringType getModelNumberElement() { 
2952      if (this.modelNumber == null)
2953        if (Configuration.errorOnAutoCreate())
2954          throw new Error("Attempt to auto-create Device.modelNumber");
2955        else if (Configuration.doAutoCreate())
2956          this.modelNumber = new StringType(); // bb
2957      return this.modelNumber;
2958    }
2959
2960    public boolean hasModelNumberElement() { 
2961      return this.modelNumber != null && !this.modelNumber.isEmpty();
2962    }
2963
2964    public boolean hasModelNumber() { 
2965      return this.modelNumber != null && !this.modelNumber.isEmpty();
2966    }
2967
2968    /**
2969     * @param value {@link #modelNumber} (The manufacturer's model number for the device.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
2970     */
2971    public Device setModelNumberElement(StringType value) { 
2972      this.modelNumber = value;
2973      return this;
2974    }
2975
2976    /**
2977     * @return The manufacturer's model number for the device.
2978     */
2979    public String getModelNumber() { 
2980      return this.modelNumber == null ? null : this.modelNumber.getValue();
2981    }
2982
2983    /**
2984     * @param value The manufacturer's model number for the device.
2985     */
2986    public Device setModelNumber(String value) { 
2987      if (Utilities.noString(value))
2988        this.modelNumber = null;
2989      else {
2990        if (this.modelNumber == null)
2991          this.modelNumber = new StringType();
2992        this.modelNumber.setValue(value);
2993      }
2994      return this;
2995    }
2996
2997    /**
2998     * @return {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
2999     */
3000    public StringType getPartNumberElement() { 
3001      if (this.partNumber == null)
3002        if (Configuration.errorOnAutoCreate())
3003          throw new Error("Attempt to auto-create Device.partNumber");
3004        else if (Configuration.doAutoCreate())
3005          this.partNumber = new StringType(); // bb
3006      return this.partNumber;
3007    }
3008
3009    public boolean hasPartNumberElement() { 
3010      return this.partNumber != null && !this.partNumber.isEmpty();
3011    }
3012
3013    public boolean hasPartNumber() { 
3014      return this.partNumber != null && !this.partNumber.isEmpty();
3015    }
3016
3017    /**
3018     * @param value {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
3019     */
3020    public Device setPartNumberElement(StringType value) { 
3021      this.partNumber = value;
3022      return this;
3023    }
3024
3025    /**
3026     * @return The part number or catalog number of the device.
3027     */
3028    public String getPartNumber() { 
3029      return this.partNumber == null ? null : this.partNumber.getValue();
3030    }
3031
3032    /**
3033     * @param value The part number or catalog number of the device.
3034     */
3035    public Device setPartNumber(String value) { 
3036      if (Utilities.noString(value))
3037        this.partNumber = null;
3038      else {
3039        if (this.partNumber == null)
3040          this.partNumber = new StringType();
3041        this.partNumber.setValue(value);
3042      }
3043      return this;
3044    }
3045
3046    /**
3047     * @return {@link #type} (The kind or type of device.)
3048     */
3049    public CodeableConcept getType() { 
3050      if (this.type == null)
3051        if (Configuration.errorOnAutoCreate())
3052          throw new Error("Attempt to auto-create Device.type");
3053        else if (Configuration.doAutoCreate())
3054          this.type = new CodeableConcept(); // cc
3055      return this.type;
3056    }
3057
3058    public boolean hasType() { 
3059      return this.type != null && !this.type.isEmpty();
3060    }
3061
3062    /**
3063     * @param value {@link #type} (The kind or type of device.)
3064     */
3065    public Device setType(CodeableConcept value) { 
3066      this.type = value;
3067      return this;
3068    }
3069
3070    /**
3071     * @return {@link #specialization} (The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.)
3072     */
3073    public List<DeviceSpecializationComponent> getSpecialization() { 
3074      if (this.specialization == null)
3075        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3076      return this.specialization;
3077    }
3078
3079    /**
3080     * @return Returns a reference to <code>this</code> for easy method chaining
3081     */
3082    public Device setSpecialization(List<DeviceSpecializationComponent> theSpecialization) { 
3083      this.specialization = theSpecialization;
3084      return this;
3085    }
3086
3087    public boolean hasSpecialization() { 
3088      if (this.specialization == null)
3089        return false;
3090      for (DeviceSpecializationComponent item : this.specialization)
3091        if (!item.isEmpty())
3092          return true;
3093      return false;
3094    }
3095
3096    public DeviceSpecializationComponent addSpecialization() { //3
3097      DeviceSpecializationComponent t = new DeviceSpecializationComponent();
3098      if (this.specialization == null)
3099        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3100      this.specialization.add(t);
3101      return t;
3102    }
3103
3104    public Device addSpecialization(DeviceSpecializationComponent t) { //3
3105      if (t == null)
3106        return this;
3107      if (this.specialization == null)
3108        this.specialization = new ArrayList<DeviceSpecializationComponent>();
3109      this.specialization.add(t);
3110      return this;
3111    }
3112
3113    /**
3114     * @return The first repetition of repeating field {@link #specialization}, creating it if it does not already exist
3115     */
3116    public DeviceSpecializationComponent getSpecializationFirstRep() { 
3117      if (getSpecialization().isEmpty()) {
3118        addSpecialization();
3119      }
3120      return getSpecialization().get(0);
3121    }
3122
3123    /**
3124     * @return {@link #version} (The actual design of the device or software version running on the device.)
3125     */
3126    public List<DeviceVersionComponent> getVersion() { 
3127      if (this.version == null)
3128        this.version = new ArrayList<DeviceVersionComponent>();
3129      return this.version;
3130    }
3131
3132    /**
3133     * @return Returns a reference to <code>this</code> for easy method chaining
3134     */
3135    public Device setVersion(List<DeviceVersionComponent> theVersion) { 
3136      this.version = theVersion;
3137      return this;
3138    }
3139
3140    public boolean hasVersion() { 
3141      if (this.version == null)
3142        return false;
3143      for (DeviceVersionComponent item : this.version)
3144        if (!item.isEmpty())
3145          return true;
3146      return false;
3147    }
3148
3149    public DeviceVersionComponent addVersion() { //3
3150      DeviceVersionComponent t = new DeviceVersionComponent();
3151      if (this.version == null)
3152        this.version = new ArrayList<DeviceVersionComponent>();
3153      this.version.add(t);
3154      return t;
3155    }
3156
3157    public Device addVersion(DeviceVersionComponent t) { //3
3158      if (t == null)
3159        return this;
3160      if (this.version == null)
3161        this.version = new ArrayList<DeviceVersionComponent>();
3162      this.version.add(t);
3163      return this;
3164    }
3165
3166    /**
3167     * @return The first repetition of repeating field {@link #version}, creating it if it does not already exist
3168     */
3169    public DeviceVersionComponent getVersionFirstRep() { 
3170      if (getVersion().isEmpty()) {
3171        addVersion();
3172      }
3173      return getVersion().get(0);
3174    }
3175
3176    /**
3177     * @return {@link #property} (The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.)
3178     */
3179    public List<DevicePropertyComponent> getProperty() { 
3180      if (this.property == null)
3181        this.property = new ArrayList<DevicePropertyComponent>();
3182      return this.property;
3183    }
3184
3185    /**
3186     * @return Returns a reference to <code>this</code> for easy method chaining
3187     */
3188    public Device setProperty(List<DevicePropertyComponent> theProperty) { 
3189      this.property = theProperty;
3190      return this;
3191    }
3192
3193    public boolean hasProperty() { 
3194      if (this.property == null)
3195        return false;
3196      for (DevicePropertyComponent item : this.property)
3197        if (!item.isEmpty())
3198          return true;
3199      return false;
3200    }
3201
3202    public DevicePropertyComponent addProperty() { //3
3203      DevicePropertyComponent t = new DevicePropertyComponent();
3204      if (this.property == null)
3205        this.property = new ArrayList<DevicePropertyComponent>();
3206      this.property.add(t);
3207      return t;
3208    }
3209
3210    public Device addProperty(DevicePropertyComponent t) { //3
3211      if (t == null)
3212        return this;
3213      if (this.property == null)
3214        this.property = new ArrayList<DevicePropertyComponent>();
3215      this.property.add(t);
3216      return this;
3217    }
3218
3219    /**
3220     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist
3221     */
3222    public DevicePropertyComponent getPropertyFirstRep() { 
3223      if (getProperty().isEmpty()) {
3224        addProperty();
3225      }
3226      return getProperty().get(0);
3227    }
3228
3229    /**
3230     * @return {@link #patient} (Patient information, If the device is affixed to a person.)
3231     */
3232    public Reference getPatient() { 
3233      if (this.patient == null)
3234        if (Configuration.errorOnAutoCreate())
3235          throw new Error("Attempt to auto-create Device.patient");
3236        else if (Configuration.doAutoCreate())
3237          this.patient = new Reference(); // cc
3238      return this.patient;
3239    }
3240
3241    public boolean hasPatient() { 
3242      return this.patient != null && !this.patient.isEmpty();
3243    }
3244
3245    /**
3246     * @param value {@link #patient} (Patient information, If the device is affixed to a person.)
3247     */
3248    public Device setPatient(Reference value) { 
3249      this.patient = value;
3250      return this;
3251    }
3252
3253    /**
3254     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
3255     */
3256    public Reference getOwner() { 
3257      if (this.owner == null)
3258        if (Configuration.errorOnAutoCreate())
3259          throw new Error("Attempt to auto-create Device.owner");
3260        else if (Configuration.doAutoCreate())
3261          this.owner = new Reference(); // cc
3262      return this.owner;
3263    }
3264
3265    public boolean hasOwner() { 
3266      return this.owner != null && !this.owner.isEmpty();
3267    }
3268
3269    /**
3270     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
3271     */
3272    public Device setOwner(Reference value) { 
3273      this.owner = value;
3274      return this;
3275    }
3276
3277    /**
3278     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
3279     */
3280    public List<ContactPoint> getContact() { 
3281      if (this.contact == null)
3282        this.contact = new ArrayList<ContactPoint>();
3283      return this.contact;
3284    }
3285
3286    /**
3287     * @return Returns a reference to <code>this</code> for easy method chaining
3288     */
3289    public Device setContact(List<ContactPoint> theContact) { 
3290      this.contact = theContact;
3291      return this;
3292    }
3293
3294    public boolean hasContact() { 
3295      if (this.contact == null)
3296        return false;
3297      for (ContactPoint item : this.contact)
3298        if (!item.isEmpty())
3299          return true;
3300      return false;
3301    }
3302
3303    public ContactPoint addContact() { //3
3304      ContactPoint t = new ContactPoint();
3305      if (this.contact == null)
3306        this.contact = new ArrayList<ContactPoint>();
3307      this.contact.add(t);
3308      return t;
3309    }
3310
3311    public Device addContact(ContactPoint t) { //3
3312      if (t == null)
3313        return this;
3314      if (this.contact == null)
3315        this.contact = new ArrayList<ContactPoint>();
3316      this.contact.add(t);
3317      return this;
3318    }
3319
3320    /**
3321     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
3322     */
3323    public ContactPoint getContactFirstRep() { 
3324      if (getContact().isEmpty()) {
3325        addContact();
3326      }
3327      return getContact().get(0);
3328    }
3329
3330    /**
3331     * @return {@link #location} (The place where the device can be found.)
3332     */
3333    public Reference getLocation() { 
3334      if (this.location == null)
3335        if (Configuration.errorOnAutoCreate())
3336          throw new Error("Attempt to auto-create Device.location");
3337        else if (Configuration.doAutoCreate())
3338          this.location = new Reference(); // cc
3339      return this.location;
3340    }
3341
3342    public boolean hasLocation() { 
3343      return this.location != null && !this.location.isEmpty();
3344    }
3345
3346    /**
3347     * @param value {@link #location} (The place where the device can be found.)
3348     */
3349    public Device setLocation(Reference value) { 
3350      this.location = value;
3351      return this;
3352    }
3353
3354    /**
3355     * @return {@link #url} (A network address on which the device may be contacted directly.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3356     */
3357    public UriType getUrlElement() { 
3358      if (this.url == null)
3359        if (Configuration.errorOnAutoCreate())
3360          throw new Error("Attempt to auto-create Device.url");
3361        else if (Configuration.doAutoCreate())
3362          this.url = new UriType(); // bb
3363      return this.url;
3364    }
3365
3366    public boolean hasUrlElement() { 
3367      return this.url != null && !this.url.isEmpty();
3368    }
3369
3370    public boolean hasUrl() { 
3371      return this.url != null && !this.url.isEmpty();
3372    }
3373
3374    /**
3375     * @param value {@link #url} (A network address on which the device may be contacted directly.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3376     */
3377    public Device setUrlElement(UriType value) { 
3378      this.url = value;
3379      return this;
3380    }
3381
3382    /**
3383     * @return A network address on which the device may be contacted directly.
3384     */
3385    public String getUrl() { 
3386      return this.url == null ? null : this.url.getValue();
3387    }
3388
3389    /**
3390     * @param value A network address on which the device may be contacted directly.
3391     */
3392    public Device setUrl(String value) { 
3393      if (Utilities.noString(value))
3394        this.url = null;
3395      else {
3396        if (this.url == null)
3397          this.url = new UriType();
3398        this.url.setValue(value);
3399      }
3400      return this;
3401    }
3402
3403    /**
3404     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
3405     */
3406    public List<Annotation> getNote() { 
3407      if (this.note == null)
3408        this.note = new ArrayList<Annotation>();
3409      return this.note;
3410    }
3411
3412    /**
3413     * @return Returns a reference to <code>this</code> for easy method chaining
3414     */
3415    public Device setNote(List<Annotation> theNote) { 
3416      this.note = theNote;
3417      return this;
3418    }
3419
3420    public boolean hasNote() { 
3421      if (this.note == null)
3422        return false;
3423      for (Annotation item : this.note)
3424        if (!item.isEmpty())
3425          return true;
3426      return false;
3427    }
3428
3429    public Annotation addNote() { //3
3430      Annotation t = new Annotation();
3431      if (this.note == null)
3432        this.note = new ArrayList<Annotation>();
3433      this.note.add(t);
3434      return t;
3435    }
3436
3437    public Device addNote(Annotation t) { //3
3438      if (t == null)
3439        return this;
3440      if (this.note == null)
3441        this.note = new ArrayList<Annotation>();
3442      this.note.add(t);
3443      return this;
3444    }
3445
3446    /**
3447     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3448     */
3449    public Annotation getNoteFirstRep() { 
3450      if (getNote().isEmpty()) {
3451        addNote();
3452      }
3453      return getNote().get(0);
3454    }
3455
3456    /**
3457     * @return {@link #safety} (Provides additional safety characteristics about a medical device.  For example devices containing latex.)
3458     */
3459    public List<CodeableConcept> getSafety() { 
3460      if (this.safety == null)
3461        this.safety = new ArrayList<CodeableConcept>();
3462      return this.safety;
3463    }
3464
3465    /**
3466     * @return Returns a reference to <code>this</code> for easy method chaining
3467     */
3468    public Device setSafety(List<CodeableConcept> theSafety) { 
3469      this.safety = theSafety;
3470      return this;
3471    }
3472
3473    public boolean hasSafety() { 
3474      if (this.safety == null)
3475        return false;
3476      for (CodeableConcept item : this.safety)
3477        if (!item.isEmpty())
3478          return true;
3479      return false;
3480    }
3481
3482    public CodeableConcept addSafety() { //3
3483      CodeableConcept t = new CodeableConcept();
3484      if (this.safety == null)
3485        this.safety = new ArrayList<CodeableConcept>();
3486      this.safety.add(t);
3487      return t;
3488    }
3489
3490    public Device addSafety(CodeableConcept t) { //3
3491      if (t == null)
3492        return this;
3493      if (this.safety == null)
3494        this.safety = new ArrayList<CodeableConcept>();
3495      this.safety.add(t);
3496      return this;
3497    }
3498
3499    /**
3500     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist
3501     */
3502    public CodeableConcept getSafetyFirstRep() { 
3503      if (getSafety().isEmpty()) {
3504        addSafety();
3505      }
3506      return getSafety().get(0);
3507    }
3508
3509    /**
3510     * @return {@link #parent} (The device that this device is attached to or is part of.)
3511     */
3512    public Reference getParent() { 
3513      if (this.parent == null)
3514        if (Configuration.errorOnAutoCreate())
3515          throw new Error("Attempt to auto-create Device.parent");
3516        else if (Configuration.doAutoCreate())
3517          this.parent = new Reference(); // cc
3518      return this.parent;
3519    }
3520
3521    public boolean hasParent() { 
3522      return this.parent != null && !this.parent.isEmpty();
3523    }
3524
3525    /**
3526     * @param value {@link #parent} (The device that this device is attached to or is part of.)
3527     */
3528    public Device setParent(Reference value) { 
3529      this.parent = value;
3530      return this;
3531    }
3532
3533      protected void listChildren(List<Property> children) {
3534        super.listChildren(children);
3535        children.add(new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by manufacturers other organizations or owners.", 0, java.lang.Integer.MAX_VALUE, identifier));
3536        children.add(new Property("definition", "Reference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition));
3537        children.add(new Property("udiCarrier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiCarrier));
3538        children.add(new Property("status", "code", "Status of the Device availability.", 0, 1, status));
3539        children.add(new Property("statusReason", "CodeableConcept", "Reason for the dtatus of the Device availability.", 0, java.lang.Integer.MAX_VALUE, statusReason));
3540        children.add(new Property("distinctIdentifier", "string", "The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.", 0, 1, distinctIdentifier));
3541        children.add(new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer));
3542        children.add(new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate));
3543        children.add(new Property("expirationDate", "dateTime", "The date and time beyond which this device is no longer valid or should not be used (if applicable).", 0, 1, expirationDate));
3544        children.add(new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber));
3545        children.add(new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber));
3546        children.add(new Property("deviceName", "", "This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.", 0, java.lang.Integer.MAX_VALUE, deviceName));
3547        children.add(new Property("modelNumber", "string", "The manufacturer's model number for the device.", 0, 1, modelNumber));
3548        children.add(new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber));
3549        children.add(new Property("type", "CodeableConcept", "The kind or type of device.", 0, 1, type));
3550        children.add(new Property("specialization", "", "The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.", 0, java.lang.Integer.MAX_VALUE, specialization));
3551        children.add(new Property("version", "", "The actual design of the device or software version running on the device.", 0, java.lang.Integer.MAX_VALUE, version));
3552        children.add(new Property("property", "", "The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property));
3553        children.add(new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient));
3554        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
3555        children.add(new Property("contact", "ContactPoint", "Contact details for an organization or a particular human that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, contact));
3556        children.add(new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location));
3557        children.add(new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url));
3558        children.add(new Property("note", "Annotation", "Descriptive information, usage information or implantation information that is not captured in an existing element.", 0, java.lang.Integer.MAX_VALUE, note));
3559        children.add(new Property("safety", "CodeableConcept", "Provides additional safety characteristics about a medical device.  For example devices containing latex.", 0, java.lang.Integer.MAX_VALUE, safety));
3560        children.add(new Property("parent", "Reference(Device)", "The device that this device is attached to or is part of.", 0, 1, parent));
3561      }
3562
3563      @Override
3564      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3565        switch (_hash) {
3566        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by manufacturers other organizations or owners.", 0, java.lang.Integer.MAX_VALUE, identifier);
3567        case -1014418093: /*definition*/  return new Property("definition", "Reference(DeviceDefinition)", "The reference to the definition for the device.", 0, 1, definition);
3568        case -1343558178: /*udiCarrier*/  return new Property("udiCarrier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiCarrier);
3569        case -892481550: /*status*/  return new Property("status", "code", "Status of the Device availability.", 0, 1, status);
3570        case 2051346646: /*statusReason*/  return new Property("statusReason", "CodeableConcept", "Reason for the dtatus of the Device availability.", 0, java.lang.Integer.MAX_VALUE, statusReason);
3571        case -1836176187: /*distinctIdentifier*/  return new Property("distinctIdentifier", "string", "The distinct identification string as required by regulation for a human cell, tissue, or cellular and tissue-based product.", 0, 1, distinctIdentifier);
3572        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "string", "A name of the manufacturer.", 0, 1, manufacturer);
3573        case 416714767: /*manufactureDate*/  return new Property("manufactureDate", "dateTime", "The date and time when the device was manufactured.", 0, 1, manufactureDate);
3574        case -668811523: /*expirationDate*/  return new Property("expirationDate", "dateTime", "The date and time beyond which this device is no longer valid or should not be used (if applicable).", 0, 1, expirationDate);
3575        case 462547450: /*lotNumber*/  return new Property("lotNumber", "string", "Lot number assigned by the manufacturer.", 0, 1, lotNumber);
3576        case 83787357: /*serialNumber*/  return new Property("serialNumber", "string", "The serial number assigned by the organization when the device was manufactured.", 0, 1, serialNumber);
3577        case 780988929: /*deviceName*/  return new Property("deviceName", "", "This represents the manufacturer's name of the device as provided by the device, from a UDI label, or by a person describing the Device.  This typically would be used when a person provides the name(s) or when the device represents one of the names available from DeviceDefinition.", 0, java.lang.Integer.MAX_VALUE, deviceName);
3578        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "The manufacturer's model number for the device.", 0, 1, modelNumber);
3579        case -731502308: /*partNumber*/  return new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber);
3580        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind or type of device.", 0, 1, type);
3581        case 682815883: /*specialization*/  return new Property("specialization", "", "The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.", 0, java.lang.Integer.MAX_VALUE, specialization);
3582        case 351608024: /*version*/  return new Property("version", "", "The actual design of the device or software version running on the device.", 0, java.lang.Integer.MAX_VALUE, version);
3583        case -993141291: /*property*/  return new Property("property", "", "The actual configuration settings of a device as it actually operates, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property);
3584        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Patient information, If the device is affixed to a person.", 0, 1, patient);
3585        case 106164915: /*owner*/  return new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner);
3586        case 951526432: /*contact*/  return new Property("contact", "ContactPoint", "Contact details for an organization or a particular human that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, contact);
3587        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The place where the device can be found.", 0, 1, location);
3588        case 116079: /*url*/  return new Property("url", "uri", "A network address on which the device may be contacted directly.", 0, 1, url);
3589        case 3387378: /*note*/  return new Property("note", "Annotation", "Descriptive information, usage information or implantation information that is not captured in an existing element.", 0, java.lang.Integer.MAX_VALUE, note);
3590        case -909893934: /*safety*/  return new Property("safety", "CodeableConcept", "Provides additional safety characteristics about a medical device.  For example devices containing latex.", 0, java.lang.Integer.MAX_VALUE, safety);
3591        case -995424086: /*parent*/  return new Property("parent", "Reference(Device)", "The device that this device is attached to or is part of.", 0, 1, parent);
3592        default: return super.getNamedProperty(_hash, _name, _checkValid);
3593        }
3594
3595      }
3596
3597      @Override
3598      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3599        switch (hash) {
3600        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3601        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // Reference
3602        case -1343558178: /*udiCarrier*/ return this.udiCarrier == null ? new Base[0] : this.udiCarrier.toArray(new Base[this.udiCarrier.size()]); // DeviceUdiCarrierComponent
3603        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRDeviceStatus>
3604        case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : this.statusReason.toArray(new Base[this.statusReason.size()]); // CodeableConcept
3605        case -1836176187: /*distinctIdentifier*/ return this.distinctIdentifier == null ? new Base[0] : new Base[] {this.distinctIdentifier}; // StringType
3606        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // StringType
3607        case 416714767: /*manufactureDate*/ return this.manufactureDate == null ? new Base[0] : new Base[] {this.manufactureDate}; // DateTimeType
3608        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
3609        case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType
3610        case 83787357: /*serialNumber*/ return this.serialNumber == null ? new Base[0] : new Base[] {this.serialNumber}; // StringType
3611        case 780988929: /*deviceName*/ return this.deviceName == null ? new Base[0] : this.deviceName.toArray(new Base[this.deviceName.size()]); // DeviceDeviceNameComponent
3612        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
3613        case -731502308: /*partNumber*/ return this.partNumber == null ? new Base[0] : new Base[] {this.partNumber}; // StringType
3614        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3615        case 682815883: /*specialization*/ return this.specialization == null ? new Base[0] : this.specialization.toArray(new Base[this.specialization.size()]); // DeviceSpecializationComponent
3616        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // DeviceVersionComponent
3617        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // DevicePropertyComponent
3618        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3619        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
3620        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
3621        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3622        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3623        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3624        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
3625        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
3626        default: return super.getProperty(hash, name, checkValid);
3627        }
3628
3629      }
3630
3631      @Override
3632      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3633        switch (hash) {
3634        case -1618432855: // identifier
3635          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3636          return value;
3637        case -1014418093: // definition
3638          this.definition = castToReference(value); // Reference
3639          return value;
3640        case -1343558178: // udiCarrier
3641          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value); // DeviceUdiCarrierComponent
3642          return value;
3643        case -892481550: // status
3644          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
3645          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
3646          return value;
3647        case 2051346646: // statusReason
3648          this.getStatusReason().add(castToCodeableConcept(value)); // CodeableConcept
3649          return value;
3650        case -1836176187: // distinctIdentifier
3651          this.distinctIdentifier = castToString(value); // StringType
3652          return value;
3653        case -1969347631: // manufacturer
3654          this.manufacturer = castToString(value); // StringType
3655          return value;
3656        case 416714767: // manufactureDate
3657          this.manufactureDate = castToDateTime(value); // DateTimeType
3658          return value;
3659        case -668811523: // expirationDate
3660          this.expirationDate = castToDateTime(value); // DateTimeType
3661          return value;
3662        case 462547450: // lotNumber
3663          this.lotNumber = castToString(value); // StringType
3664          return value;
3665        case 83787357: // serialNumber
3666          this.serialNumber = castToString(value); // StringType
3667          return value;
3668        case 780988929: // deviceName
3669          this.getDeviceName().add((DeviceDeviceNameComponent) value); // DeviceDeviceNameComponent
3670          return value;
3671        case 346619858: // modelNumber
3672          this.modelNumber = castToString(value); // StringType
3673          return value;
3674        case -731502308: // partNumber
3675          this.partNumber = castToString(value); // StringType
3676          return value;
3677        case 3575610: // type
3678          this.type = castToCodeableConcept(value); // CodeableConcept
3679          return value;
3680        case 682815883: // specialization
3681          this.getSpecialization().add((DeviceSpecializationComponent) value); // DeviceSpecializationComponent
3682          return value;
3683        case 351608024: // version
3684          this.getVersion().add((DeviceVersionComponent) value); // DeviceVersionComponent
3685          return value;
3686        case -993141291: // property
3687          this.getProperty().add((DevicePropertyComponent) value); // DevicePropertyComponent
3688          return value;
3689        case -791418107: // patient
3690          this.patient = castToReference(value); // Reference
3691          return value;
3692        case 106164915: // owner
3693          this.owner = castToReference(value); // Reference
3694          return value;
3695        case 951526432: // contact
3696          this.getContact().add(castToContactPoint(value)); // ContactPoint
3697          return value;
3698        case 1901043637: // location
3699          this.location = castToReference(value); // Reference
3700          return value;
3701        case 116079: // url
3702          this.url = castToUri(value); // UriType
3703          return value;
3704        case 3387378: // note
3705          this.getNote().add(castToAnnotation(value)); // Annotation
3706          return value;
3707        case -909893934: // safety
3708          this.getSafety().add(castToCodeableConcept(value)); // CodeableConcept
3709          return value;
3710        case -995424086: // parent
3711          this.parent = castToReference(value); // Reference
3712          return value;
3713        default: return super.setProperty(hash, name, value);
3714        }
3715
3716      }
3717
3718      @Override
3719      public Base setProperty(String name, Base value) throws FHIRException {
3720        if (name.equals("identifier")) {
3721          this.getIdentifier().add(castToIdentifier(value));
3722        } else if (name.equals("definition")) {
3723          this.definition = castToReference(value); // Reference
3724        } else if (name.equals("udiCarrier")) {
3725          this.getUdiCarrier().add((DeviceUdiCarrierComponent) value);
3726        } else if (name.equals("status")) {
3727          value = new FHIRDeviceStatusEnumFactory().fromType(castToCode(value));
3728          this.status = (Enumeration) value; // Enumeration<FHIRDeviceStatus>
3729        } else if (name.equals("statusReason")) {
3730          this.getStatusReason().add(castToCodeableConcept(value));
3731        } else if (name.equals("distinctIdentifier")) {
3732          this.distinctIdentifier = castToString(value); // StringType
3733        } else if (name.equals("manufacturer")) {
3734          this.manufacturer = castToString(value); // StringType
3735        } else if (name.equals("manufactureDate")) {
3736          this.manufactureDate = castToDateTime(value); // DateTimeType
3737        } else if (name.equals("expirationDate")) {
3738          this.expirationDate = castToDateTime(value); // DateTimeType
3739        } else if (name.equals("lotNumber")) {
3740          this.lotNumber = castToString(value); // StringType
3741        } else if (name.equals("serialNumber")) {
3742          this.serialNumber = castToString(value); // StringType
3743        } else if (name.equals("deviceName")) {
3744          this.getDeviceName().add((DeviceDeviceNameComponent) value);
3745        } else if (name.equals("modelNumber")) {
3746          this.modelNumber = castToString(value); // StringType
3747        } else if (name.equals("partNumber")) {
3748          this.partNumber = castToString(value); // StringType
3749        } else if (name.equals("type")) {
3750          this.type = castToCodeableConcept(value); // CodeableConcept
3751        } else if (name.equals("specialization")) {
3752          this.getSpecialization().add((DeviceSpecializationComponent) value);
3753        } else if (name.equals("version")) {
3754          this.getVersion().add((DeviceVersionComponent) value);
3755        } else if (name.equals("property")) {
3756          this.getProperty().add((DevicePropertyComponent) value);
3757        } else if (name.equals("patient")) {
3758          this.patient = castToReference(value); // Reference
3759        } else if (name.equals("owner")) {
3760          this.owner = castToReference(value); // Reference
3761        } else if (name.equals("contact")) {
3762          this.getContact().add(castToContactPoint(value));
3763        } else if (name.equals("location")) {
3764          this.location = castToReference(value); // Reference
3765        } else if (name.equals("url")) {
3766          this.url = castToUri(value); // UriType
3767        } else if (name.equals("note")) {
3768          this.getNote().add(castToAnnotation(value));
3769        } else if (name.equals("safety")) {
3770          this.getSafety().add(castToCodeableConcept(value));
3771        } else if (name.equals("parent")) {
3772          this.parent = castToReference(value); // Reference
3773        } else
3774          return super.setProperty(name, value);
3775        return value;
3776      }
3777
3778      @Override
3779      public Base makeProperty(int hash, String name) throws FHIRException {
3780        switch (hash) {
3781        case -1618432855:  return addIdentifier(); 
3782        case -1014418093:  return getDefinition();
3783        case -1343558178:  return addUdiCarrier(); 
3784        case -892481550:  return getStatusElement();
3785        case 2051346646:  return addStatusReason(); 
3786        case -1836176187:  return getDistinctIdentifierElement();
3787        case -1969347631:  return getManufacturerElement();
3788        case 416714767:  return getManufactureDateElement();
3789        case -668811523:  return getExpirationDateElement();
3790        case 462547450:  return getLotNumberElement();
3791        case 83787357:  return getSerialNumberElement();
3792        case 780988929:  return addDeviceName(); 
3793        case 346619858:  return getModelNumberElement();
3794        case -731502308:  return getPartNumberElement();
3795        case 3575610:  return getType();
3796        case 682815883:  return addSpecialization(); 
3797        case 351608024:  return addVersion(); 
3798        case -993141291:  return addProperty(); 
3799        case -791418107:  return getPatient();
3800        case 106164915:  return getOwner();
3801        case 951526432:  return addContact(); 
3802        case 1901043637:  return getLocation();
3803        case 116079:  return getUrlElement();
3804        case 3387378:  return addNote(); 
3805        case -909893934:  return addSafety(); 
3806        case -995424086:  return getParent();
3807        default: return super.makeProperty(hash, name);
3808        }
3809
3810      }
3811
3812      @Override
3813      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3814        switch (hash) {
3815        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3816        case -1014418093: /*definition*/ return new String[] {"Reference"};
3817        case -1343558178: /*udiCarrier*/ return new String[] {};
3818        case -892481550: /*status*/ return new String[] {"code"};
3819        case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"};
3820        case -1836176187: /*distinctIdentifier*/ return new String[] {"string"};
3821        case -1969347631: /*manufacturer*/ return new String[] {"string"};
3822        case 416714767: /*manufactureDate*/ return new String[] {"dateTime"};
3823        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
3824        case 462547450: /*lotNumber*/ return new String[] {"string"};
3825        case 83787357: /*serialNumber*/ return new String[] {"string"};
3826        case 780988929: /*deviceName*/ return new String[] {};
3827        case 346619858: /*modelNumber*/ return new String[] {"string"};
3828        case -731502308: /*partNumber*/ return new String[] {"string"};
3829        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3830        case 682815883: /*specialization*/ return new String[] {};
3831        case 351608024: /*version*/ return new String[] {};
3832        case -993141291: /*property*/ return new String[] {};
3833        case -791418107: /*patient*/ return new String[] {"Reference"};
3834        case 106164915: /*owner*/ return new String[] {"Reference"};
3835        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
3836        case 1901043637: /*location*/ return new String[] {"Reference"};
3837        case 116079: /*url*/ return new String[] {"uri"};
3838        case 3387378: /*note*/ return new String[] {"Annotation"};
3839        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
3840        case -995424086: /*parent*/ return new String[] {"Reference"};
3841        default: return super.getTypesForProperty(hash, name);
3842        }
3843
3844      }
3845
3846      @Override
3847      public Base addChild(String name) throws FHIRException {
3848        if (name.equals("identifier")) {
3849          return addIdentifier();
3850        }
3851        else if (name.equals("definition")) {
3852          this.definition = new Reference();
3853          return this.definition;
3854        }
3855        else if (name.equals("udiCarrier")) {
3856          return addUdiCarrier();
3857        }
3858        else if (name.equals("status")) {
3859          throw new FHIRException("Cannot call addChild on a primitive type Device.status");
3860        }
3861        else if (name.equals("statusReason")) {
3862          return addStatusReason();
3863        }
3864        else if (name.equals("distinctIdentifier")) {
3865          throw new FHIRException("Cannot call addChild on a primitive type Device.distinctIdentifier");
3866        }
3867        else if (name.equals("manufacturer")) {
3868          throw new FHIRException("Cannot call addChild on a primitive type Device.manufacturer");
3869        }
3870        else if (name.equals("manufactureDate")) {
3871          throw new FHIRException("Cannot call addChild on a primitive type Device.manufactureDate");
3872        }
3873        else if (name.equals("expirationDate")) {
3874          throw new FHIRException("Cannot call addChild on a primitive type Device.expirationDate");
3875        }
3876        else if (name.equals("lotNumber")) {
3877          throw new FHIRException("Cannot call addChild on a primitive type Device.lotNumber");
3878        }
3879        else if (name.equals("serialNumber")) {
3880          throw new FHIRException("Cannot call addChild on a primitive type Device.serialNumber");
3881        }
3882        else if (name.equals("deviceName")) {
3883          return addDeviceName();
3884        }
3885        else if (name.equals("modelNumber")) {
3886          throw new FHIRException("Cannot call addChild on a primitive type Device.modelNumber");
3887        }
3888        else if (name.equals("partNumber")) {
3889          throw new FHIRException("Cannot call addChild on a primitive type Device.partNumber");
3890        }
3891        else if (name.equals("type")) {
3892          this.type = new CodeableConcept();
3893          return this.type;
3894        }
3895        else if (name.equals("specialization")) {
3896          return addSpecialization();
3897        }
3898        else if (name.equals("version")) {
3899          return addVersion();
3900        }
3901        else if (name.equals("property")) {
3902          return addProperty();
3903        }
3904        else if (name.equals("patient")) {
3905          this.patient = new Reference();
3906          return this.patient;
3907        }
3908        else if (name.equals("owner")) {
3909          this.owner = new Reference();
3910          return this.owner;
3911        }
3912        else if (name.equals("contact")) {
3913          return addContact();
3914        }
3915        else if (name.equals("location")) {
3916          this.location = new Reference();
3917          return this.location;
3918        }
3919        else if (name.equals("url")) {
3920          throw new FHIRException("Cannot call addChild on a primitive type Device.url");
3921        }
3922        else if (name.equals("note")) {
3923          return addNote();
3924        }
3925        else if (name.equals("safety")) {
3926          return addSafety();
3927        }
3928        else if (name.equals("parent")) {
3929          this.parent = new Reference();
3930          return this.parent;
3931        }
3932        else
3933          return super.addChild(name);
3934      }
3935
3936  public String fhirType() {
3937    return "Device";
3938
3939  }
3940
3941      public Device copy() {
3942        Device dst = new Device();
3943        copyValues(dst);
3944        return dst;
3945      }
3946
3947      public void copyValues(Device dst) {
3948        super.copyValues(dst);
3949        if (identifier != null) {
3950          dst.identifier = new ArrayList<Identifier>();
3951          for (Identifier i : identifier)
3952            dst.identifier.add(i.copy());
3953        };
3954        dst.definition = definition == null ? null : definition.copy();
3955        if (udiCarrier != null) {
3956          dst.udiCarrier = new ArrayList<DeviceUdiCarrierComponent>();
3957          for (DeviceUdiCarrierComponent i : udiCarrier)
3958            dst.udiCarrier.add(i.copy());
3959        };
3960        dst.status = status == null ? null : status.copy();
3961        if (statusReason != null) {
3962          dst.statusReason = new ArrayList<CodeableConcept>();
3963          for (CodeableConcept i : statusReason)
3964            dst.statusReason.add(i.copy());
3965        };
3966        dst.distinctIdentifier = distinctIdentifier == null ? null : distinctIdentifier.copy();
3967        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
3968        dst.manufactureDate = manufactureDate == null ? null : manufactureDate.copy();
3969        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
3970        dst.lotNumber = lotNumber == null ? null : lotNumber.copy();
3971        dst.serialNumber = serialNumber == null ? null : serialNumber.copy();
3972        if (deviceName != null) {
3973          dst.deviceName = new ArrayList<DeviceDeviceNameComponent>();
3974          for (DeviceDeviceNameComponent i : deviceName)
3975            dst.deviceName.add(i.copy());
3976        };
3977        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
3978        dst.partNumber = partNumber == null ? null : partNumber.copy();
3979        dst.type = type == null ? null : type.copy();
3980        if (specialization != null) {
3981          dst.specialization = new ArrayList<DeviceSpecializationComponent>();
3982          for (DeviceSpecializationComponent i : specialization)
3983            dst.specialization.add(i.copy());
3984        };
3985        if (version != null) {
3986          dst.version = new ArrayList<DeviceVersionComponent>();
3987          for (DeviceVersionComponent i : version)
3988            dst.version.add(i.copy());
3989        };
3990        if (property != null) {
3991          dst.property = new ArrayList<DevicePropertyComponent>();
3992          for (DevicePropertyComponent i : property)
3993            dst.property.add(i.copy());
3994        };
3995        dst.patient = patient == null ? null : patient.copy();
3996        dst.owner = owner == null ? null : owner.copy();
3997        if (contact != null) {
3998          dst.contact = new ArrayList<ContactPoint>();
3999          for (ContactPoint i : contact)
4000            dst.contact.add(i.copy());
4001        };
4002        dst.location = location == null ? null : location.copy();
4003        dst.url = url == null ? null : url.copy();
4004        if (note != null) {
4005          dst.note = new ArrayList<Annotation>();
4006          for (Annotation i : note)
4007            dst.note.add(i.copy());
4008        };
4009        if (safety != null) {
4010          dst.safety = new ArrayList<CodeableConcept>();
4011          for (CodeableConcept i : safety)
4012            dst.safety.add(i.copy());
4013        };
4014        dst.parent = parent == null ? null : parent.copy();
4015      }
4016
4017      protected Device typedCopy() {
4018        return copy();
4019      }
4020
4021      @Override
4022      public boolean equalsDeep(Base other_) {
4023        if (!super.equalsDeep(other_))
4024          return false;
4025        if (!(other_ instanceof Device))
4026          return false;
4027        Device o = (Device) other_;
4028        return compareDeep(identifier, o.identifier, true) && compareDeep(definition, o.definition, true)
4029           && compareDeep(udiCarrier, o.udiCarrier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true)
4030           && compareDeep(distinctIdentifier, o.distinctIdentifier, true) && compareDeep(manufacturer, o.manufacturer, true)
4031           && compareDeep(manufactureDate, o.manufactureDate, true) && compareDeep(expirationDate, o.expirationDate, true)
4032           && compareDeep(lotNumber, o.lotNumber, true) && compareDeep(serialNumber, o.serialNumber, true)
4033           && compareDeep(deviceName, o.deviceName, true) && compareDeep(modelNumber, o.modelNumber, true)
4034           && compareDeep(partNumber, o.partNumber, true) && compareDeep(type, o.type, true) && compareDeep(specialization, o.specialization, true)
4035           && compareDeep(version, o.version, true) && compareDeep(property, o.property, true) && compareDeep(patient, o.patient, true)
4036           && compareDeep(owner, o.owner, true) && compareDeep(contact, o.contact, true) && compareDeep(location, o.location, true)
4037           && compareDeep(url, o.url, true) && compareDeep(note, o.note, true) && compareDeep(safety, o.safety, true)
4038           && compareDeep(parent, o.parent, true);
4039      }
4040
4041      @Override
4042      public boolean equalsShallow(Base other_) {
4043        if (!super.equalsShallow(other_))
4044          return false;
4045        if (!(other_ instanceof Device))
4046          return false;
4047        Device o = (Device) other_;
4048        return compareValues(status, o.status, true) && compareValues(distinctIdentifier, o.distinctIdentifier, true)
4049           && compareValues(manufacturer, o.manufacturer, true) && compareValues(manufactureDate, o.manufactureDate, true)
4050           && compareValues(expirationDate, o.expirationDate, true) && compareValues(lotNumber, o.lotNumber, true)
4051           && compareValues(serialNumber, o.serialNumber, true) && compareValues(modelNumber, o.modelNumber, true)
4052           && compareValues(partNumber, o.partNumber, true) && compareValues(url, o.url, true);
4053      }
4054
4055      public boolean isEmpty() {
4056        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, definition, udiCarrier
4057          , status, statusReason, distinctIdentifier, manufacturer, manufactureDate, expirationDate
4058          , lotNumber, serialNumber, deviceName, modelNumber, partNumber, type, specialization
4059          , version, property, patient, owner, contact, location, url, note, safety
4060          , parent);
4061      }
4062
4063  @Override
4064  public ResourceType getResourceType() {
4065    return ResourceType.Device;
4066   }
4067
4068 /**
4069   * Search parameter: <b>udi-di</b>
4070   * <p>
4071   * Description: <b>The udi Device Identifier (DI)</b><br>
4072   * Type: <b>string</b><br>
4073   * Path: <b>Device.udiCarrier</b><br>
4074   * </p>
4075   */
4076  @SearchParamDefinition(name="udi-di", path="Device.udiCarrier.deviceIdentifier", description="The udi Device Identifier (DI)", type="string" )
4077  public static final String SP_UDI_DI = "udi-di";
4078 /**
4079   * <b>Fluent Client</b> search parameter constant for <b>udi-di</b>
4080   * <p>
4081   * Description: <b>The udi Device Identifier (DI)</b><br>
4082   * Type: <b>string</b><br>
4083   * Path: <b>Device.udiCarrier</b><br>
4084   * </p>
4085   */
4086  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_DI = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_DI);
4087
4088 /**
4089   * Search parameter: <b>identifier</b>
4090   * <p>
4091   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
4092   * Type: <b>token</b><br>
4093   * Path: <b>Device.identifier</b><br>
4094   * </p>
4095   */
4096  @SearchParamDefinition(name="identifier", path="Device.identifier", description="Instance id from manufacturer, owner, and others", type="token" )
4097  public static final String SP_IDENTIFIER = "identifier";
4098 /**
4099   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4100   * <p>
4101   * Description: <b>Instance id from manufacturer, owner, and others</b><br>
4102   * Type: <b>token</b><br>
4103   * Path: <b>Device.identifier</b><br>
4104   * </p>
4105   */
4106  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4107
4108 /**
4109   * Search parameter: <b>udi-carrier</b>
4110   * <p>
4111   * Description: <b>UDI Barcode (RFID or other technology) string in *HRF* format.</b><br>
4112   * Type: <b>string</b><br>
4113   * Path: <b>Device.udiCarrier</b><br>
4114   * </p>
4115   */
4116  @SearchParamDefinition(name="udi-carrier", path="Device.udiCarrier.carrierHRF", description="UDI Barcode (RFID or other technology) string in *HRF* format.", type="string" )
4117  public static final String SP_UDI_CARRIER = "udi-carrier";
4118 /**
4119   * <b>Fluent Client</b> search parameter constant for <b>udi-carrier</b>
4120   * <p>
4121   * Description: <b>UDI Barcode (RFID or other technology) string in *HRF* format.</b><br>
4122   * Type: <b>string</b><br>
4123   * Path: <b>Device.udiCarrier</b><br>
4124   * </p>
4125   */
4126  public static final ca.uhn.fhir.rest.gclient.StringClientParam UDI_CARRIER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_UDI_CARRIER);
4127
4128 /**
4129   * Search parameter: <b>device-name</b>
4130   * <p>
4131   * Description: <b>A server defined search that may match any of the string fields in Device.deviceName or Device.type.</b><br>
4132   * Type: <b>string</b><br>
4133   * Path: <b>Device.deviceName</b><br>
4134   * </p>
4135   */
4136  @SearchParamDefinition(name="device-name", path="Device.deviceName.name | Device.type.coding.display | Device.type.text", description="A server defined search that may match any of the string fields in Device.deviceName or Device.type.", type="string" )
4137  public static final String SP_DEVICE_NAME = "device-name";
4138 /**
4139   * <b>Fluent Client</b> search parameter constant for <b>device-name</b>
4140   * <p>
4141   * Description: <b>A server defined search that may match any of the string fields in Device.deviceName or Device.type.</b><br>
4142   * Type: <b>string</b><br>
4143   * Path: <b>Device.deviceName</b><br>
4144   * </p>
4145   */
4146  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEVICE_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEVICE_NAME);
4147
4148 /**
4149   * Search parameter: <b>patient</b>
4150   * <p>
4151   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
4152   * Type: <b>reference</b><br>
4153   * Path: <b>Device.patient</b><br>
4154   * </p>
4155   */
4156  @SearchParamDefinition(name="patient", path="Device.patient", description="Patient information, if the resource is affixed to a person", type="reference", target={Patient.class } )
4157  public static final String SP_PATIENT = "patient";
4158 /**
4159   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4160   * <p>
4161   * Description: <b>Patient information, if the resource is affixed to a person</b><br>
4162   * Type: <b>reference</b><br>
4163   * Path: <b>Device.patient</b><br>
4164   * </p>
4165   */
4166  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4167
4168/**
4169   * Constant for fluent queries to be used to add include statements. Specifies
4170   * the path value of "<b>Device:patient</b>".
4171   */
4172  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Device:patient").toLocked();
4173
4174 /**
4175   * Search parameter: <b>organization</b>
4176   * <p>
4177   * Description: <b>The organization responsible for the device</b><br>
4178   * Type: <b>reference</b><br>
4179   * Path: <b>Device.owner</b><br>
4180   * </p>
4181   */
4182  @SearchParamDefinition(name="organization", path="Device.owner", description="The organization responsible for the device", type="reference", target={Organization.class } )
4183  public static final String SP_ORGANIZATION = "organization";
4184 /**
4185   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
4186   * <p>
4187   * Description: <b>The organization responsible for the device</b><br>
4188   * Type: <b>reference</b><br>
4189   * Path: <b>Device.owner</b><br>
4190   * </p>
4191   */
4192  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
4193
4194/**
4195   * Constant for fluent queries to be used to add include statements. Specifies
4196   * the path value of "<b>Device:organization</b>".
4197   */
4198  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Device:organization").toLocked();
4199
4200 /**
4201   * Search parameter: <b>model</b>
4202   * <p>
4203   * Description: <b>The model of the device</b><br>
4204   * Type: <b>string</b><br>
4205   * Path: <b>Device.modelNumber</b><br>
4206   * </p>
4207   */
4208  @SearchParamDefinition(name="model", path="Device.modelNumber", description="The model of the device", type="string" )
4209  public static final String SP_MODEL = "model";
4210 /**
4211   * <b>Fluent Client</b> search parameter constant for <b>model</b>
4212   * <p>
4213   * Description: <b>The model of the device</b><br>
4214   * Type: <b>string</b><br>
4215   * Path: <b>Device.modelNumber</b><br>
4216   * </p>
4217   */
4218  public static final ca.uhn.fhir.rest.gclient.StringClientParam MODEL = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MODEL);
4219
4220 /**
4221   * Search parameter: <b>location</b>
4222   * <p>
4223   * Description: <b>A location, where the resource is found</b><br>
4224   * Type: <b>reference</b><br>
4225   * Path: <b>Device.location</b><br>
4226   * </p>
4227   */
4228  @SearchParamDefinition(name="location", path="Device.location", description="A location, where the resource is found", type="reference", target={Location.class } )
4229  public static final String SP_LOCATION = "location";
4230 /**
4231   * <b>Fluent Client</b> search parameter constant for <b>location</b>
4232   * <p>
4233   * Description: <b>A location, where the resource is found</b><br>
4234   * Type: <b>reference</b><br>
4235   * Path: <b>Device.location</b><br>
4236   * </p>
4237   */
4238  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
4239
4240/**
4241   * Constant for fluent queries to be used to add include statements. Specifies
4242   * the path value of "<b>Device:location</b>".
4243   */
4244  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("Device:location").toLocked();
4245
4246 /**
4247   * Search parameter: <b>type</b>
4248   * <p>
4249   * Description: <b>The type of the device</b><br>
4250   * Type: <b>token</b><br>
4251   * Path: <b>Device.type</b><br>
4252   * </p>
4253   */
4254  @SearchParamDefinition(name="type", path="Device.type", description="The type of the device", type="token" )
4255  public static final String SP_TYPE = "type";
4256 /**
4257   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4258   * <p>
4259   * Description: <b>The type of the device</b><br>
4260   * Type: <b>token</b><br>
4261   * Path: <b>Device.type</b><br>
4262   * </p>
4263   */
4264  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
4265
4266 /**
4267   * Search parameter: <b>url</b>
4268   * <p>
4269   * Description: <b>Network address to contact device</b><br>
4270   * Type: <b>uri</b><br>
4271   * Path: <b>Device.url</b><br>
4272   * </p>
4273   */
4274  @SearchParamDefinition(name="url", path="Device.url", description="Network address to contact device", type="uri" )
4275  public static final String SP_URL = "url";
4276 /**
4277   * <b>Fluent Client</b> search parameter constant for <b>url</b>
4278   * <p>
4279   * Description: <b>Network address to contact device</b><br>
4280   * Type: <b>uri</b><br>
4281   * Path: <b>Device.url</b><br>
4282   * </p>
4283   */
4284  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
4285
4286 /**
4287   * Search parameter: <b>manufacturer</b>
4288   * <p>
4289   * Description: <b>The manufacturer of the device</b><br>
4290   * Type: <b>string</b><br>
4291   * Path: <b>Device.manufacturer</b><br>
4292   * </p>
4293   */
4294  @SearchParamDefinition(name="manufacturer", path="Device.manufacturer", description="The manufacturer of the device", type="string" )
4295  public static final String SP_MANUFACTURER = "manufacturer";
4296 /**
4297   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
4298   * <p>
4299   * Description: <b>The manufacturer of the device</b><br>
4300   * Type: <b>string</b><br>
4301   * Path: <b>Device.manufacturer</b><br>
4302   * </p>
4303   */
4304  public static final ca.uhn.fhir.rest.gclient.StringClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_MANUFACTURER);
4305
4306 /**
4307   * Search parameter: <b>status</b>
4308   * <p>
4309   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
4310   * Type: <b>token</b><br>
4311   * Path: <b>Device.status</b><br>
4312   * </p>
4313   */
4314  @SearchParamDefinition(name="status", path="Device.status", description="active | inactive | entered-in-error | unknown", type="token" )
4315  public static final String SP_STATUS = "status";
4316 /**
4317   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4318   * <p>
4319   * Description: <b>active | inactive | entered-in-error | unknown</b><br>
4320   * Type: <b>token</b><br>
4321   * Path: <b>Device.status</b><br>
4322   * </p>
4323   */
4324  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4325
4326
4327}
4328