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