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