001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * This is a specialized resource that defines the characteristics and capabilities of a device.
052 */
053@ResourceDef(name="DeviceDefinition", profile="http://hl7.org/fhir/StructureDefinition/DeviceDefinition")
054public class DeviceDefinition extends DomainResource {
055
056    public enum DeviceCorrectiveActionScope {
057        /**
058         * The corrective action was intended for all units of the same model.
059         */
060        MODEL, 
061        /**
062         * The corrective action was intended for a specific batch of units identified by a lot number.
063         */
064        LOTNUMBERS, 
065        /**
066         * The corrective action was intended for an individual unit (or a set of units) individually identified by serial number.
067         */
068        SERIALNUMBERS, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static DeviceCorrectiveActionScope fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("model".equals(codeString))
077          return MODEL;
078        if ("lot-numbers".equals(codeString))
079          return LOTNUMBERS;
080        if ("serial-numbers".equals(codeString))
081          return SERIALNUMBERS;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case MODEL: return "model";
090            case LOTNUMBERS: return "lot-numbers";
091            case SERIALNUMBERS: return "serial-numbers";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case MODEL: return "http://hl7.org/fhir/device-correctiveactionscope";
099            case LOTNUMBERS: return "http://hl7.org/fhir/device-correctiveactionscope";
100            case SERIALNUMBERS: return "http://hl7.org/fhir/device-correctiveactionscope";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case MODEL: return "The corrective action was intended for all units of the same model.";
108            case LOTNUMBERS: return "The corrective action was intended for a specific batch of units identified by a lot number.";
109            case SERIALNUMBERS: return "The corrective action was intended for an individual unit (or a set of units) individually identified by serial number.";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case MODEL: return "Model";
117            case LOTNUMBERS: return "Lot Numbers";
118            case SERIALNUMBERS: return "Serial Numbers";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class DeviceCorrectiveActionScopeEnumFactory implements EnumFactory<DeviceCorrectiveActionScope> {
126    public DeviceCorrectiveActionScope fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("model".equals(codeString))
131          return DeviceCorrectiveActionScope.MODEL;
132        if ("lot-numbers".equals(codeString))
133          return DeviceCorrectiveActionScope.LOTNUMBERS;
134        if ("serial-numbers".equals(codeString))
135          return DeviceCorrectiveActionScope.SERIALNUMBERS;
136        throw new IllegalArgumentException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
137        }
138        public Enumeration<DeviceCorrectiveActionScope> fromType(Base code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<DeviceCorrectiveActionScope>(this);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return null;
146        if ("model".equals(codeString))
147          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.MODEL);
148        if ("lot-numbers".equals(codeString))
149          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.LOTNUMBERS);
150        if ("serial-numbers".equals(codeString))
151          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.SERIALNUMBERS);
152        throw new FHIRException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
153        }
154    public String toCode(DeviceCorrectiveActionScope code) {
155      if (code == DeviceCorrectiveActionScope.MODEL)
156        return "model";
157      if (code == DeviceCorrectiveActionScope.LOTNUMBERS)
158        return "lot-numbers";
159      if (code == DeviceCorrectiveActionScope.SERIALNUMBERS)
160        return "serial-numbers";
161      return "?";
162      }
163    public String toSystem(DeviceCorrectiveActionScope code) {
164      return code.getSystem();
165      }
166    }
167
168    public enum DeviceDefinitionRegulatoryIdentifierType {
169        /**
170         * EUDAMED's basic UDI-DI identifier.
171         */
172        BASIC, 
173        /**
174         * EUDAMED's master UDI-DI identifier.
175         */
176        MASTER, 
177        /**
178         * The identifier is a license number.
179         */
180        LICENSE, 
181        /**
182         * added to help the parsers with the generic types
183         */
184        NULL;
185        public static DeviceDefinitionRegulatoryIdentifierType fromCode(String codeString) throws FHIRException {
186            if (codeString == null || "".equals(codeString))
187                return null;
188        if ("basic".equals(codeString))
189          return BASIC;
190        if ("master".equals(codeString))
191          return MASTER;
192        if ("license".equals(codeString))
193          return LICENSE;
194        if (Configuration.isAcceptInvalidEnums())
195          return null;
196        else
197          throw new FHIRException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
198        }
199        public String toCode() {
200          switch (this) {
201            case BASIC: return "basic";
202            case MASTER: return "master";
203            case LICENSE: return "license";
204            case NULL: return null;
205            default: return "?";
206          }
207        }
208        public String getSystem() {
209          switch (this) {
210            case BASIC: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
211            case MASTER: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
212            case LICENSE: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDefinition() {
218          switch (this) {
219            case BASIC: return "EUDAMED's basic UDI-DI identifier.";
220            case MASTER: return "EUDAMED's master UDI-DI identifier.";
221            case LICENSE: return "The identifier is a license number.";
222            case NULL: return null;
223            default: return "?";
224          }
225        }
226        public String getDisplay() {
227          switch (this) {
228            case BASIC: return "Basic";
229            case MASTER: return "Master";
230            case LICENSE: return "License";
231            case NULL: return null;
232            default: return "?";
233          }
234        }
235    }
236
237  public static class DeviceDefinitionRegulatoryIdentifierTypeEnumFactory implements EnumFactory<DeviceDefinitionRegulatoryIdentifierType> {
238    public DeviceDefinitionRegulatoryIdentifierType fromCode(String codeString) throws IllegalArgumentException {
239      if (codeString == null || "".equals(codeString))
240            if (codeString == null || "".equals(codeString))
241                return null;
242        if ("basic".equals(codeString))
243          return DeviceDefinitionRegulatoryIdentifierType.BASIC;
244        if ("master".equals(codeString))
245          return DeviceDefinitionRegulatoryIdentifierType.MASTER;
246        if ("license".equals(codeString))
247          return DeviceDefinitionRegulatoryIdentifierType.LICENSE;
248        throw new IllegalArgumentException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
249        }
250        public Enumeration<DeviceDefinitionRegulatoryIdentifierType> fromType(Base code) throws FHIRException {
251          if (code == null)
252            return null;
253          if (code.isEmpty())
254            return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this);
255          String codeString = ((PrimitiveType) code).asStringValue();
256          if (codeString == null || "".equals(codeString))
257            return null;
258        if ("basic".equals(codeString))
259          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.BASIC);
260        if ("master".equals(codeString))
261          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.MASTER);
262        if ("license".equals(codeString))
263          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.LICENSE);
264        throw new FHIRException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
265        }
266    public String toCode(DeviceDefinitionRegulatoryIdentifierType code) {
267      if (code == DeviceDefinitionRegulatoryIdentifierType.BASIC)
268        return "basic";
269      if (code == DeviceDefinitionRegulatoryIdentifierType.MASTER)
270        return "master";
271      if (code == DeviceDefinitionRegulatoryIdentifierType.LICENSE)
272        return "license";
273      return "?";
274      }
275    public String toSystem(DeviceDefinitionRegulatoryIdentifierType code) {
276      return code.getSystem();
277      }
278    }
279
280    public enum DeviceProductionIdentifierInUDI {
281        /**
282         * The label includes the lot number.
283         */
284        LOTNUMBER, 
285        /**
286         * The label includes the manufacture date.
287         */
288        MANUFACTUREDDATE, 
289        /**
290         * The label includes the serial number.
291         */
292        SERIALNUMBER, 
293        /**
294         * The label includes the expiration date.
295         */
296        EXPIRATIONDATE, 
297        /**
298         * The label includes the biological source identifier.
299         */
300        BIOLOGICALSOURCE, 
301        /**
302         * The label includes the software version.
303         */
304        SOFTWAREVERSION, 
305        /**
306         * added to help the parsers with the generic types
307         */
308        NULL;
309        public static DeviceProductionIdentifierInUDI fromCode(String codeString) throws FHIRException {
310            if (codeString == null || "".equals(codeString))
311                return null;
312        if ("lot-number".equals(codeString))
313          return LOTNUMBER;
314        if ("manufactured-date".equals(codeString))
315          return MANUFACTUREDDATE;
316        if ("serial-number".equals(codeString))
317          return SERIALNUMBER;
318        if ("expiration-date".equals(codeString))
319          return EXPIRATIONDATE;
320        if ("biological-source".equals(codeString))
321          return BIOLOGICALSOURCE;
322        if ("software-version".equals(codeString))
323          return SOFTWAREVERSION;
324        if (Configuration.isAcceptInvalidEnums())
325          return null;
326        else
327          throw new FHIRException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
328        }
329        public String toCode() {
330          switch (this) {
331            case LOTNUMBER: return "lot-number";
332            case MANUFACTUREDDATE: return "manufactured-date";
333            case SERIALNUMBER: return "serial-number";
334            case EXPIRATIONDATE: return "expiration-date";
335            case BIOLOGICALSOURCE: return "biological-source";
336            case SOFTWAREVERSION: return "software-version";
337            case NULL: return null;
338            default: return "?";
339          }
340        }
341        public String getSystem() {
342          switch (this) {
343            case LOTNUMBER: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
344            case MANUFACTUREDDATE: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
345            case SERIALNUMBER: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
346            case EXPIRATIONDATE: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
347            case BIOLOGICALSOURCE: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
348            case SOFTWAREVERSION: return "http://terminology.hl7.org/CodeSystem/device-productidentifierinudi";
349            case NULL: return null;
350            default: return "?";
351          }
352        }
353        public String getDefinition() {
354          switch (this) {
355            case LOTNUMBER: return "The label includes the lot number.";
356            case MANUFACTUREDDATE: return "The label includes the manufacture date.";
357            case SERIALNUMBER: return "The label includes the serial number.";
358            case EXPIRATIONDATE: return "The label includes the expiration date.";
359            case BIOLOGICALSOURCE: return "The label includes the biological source identifier.";
360            case SOFTWAREVERSION: return "The label includes the software version.";
361            case NULL: return null;
362            default: return "?";
363          }
364        }
365        public String getDisplay() {
366          switch (this) {
367            case LOTNUMBER: return "Lot Number";
368            case MANUFACTUREDDATE: return "Manufactured date";
369            case SERIALNUMBER: return "Serial Number";
370            case EXPIRATIONDATE: return "Expiration date";
371            case BIOLOGICALSOURCE: return "Biological source";
372            case SOFTWAREVERSION: return "Software Version";
373            case NULL: return null;
374            default: return "?";
375          }
376        }
377    }
378
379  public static class DeviceProductionIdentifierInUDIEnumFactory implements EnumFactory<DeviceProductionIdentifierInUDI> {
380    public DeviceProductionIdentifierInUDI fromCode(String codeString) throws IllegalArgumentException {
381      if (codeString == null || "".equals(codeString))
382            if (codeString == null || "".equals(codeString))
383                return null;
384        if ("lot-number".equals(codeString))
385          return DeviceProductionIdentifierInUDI.LOTNUMBER;
386        if ("manufactured-date".equals(codeString))
387          return DeviceProductionIdentifierInUDI.MANUFACTUREDDATE;
388        if ("serial-number".equals(codeString))
389          return DeviceProductionIdentifierInUDI.SERIALNUMBER;
390        if ("expiration-date".equals(codeString))
391          return DeviceProductionIdentifierInUDI.EXPIRATIONDATE;
392        if ("biological-source".equals(codeString))
393          return DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE;
394        if ("software-version".equals(codeString))
395          return DeviceProductionIdentifierInUDI.SOFTWAREVERSION;
396        throw new IllegalArgumentException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
397        }
398        public Enumeration<DeviceProductionIdentifierInUDI> fromType(Base code) throws FHIRException {
399          if (code == null)
400            return null;
401          if (code.isEmpty())
402            return new Enumeration<DeviceProductionIdentifierInUDI>(this);
403          String codeString = ((PrimitiveType) code).asStringValue();
404          if (codeString == null || "".equals(codeString))
405            return null;
406        if ("lot-number".equals(codeString))
407          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.LOTNUMBER);
408        if ("manufactured-date".equals(codeString))
409          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.MANUFACTUREDDATE);
410        if ("serial-number".equals(codeString))
411          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.SERIALNUMBER);
412        if ("expiration-date".equals(codeString))
413          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.EXPIRATIONDATE);
414        if ("biological-source".equals(codeString))
415          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE);
416        if ("software-version".equals(codeString))
417          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.SOFTWAREVERSION);
418        throw new FHIRException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
419        }
420    public String toCode(DeviceProductionIdentifierInUDI code) {
421      if (code == DeviceProductionIdentifierInUDI.LOTNUMBER)
422        return "lot-number";
423      if (code == DeviceProductionIdentifierInUDI.MANUFACTUREDDATE)
424        return "manufactured-date";
425      if (code == DeviceProductionIdentifierInUDI.SERIALNUMBER)
426        return "serial-number";
427      if (code == DeviceProductionIdentifierInUDI.EXPIRATIONDATE)
428        return "expiration-date";
429      if (code == DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE)
430        return "biological-source";
431      if (code == DeviceProductionIdentifierInUDI.SOFTWAREVERSION)
432        return "software-version";
433      return "?";
434      }
435    public String toSystem(DeviceProductionIdentifierInUDI code) {
436      return code.getSystem();
437      }
438    }
439
440    @Block()
441    public static class DeviceDefinitionUdiDeviceIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
442        /**
443         * The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
444         */
445        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
446        @Description(shortDefinition="The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier", formalDefinition="The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier." )
447        protected StringType deviceIdentifier;
448
449        /**
450         * The organization that assigns the identifier algorithm.
451         */
452        @Child(name = "issuer", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
453        @Description(shortDefinition="The organization that assigns the identifier algorithm", formalDefinition="The organization that assigns the identifier algorithm." )
454        protected UriType issuer;
455
456        /**
457         * The jurisdiction to which the deviceIdentifier applies.
458         */
459        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=false)
460        @Description(shortDefinition="The jurisdiction to which the deviceIdentifier applies", formalDefinition="The jurisdiction to which the deviceIdentifier applies." )
461        protected UriType jurisdiction;
462
463        /**
464         * Indicates where and when the device is available on the market.
465         */
466        @Child(name = "marketDistribution", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
467        @Description(shortDefinition="Indicates whether and when the device is available on the market", formalDefinition="Indicates where and when the device is available on the market." )
468        protected List<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent> marketDistribution;
469
470        private static final long serialVersionUID = -1659077973L;
471
472    /**
473     * Constructor
474     */
475      public DeviceDefinitionUdiDeviceIdentifierComponent() {
476        super();
477      }
478
479    /**
480     * Constructor
481     */
482      public DeviceDefinitionUdiDeviceIdentifierComponent(String deviceIdentifier, String issuer, String jurisdiction) {
483        super();
484        this.setDeviceIdentifier(deviceIdentifier);
485        this.setIssuer(issuer);
486        this.setJurisdiction(jurisdiction);
487      }
488
489        /**
490         * @return {@link #deviceIdentifier} (The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
491         */
492        public StringType getDeviceIdentifierElement() { 
493          if (this.deviceIdentifier == null)
494            if (Configuration.errorOnAutoCreate())
495              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.deviceIdentifier");
496            else if (Configuration.doAutoCreate())
497              this.deviceIdentifier = new StringType(); // bb
498          return this.deviceIdentifier;
499        }
500
501        public boolean hasDeviceIdentifierElement() { 
502          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
503        }
504
505        public boolean hasDeviceIdentifier() { 
506          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
507        }
508
509        /**
510         * @param value {@link #deviceIdentifier} (The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
511         */
512        public DeviceDefinitionUdiDeviceIdentifierComponent setDeviceIdentifierElement(StringType value) { 
513          this.deviceIdentifier = value;
514          return this;
515        }
516
517        /**
518         * @return The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
519         */
520        public String getDeviceIdentifier() { 
521          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
522        }
523
524        /**
525         * @param value The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
526         */
527        public DeviceDefinitionUdiDeviceIdentifierComponent setDeviceIdentifier(String value) { 
528            if (this.deviceIdentifier == null)
529              this.deviceIdentifier = new StringType();
530            this.deviceIdentifier.setValue(value);
531          return this;
532        }
533
534        /**
535         * @return {@link #issuer} (The organization that assigns the identifier algorithm.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
536         */
537        public UriType getIssuerElement() { 
538          if (this.issuer == null)
539            if (Configuration.errorOnAutoCreate())
540              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.issuer");
541            else if (Configuration.doAutoCreate())
542              this.issuer = new UriType(); // bb
543          return this.issuer;
544        }
545
546        public boolean hasIssuerElement() { 
547          return this.issuer != null && !this.issuer.isEmpty();
548        }
549
550        public boolean hasIssuer() { 
551          return this.issuer != null && !this.issuer.isEmpty();
552        }
553
554        /**
555         * @param value {@link #issuer} (The organization that assigns the identifier algorithm.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
556         */
557        public DeviceDefinitionUdiDeviceIdentifierComponent setIssuerElement(UriType value) { 
558          this.issuer = value;
559          return this;
560        }
561
562        /**
563         * @return The organization that assigns the identifier algorithm.
564         */
565        public String getIssuer() { 
566          return this.issuer == null ? null : this.issuer.getValue();
567        }
568
569        /**
570         * @param value The organization that assigns the identifier algorithm.
571         */
572        public DeviceDefinitionUdiDeviceIdentifierComponent setIssuer(String value) { 
573            if (this.issuer == null)
574              this.issuer = new UriType();
575            this.issuer.setValue(value);
576          return this;
577        }
578
579        /**
580         * @return {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
581         */
582        public UriType getJurisdictionElement() { 
583          if (this.jurisdiction == null)
584            if (Configuration.errorOnAutoCreate())
585              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.jurisdiction");
586            else if (Configuration.doAutoCreate())
587              this.jurisdiction = new UriType(); // bb
588          return this.jurisdiction;
589        }
590
591        public boolean hasJurisdictionElement() { 
592          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
593        }
594
595        public boolean hasJurisdiction() { 
596          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
597        }
598
599        /**
600         * @param value {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
601         */
602        public DeviceDefinitionUdiDeviceIdentifierComponent setJurisdictionElement(UriType value) { 
603          this.jurisdiction = value;
604          return this;
605        }
606
607        /**
608         * @return The jurisdiction to which the deviceIdentifier applies.
609         */
610        public String getJurisdiction() { 
611          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
612        }
613
614        /**
615         * @param value The jurisdiction to which the deviceIdentifier applies.
616         */
617        public DeviceDefinitionUdiDeviceIdentifierComponent setJurisdiction(String value) { 
618            if (this.jurisdiction == null)
619              this.jurisdiction = new UriType();
620            this.jurisdiction.setValue(value);
621          return this;
622        }
623
624        /**
625         * @return {@link #marketDistribution} (Indicates where and when the device is available on the market.)
626         */
627        public List<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent> getMarketDistribution() { 
628          if (this.marketDistribution == null)
629            this.marketDistribution = new ArrayList<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent>();
630          return this.marketDistribution;
631        }
632
633        /**
634         * @return Returns a reference to <code>this</code> for easy method chaining
635         */
636        public DeviceDefinitionUdiDeviceIdentifierComponent setMarketDistribution(List<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent> theMarketDistribution) { 
637          this.marketDistribution = theMarketDistribution;
638          return this;
639        }
640
641        public boolean hasMarketDistribution() { 
642          if (this.marketDistribution == null)
643            return false;
644          for (DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent item : this.marketDistribution)
645            if (!item.isEmpty())
646              return true;
647          return false;
648        }
649
650        public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent addMarketDistribution() { //3
651          DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent t = new DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent();
652          if (this.marketDistribution == null)
653            this.marketDistribution = new ArrayList<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent>();
654          this.marketDistribution.add(t);
655          return t;
656        }
657
658        public DeviceDefinitionUdiDeviceIdentifierComponent addMarketDistribution(DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent t) { //3
659          if (t == null)
660            return this;
661          if (this.marketDistribution == null)
662            this.marketDistribution = new ArrayList<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent>();
663          this.marketDistribution.add(t);
664          return this;
665        }
666
667        /**
668         * @return The first repetition of repeating field {@link #marketDistribution}, creating it if it does not already exist {3}
669         */
670        public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent getMarketDistributionFirstRep() { 
671          if (getMarketDistribution().isEmpty()) {
672            addMarketDistribution();
673          }
674          return getMarketDistribution().get(0);
675        }
676
677        protected void listChildren(List<Property> children) {
678          super.listChildren(children);
679          children.add(new Property("deviceIdentifier", "string", "The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.", 0, 1, deviceIdentifier));
680          children.add(new Property("issuer", "uri", "The organization that assigns the identifier algorithm.", 0, 1, issuer));
681          children.add(new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction));
682          children.add(new Property("marketDistribution", "", "Indicates where and when the device is available on the market.", 0, java.lang.Integer.MAX_VALUE, marketDistribution));
683        }
684
685        @Override
686        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
687          switch (_hash) {
688          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.", 0, 1, deviceIdentifier);
689          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "The organization that assigns the identifier algorithm.", 0, 1, issuer);
690          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction);
691          case 530037984: /*marketDistribution*/  return new Property("marketDistribution", "", "Indicates where and when the device is available on the market.", 0, java.lang.Integer.MAX_VALUE, marketDistribution);
692          default: return super.getNamedProperty(_hash, _name, _checkValid);
693          }
694
695        }
696
697      @Override
698      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
699        switch (hash) {
700        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
701        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
702        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
703        case 530037984: /*marketDistribution*/ return this.marketDistribution == null ? new Base[0] : this.marketDistribution.toArray(new Base[this.marketDistribution.size()]); // DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent
704        default: return super.getProperty(hash, name, checkValid);
705        }
706
707      }
708
709      @Override
710      public Base setProperty(int hash, String name, Base value) throws FHIRException {
711        switch (hash) {
712        case 1322005407: // deviceIdentifier
713          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
714          return value;
715        case -1179159879: // issuer
716          this.issuer = TypeConvertor.castToUri(value); // UriType
717          return value;
718        case -507075711: // jurisdiction
719          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
720          return value;
721        case 530037984: // marketDistribution
722          this.getMarketDistribution().add((DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent) value); // DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent
723          return value;
724        default: return super.setProperty(hash, name, value);
725        }
726
727      }
728
729      @Override
730      public Base setProperty(String name, Base value) throws FHIRException {
731        if (name.equals("deviceIdentifier")) {
732          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
733        } else if (name.equals("issuer")) {
734          this.issuer = TypeConvertor.castToUri(value); // UriType
735        } else if (name.equals("jurisdiction")) {
736          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
737        } else if (name.equals("marketDistribution")) {
738          this.getMarketDistribution().add((DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent) value);
739        } else
740          return super.setProperty(name, value);
741        return value;
742      }
743
744      @Override
745      public Base makeProperty(int hash, String name) throws FHIRException {
746        switch (hash) {
747        case 1322005407:  return getDeviceIdentifierElement();
748        case -1179159879:  return getIssuerElement();
749        case -507075711:  return getJurisdictionElement();
750        case 530037984:  return addMarketDistribution(); 
751        default: return super.makeProperty(hash, name);
752        }
753
754      }
755
756      @Override
757      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
758        switch (hash) {
759        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
760        case -1179159879: /*issuer*/ return new String[] {"uri"};
761        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
762        case 530037984: /*marketDistribution*/ return new String[] {};
763        default: return super.getTypesForProperty(hash, name);
764        }
765
766      }
767
768      @Override
769      public Base addChild(String name) throws FHIRException {
770        if (name.equals("deviceIdentifier")) {
771          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.udiDeviceIdentifier.deviceIdentifier");
772        }
773        else if (name.equals("issuer")) {
774          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.udiDeviceIdentifier.issuer");
775        }
776        else if (name.equals("jurisdiction")) {
777          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.udiDeviceIdentifier.jurisdiction");
778        }
779        else if (name.equals("marketDistribution")) {
780          return addMarketDistribution();
781        }
782        else
783          return super.addChild(name);
784      }
785
786      public DeviceDefinitionUdiDeviceIdentifierComponent copy() {
787        DeviceDefinitionUdiDeviceIdentifierComponent dst = new DeviceDefinitionUdiDeviceIdentifierComponent();
788        copyValues(dst);
789        return dst;
790      }
791
792      public void copyValues(DeviceDefinitionUdiDeviceIdentifierComponent dst) {
793        super.copyValues(dst);
794        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
795        dst.issuer = issuer == null ? null : issuer.copy();
796        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
797        if (marketDistribution != null) {
798          dst.marketDistribution = new ArrayList<DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent>();
799          for (DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent i : marketDistribution)
800            dst.marketDistribution.add(i.copy());
801        };
802      }
803
804      @Override
805      public boolean equalsDeep(Base other_) {
806        if (!super.equalsDeep(other_))
807          return false;
808        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierComponent))
809          return false;
810        DeviceDefinitionUdiDeviceIdentifierComponent o = (DeviceDefinitionUdiDeviceIdentifierComponent) other_;
811        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(issuer, o.issuer, true)
812           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(marketDistribution, o.marketDistribution, true)
813          ;
814      }
815
816      @Override
817      public boolean equalsShallow(Base other_) {
818        if (!super.equalsShallow(other_))
819          return false;
820        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierComponent))
821          return false;
822        DeviceDefinitionUdiDeviceIdentifierComponent o = (DeviceDefinitionUdiDeviceIdentifierComponent) other_;
823        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(issuer, o.issuer, true)
824           && compareValues(jurisdiction, o.jurisdiction, true);
825      }
826
827      public boolean isEmpty() {
828        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, issuer, jurisdiction
829          , marketDistribution);
830      }
831
832  public String fhirType() {
833    return "DeviceDefinition.udiDeviceIdentifier";
834
835  }
836
837  }
838
839    @Block()
840    public static class DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent extends BackboneElement implements IBaseBackboneElement {
841        /**
842         * Begin and end dates for the commercial distribution of the device.
843         */
844        @Child(name = "marketPeriod", type = {Period.class}, order=1, min=1, max=1, modifier=false, summary=false)
845        @Description(shortDefinition="Begin and end dates for the commercial distribution of the device", formalDefinition="Begin and end dates for the commercial distribution of the device." )
846        protected Period marketPeriod;
847
848        /**
849         * National state or territory to which the marketDistribution recers, typically where the device is commercialized.
850         */
851        @Child(name = "subJurisdiction", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
852        @Description(shortDefinition="National state or territory where the device is commercialized", formalDefinition="National state or territory to which the marketDistribution recers, typically where the device is commercialized." )
853        protected UriType subJurisdiction;
854
855        private static final long serialVersionUID = -1459036847L;
856
857    /**
858     * Constructor
859     */
860      public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent() {
861        super();
862      }
863
864    /**
865     * Constructor
866     */
867      public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent(Period marketPeriod, String subJurisdiction) {
868        super();
869        this.setMarketPeriod(marketPeriod);
870        this.setSubJurisdiction(subJurisdiction);
871      }
872
873        /**
874         * @return {@link #marketPeriod} (Begin and end dates for the commercial distribution of the device.)
875         */
876        public Period getMarketPeriod() { 
877          if (this.marketPeriod == null)
878            if (Configuration.errorOnAutoCreate())
879              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent.marketPeriod");
880            else if (Configuration.doAutoCreate())
881              this.marketPeriod = new Period(); // cc
882          return this.marketPeriod;
883        }
884
885        public boolean hasMarketPeriod() { 
886          return this.marketPeriod != null && !this.marketPeriod.isEmpty();
887        }
888
889        /**
890         * @param value {@link #marketPeriod} (Begin and end dates for the commercial distribution of the device.)
891         */
892        public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent setMarketPeriod(Period value) { 
893          this.marketPeriod = value;
894          return this;
895        }
896
897        /**
898         * @return {@link #subJurisdiction} (National state or territory to which the marketDistribution recers, typically where the device is commercialized.). This is the underlying object with id, value and extensions. The accessor "getSubJurisdiction" gives direct access to the value
899         */
900        public UriType getSubJurisdictionElement() { 
901          if (this.subJurisdiction == null)
902            if (Configuration.errorOnAutoCreate())
903              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent.subJurisdiction");
904            else if (Configuration.doAutoCreate())
905              this.subJurisdiction = new UriType(); // bb
906          return this.subJurisdiction;
907        }
908
909        public boolean hasSubJurisdictionElement() { 
910          return this.subJurisdiction != null && !this.subJurisdiction.isEmpty();
911        }
912
913        public boolean hasSubJurisdiction() { 
914          return this.subJurisdiction != null && !this.subJurisdiction.isEmpty();
915        }
916
917        /**
918         * @param value {@link #subJurisdiction} (National state or territory to which the marketDistribution recers, typically where the device is commercialized.). This is the underlying object with id, value and extensions. The accessor "getSubJurisdiction" gives direct access to the value
919         */
920        public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent setSubJurisdictionElement(UriType value) { 
921          this.subJurisdiction = value;
922          return this;
923        }
924
925        /**
926         * @return National state or territory to which the marketDistribution recers, typically where the device is commercialized.
927         */
928        public String getSubJurisdiction() { 
929          return this.subJurisdiction == null ? null : this.subJurisdiction.getValue();
930        }
931
932        /**
933         * @param value National state or territory to which the marketDistribution recers, typically where the device is commercialized.
934         */
935        public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent setSubJurisdiction(String value) { 
936            if (this.subJurisdiction == null)
937              this.subJurisdiction = new UriType();
938            this.subJurisdiction.setValue(value);
939          return this;
940        }
941
942        protected void listChildren(List<Property> children) {
943          super.listChildren(children);
944          children.add(new Property("marketPeriod", "Period", "Begin and end dates for the commercial distribution of the device.", 0, 1, marketPeriod));
945          children.add(new Property("subJurisdiction", "uri", "National state or territory to which the marketDistribution recers, typically where the device is commercialized.", 0, 1, subJurisdiction));
946        }
947
948        @Override
949        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
950          switch (_hash) {
951          case -183772899: /*marketPeriod*/  return new Property("marketPeriod", "Period", "Begin and end dates for the commercial distribution of the device.", 0, 1, marketPeriod);
952          case -777497119: /*subJurisdiction*/  return new Property("subJurisdiction", "uri", "National state or territory to which the marketDistribution recers, typically where the device is commercialized.", 0, 1, subJurisdiction);
953          default: return super.getNamedProperty(_hash, _name, _checkValid);
954          }
955
956        }
957
958      @Override
959      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
960        switch (hash) {
961        case -183772899: /*marketPeriod*/ return this.marketPeriod == null ? new Base[0] : new Base[] {this.marketPeriod}; // Period
962        case -777497119: /*subJurisdiction*/ return this.subJurisdiction == null ? new Base[0] : new Base[] {this.subJurisdiction}; // UriType
963        default: return super.getProperty(hash, name, checkValid);
964        }
965
966      }
967
968      @Override
969      public Base setProperty(int hash, String name, Base value) throws FHIRException {
970        switch (hash) {
971        case -183772899: // marketPeriod
972          this.marketPeriod = TypeConvertor.castToPeriod(value); // Period
973          return value;
974        case -777497119: // subJurisdiction
975          this.subJurisdiction = TypeConvertor.castToUri(value); // UriType
976          return value;
977        default: return super.setProperty(hash, name, value);
978        }
979
980      }
981
982      @Override
983      public Base setProperty(String name, Base value) throws FHIRException {
984        if (name.equals("marketPeriod")) {
985          this.marketPeriod = TypeConvertor.castToPeriod(value); // Period
986        } else if (name.equals("subJurisdiction")) {
987          this.subJurisdiction = TypeConvertor.castToUri(value); // UriType
988        } else
989          return super.setProperty(name, value);
990        return value;
991      }
992
993      @Override
994      public Base makeProperty(int hash, String name) throws FHIRException {
995        switch (hash) {
996        case -183772899:  return getMarketPeriod();
997        case -777497119:  return getSubJurisdictionElement();
998        default: return super.makeProperty(hash, name);
999        }
1000
1001      }
1002
1003      @Override
1004      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1005        switch (hash) {
1006        case -183772899: /*marketPeriod*/ return new String[] {"Period"};
1007        case -777497119: /*subJurisdiction*/ return new String[] {"uri"};
1008        default: return super.getTypesForProperty(hash, name);
1009        }
1010
1011      }
1012
1013      @Override
1014      public Base addChild(String name) throws FHIRException {
1015        if (name.equals("marketPeriod")) {
1016          this.marketPeriod = new Period();
1017          return this.marketPeriod;
1018        }
1019        else if (name.equals("subJurisdiction")) {
1020          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.udiDeviceIdentifier.marketDistribution.subJurisdiction");
1021        }
1022        else
1023          return super.addChild(name);
1024      }
1025
1026      public DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent copy() {
1027        DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent dst = new DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent();
1028        copyValues(dst);
1029        return dst;
1030      }
1031
1032      public void copyValues(DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent dst) {
1033        super.copyValues(dst);
1034        dst.marketPeriod = marketPeriod == null ? null : marketPeriod.copy();
1035        dst.subJurisdiction = subJurisdiction == null ? null : subJurisdiction.copy();
1036      }
1037
1038      @Override
1039      public boolean equalsDeep(Base other_) {
1040        if (!super.equalsDeep(other_))
1041          return false;
1042        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent))
1043          return false;
1044        DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent o = (DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent) other_;
1045        return compareDeep(marketPeriod, o.marketPeriod, true) && compareDeep(subJurisdiction, o.subJurisdiction, true)
1046          ;
1047      }
1048
1049      @Override
1050      public boolean equalsShallow(Base other_) {
1051        if (!super.equalsShallow(other_))
1052          return false;
1053        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent))
1054          return false;
1055        DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent o = (DeviceDefinitionUdiDeviceIdentifierMarketDistributionComponent) other_;
1056        return compareValues(subJurisdiction, o.subJurisdiction, true);
1057      }
1058
1059      public boolean isEmpty() {
1060        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(marketPeriod, subJurisdiction
1061          );
1062      }
1063
1064  public String fhirType() {
1065    return "DeviceDefinition.udiDeviceIdentifier.marketDistribution";
1066
1067  }
1068
1069  }
1070
1071    @Block()
1072    public static class DeviceDefinitionRegulatoryIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
1073        /**
1074         * The type of identifier itself.
1075         */
1076        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1077        @Description(shortDefinition="basic | master | license", formalDefinition="The type of identifier itself." )
1078        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedefinition-regulatory-identifier-type")
1079        protected Enumeration<DeviceDefinitionRegulatoryIdentifierType> type;
1080
1081        /**
1082         * The identifier itself.
1083         */
1084        @Child(name = "deviceIdentifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1085        @Description(shortDefinition="The identifier itself", formalDefinition="The identifier itself." )
1086        protected StringType deviceIdentifier;
1087
1088        /**
1089         * The organization that issued this identifier.
1090         */
1091        @Child(name = "issuer", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1092        @Description(shortDefinition="The organization that issued this identifier", formalDefinition="The organization that issued this identifier." )
1093        protected UriType issuer;
1094
1095        /**
1096         * The jurisdiction to which the deviceIdentifier applies.
1097         */
1098        @Child(name = "jurisdiction", type = {UriType.class}, order=4, min=1, max=1, modifier=false, summary=false)
1099        @Description(shortDefinition="The jurisdiction to which the deviceIdentifier applies", formalDefinition="The jurisdiction to which the deviceIdentifier applies." )
1100        protected UriType jurisdiction;
1101
1102        private static final long serialVersionUID = 1438058623L;
1103
1104    /**
1105     * Constructor
1106     */
1107      public DeviceDefinitionRegulatoryIdentifierComponent() {
1108        super();
1109      }
1110
1111    /**
1112     * Constructor
1113     */
1114      public DeviceDefinitionRegulatoryIdentifierComponent(DeviceDefinitionRegulatoryIdentifierType type, String deviceIdentifier, String issuer, String jurisdiction) {
1115        super();
1116        this.setType(type);
1117        this.setDeviceIdentifier(deviceIdentifier);
1118        this.setIssuer(issuer);
1119        this.setJurisdiction(jurisdiction);
1120      }
1121
1122        /**
1123         * @return {@link #type} (The type of identifier itself.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1124         */
1125        public Enumeration<DeviceDefinitionRegulatoryIdentifierType> getTypeElement() { 
1126          if (this.type == null)
1127            if (Configuration.errorOnAutoCreate())
1128              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.type");
1129            else if (Configuration.doAutoCreate())
1130              this.type = new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory()); // bb
1131          return this.type;
1132        }
1133
1134        public boolean hasTypeElement() { 
1135          return this.type != null && !this.type.isEmpty();
1136        }
1137
1138        public boolean hasType() { 
1139          return this.type != null && !this.type.isEmpty();
1140        }
1141
1142        /**
1143         * @param value {@link #type} (The type of identifier itself.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1144         */
1145        public DeviceDefinitionRegulatoryIdentifierComponent setTypeElement(Enumeration<DeviceDefinitionRegulatoryIdentifierType> value) { 
1146          this.type = value;
1147          return this;
1148        }
1149
1150        /**
1151         * @return The type of identifier itself.
1152         */
1153        public DeviceDefinitionRegulatoryIdentifierType getType() { 
1154          return this.type == null ? null : this.type.getValue();
1155        }
1156
1157        /**
1158         * @param value The type of identifier itself.
1159         */
1160        public DeviceDefinitionRegulatoryIdentifierComponent setType(DeviceDefinitionRegulatoryIdentifierType value) { 
1161            if (this.type == null)
1162              this.type = new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory());
1163            this.type.setValue(value);
1164          return this;
1165        }
1166
1167        /**
1168         * @return {@link #deviceIdentifier} (The identifier itself.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
1169         */
1170        public StringType getDeviceIdentifierElement() { 
1171          if (this.deviceIdentifier == null)
1172            if (Configuration.errorOnAutoCreate())
1173              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.deviceIdentifier");
1174            else if (Configuration.doAutoCreate())
1175              this.deviceIdentifier = new StringType(); // bb
1176          return this.deviceIdentifier;
1177        }
1178
1179        public boolean hasDeviceIdentifierElement() { 
1180          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
1181        }
1182
1183        public boolean hasDeviceIdentifier() { 
1184          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
1185        }
1186
1187        /**
1188         * @param value {@link #deviceIdentifier} (The identifier itself.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
1189         */
1190        public DeviceDefinitionRegulatoryIdentifierComponent setDeviceIdentifierElement(StringType value) { 
1191          this.deviceIdentifier = value;
1192          return this;
1193        }
1194
1195        /**
1196         * @return The identifier itself.
1197         */
1198        public String getDeviceIdentifier() { 
1199          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
1200        }
1201
1202        /**
1203         * @param value The identifier itself.
1204         */
1205        public DeviceDefinitionRegulatoryIdentifierComponent setDeviceIdentifier(String value) { 
1206            if (this.deviceIdentifier == null)
1207              this.deviceIdentifier = new StringType();
1208            this.deviceIdentifier.setValue(value);
1209          return this;
1210        }
1211
1212        /**
1213         * @return {@link #issuer} (The organization that issued this identifier.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
1214         */
1215        public UriType getIssuerElement() { 
1216          if (this.issuer == null)
1217            if (Configuration.errorOnAutoCreate())
1218              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.issuer");
1219            else if (Configuration.doAutoCreate())
1220              this.issuer = new UriType(); // bb
1221          return this.issuer;
1222        }
1223
1224        public boolean hasIssuerElement() { 
1225          return this.issuer != null && !this.issuer.isEmpty();
1226        }
1227
1228        public boolean hasIssuer() { 
1229          return this.issuer != null && !this.issuer.isEmpty();
1230        }
1231
1232        /**
1233         * @param value {@link #issuer} (The organization that issued this identifier.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
1234         */
1235        public DeviceDefinitionRegulatoryIdentifierComponent setIssuerElement(UriType value) { 
1236          this.issuer = value;
1237          return this;
1238        }
1239
1240        /**
1241         * @return The organization that issued this identifier.
1242         */
1243        public String getIssuer() { 
1244          return this.issuer == null ? null : this.issuer.getValue();
1245        }
1246
1247        /**
1248         * @param value The organization that issued this identifier.
1249         */
1250        public DeviceDefinitionRegulatoryIdentifierComponent setIssuer(String value) { 
1251            if (this.issuer == null)
1252              this.issuer = new UriType();
1253            this.issuer.setValue(value);
1254          return this;
1255        }
1256
1257        /**
1258         * @return {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
1259         */
1260        public UriType getJurisdictionElement() { 
1261          if (this.jurisdiction == null)
1262            if (Configuration.errorOnAutoCreate())
1263              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.jurisdiction");
1264            else if (Configuration.doAutoCreate())
1265              this.jurisdiction = new UriType(); // bb
1266          return this.jurisdiction;
1267        }
1268
1269        public boolean hasJurisdictionElement() { 
1270          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
1271        }
1272
1273        public boolean hasJurisdiction() { 
1274          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
1275        }
1276
1277        /**
1278         * @param value {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
1279         */
1280        public DeviceDefinitionRegulatoryIdentifierComponent setJurisdictionElement(UriType value) { 
1281          this.jurisdiction = value;
1282          return this;
1283        }
1284
1285        /**
1286         * @return The jurisdiction to which the deviceIdentifier applies.
1287         */
1288        public String getJurisdiction() { 
1289          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
1290        }
1291
1292        /**
1293         * @param value The jurisdiction to which the deviceIdentifier applies.
1294         */
1295        public DeviceDefinitionRegulatoryIdentifierComponent setJurisdiction(String value) { 
1296            if (this.jurisdiction == null)
1297              this.jurisdiction = new UriType();
1298            this.jurisdiction.setValue(value);
1299          return this;
1300        }
1301
1302        protected void listChildren(List<Property> children) {
1303          super.listChildren(children);
1304          children.add(new Property("type", "code", "The type of identifier itself.", 0, 1, type));
1305          children.add(new Property("deviceIdentifier", "string", "The identifier itself.", 0, 1, deviceIdentifier));
1306          children.add(new Property("issuer", "uri", "The organization that issued this identifier.", 0, 1, issuer));
1307          children.add(new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction));
1308        }
1309
1310        @Override
1311        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1312          switch (_hash) {
1313          case 3575610: /*type*/  return new Property("type", "code", "The type of identifier itself.", 0, 1, type);
1314          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The identifier itself.", 0, 1, deviceIdentifier);
1315          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "The organization that issued this identifier.", 0, 1, issuer);
1316          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction);
1317          default: return super.getNamedProperty(_hash, _name, _checkValid);
1318          }
1319
1320        }
1321
1322      @Override
1323      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1324        switch (hash) {
1325        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1326        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
1327        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
1328        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
1329        default: return super.getProperty(hash, name, checkValid);
1330        }
1331
1332      }
1333
1334      @Override
1335      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1336        switch (hash) {
1337        case 3575610: // type
1338          value = new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1339          this.type = (Enumeration) value; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1340          return value;
1341        case 1322005407: // deviceIdentifier
1342          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
1343          return value;
1344        case -1179159879: // issuer
1345          this.issuer = TypeConvertor.castToUri(value); // UriType
1346          return value;
1347        case -507075711: // jurisdiction
1348          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
1349          return value;
1350        default: return super.setProperty(hash, name, value);
1351        }
1352
1353      }
1354
1355      @Override
1356      public Base setProperty(String name, Base value) throws FHIRException {
1357        if (name.equals("type")) {
1358          value = new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1359          this.type = (Enumeration) value; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1360        } else if (name.equals("deviceIdentifier")) {
1361          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
1362        } else if (name.equals("issuer")) {
1363          this.issuer = TypeConvertor.castToUri(value); // UriType
1364        } else if (name.equals("jurisdiction")) {
1365          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
1366        } else
1367          return super.setProperty(name, value);
1368        return value;
1369      }
1370
1371      @Override
1372      public Base makeProperty(int hash, String name) throws FHIRException {
1373        switch (hash) {
1374        case 3575610:  return getTypeElement();
1375        case 1322005407:  return getDeviceIdentifierElement();
1376        case -1179159879:  return getIssuerElement();
1377        case -507075711:  return getJurisdictionElement();
1378        default: return super.makeProperty(hash, name);
1379        }
1380
1381      }
1382
1383      @Override
1384      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1385        switch (hash) {
1386        case 3575610: /*type*/ return new String[] {"code"};
1387        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
1388        case -1179159879: /*issuer*/ return new String[] {"uri"};
1389        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
1390        default: return super.getTypesForProperty(hash, name);
1391        }
1392
1393      }
1394
1395      @Override
1396      public Base addChild(String name) throws FHIRException {
1397        if (name.equals("type")) {
1398          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.regulatoryIdentifier.type");
1399        }
1400        else if (name.equals("deviceIdentifier")) {
1401          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.regulatoryIdentifier.deviceIdentifier");
1402        }
1403        else if (name.equals("issuer")) {
1404          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.regulatoryIdentifier.issuer");
1405        }
1406        else if (name.equals("jurisdiction")) {
1407          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.regulatoryIdentifier.jurisdiction");
1408        }
1409        else
1410          return super.addChild(name);
1411      }
1412
1413      public DeviceDefinitionRegulatoryIdentifierComponent copy() {
1414        DeviceDefinitionRegulatoryIdentifierComponent dst = new DeviceDefinitionRegulatoryIdentifierComponent();
1415        copyValues(dst);
1416        return dst;
1417      }
1418
1419      public void copyValues(DeviceDefinitionRegulatoryIdentifierComponent dst) {
1420        super.copyValues(dst);
1421        dst.type = type == null ? null : type.copy();
1422        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
1423        dst.issuer = issuer == null ? null : issuer.copy();
1424        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
1425      }
1426
1427      @Override
1428      public boolean equalsDeep(Base other_) {
1429        if (!super.equalsDeep(other_))
1430          return false;
1431        if (!(other_ instanceof DeviceDefinitionRegulatoryIdentifierComponent))
1432          return false;
1433        DeviceDefinitionRegulatoryIdentifierComponent o = (DeviceDefinitionRegulatoryIdentifierComponent) other_;
1434        return compareDeep(type, o.type, true) && compareDeep(deviceIdentifier, o.deviceIdentifier, true)
1435           && compareDeep(issuer, o.issuer, true) && compareDeep(jurisdiction, o.jurisdiction, true);
1436      }
1437
1438      @Override
1439      public boolean equalsShallow(Base other_) {
1440        if (!super.equalsShallow(other_))
1441          return false;
1442        if (!(other_ instanceof DeviceDefinitionRegulatoryIdentifierComponent))
1443          return false;
1444        DeviceDefinitionRegulatoryIdentifierComponent o = (DeviceDefinitionRegulatoryIdentifierComponent) other_;
1445        return compareValues(type, o.type, true) && compareValues(deviceIdentifier, o.deviceIdentifier, true)
1446           && compareValues(issuer, o.issuer, true) && compareValues(jurisdiction, o.jurisdiction, true);
1447      }
1448
1449      public boolean isEmpty() {
1450        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, deviceIdentifier, issuer
1451          , jurisdiction);
1452      }
1453
1454  public String fhirType() {
1455    return "DeviceDefinition.regulatoryIdentifier";
1456
1457  }
1458
1459  }
1460
1461    @Block()
1462    public static class DeviceDefinitionDeviceNameComponent extends BackboneElement implements IBaseBackboneElement {
1463        /**
1464         * A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1465         */
1466        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1467        @Description(shortDefinition="A name that is used to refer to the device", formalDefinition="A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other." )
1468        protected StringType name;
1469
1470        /**
1471         * The type of deviceName.
1472RegisteredName | UserFriendlyName | PatientReportedName.
1473         */
1474        @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1475        @Description(shortDefinition="registered-name | user-friendly-name | patient-reported-name", formalDefinition="The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName." )
1476        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-nametype")
1477        protected Enumeration<DeviceNameType> type;
1478
1479        private static final long serialVersionUID = 918983440L;
1480
1481    /**
1482     * Constructor
1483     */
1484      public DeviceDefinitionDeviceNameComponent() {
1485        super();
1486      }
1487
1488    /**
1489     * Constructor
1490     */
1491      public DeviceDefinitionDeviceNameComponent(String name, DeviceNameType type) {
1492        super();
1493        this.setName(name);
1494        this.setType(type);
1495      }
1496
1497        /**
1498         * @return {@link #name} (A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1499         */
1500        public StringType getNameElement() { 
1501          if (this.name == null)
1502            if (Configuration.errorOnAutoCreate())
1503              throw new Error("Attempt to auto-create DeviceDefinitionDeviceNameComponent.name");
1504            else if (Configuration.doAutoCreate())
1505              this.name = new StringType(); // bb
1506          return this.name;
1507        }
1508
1509        public boolean hasNameElement() { 
1510          return this.name != null && !this.name.isEmpty();
1511        }
1512
1513        public boolean hasName() { 
1514          return this.name != null && !this.name.isEmpty();
1515        }
1516
1517        /**
1518         * @param value {@link #name} (A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1519         */
1520        public DeviceDefinitionDeviceNameComponent setNameElement(StringType value) { 
1521          this.name = value;
1522          return this;
1523        }
1524
1525        /**
1526         * @return A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1527         */
1528        public String getName() { 
1529          return this.name == null ? null : this.name.getValue();
1530        }
1531
1532        /**
1533         * @param value A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1534         */
1535        public DeviceDefinitionDeviceNameComponent setName(String value) { 
1536            if (this.name == null)
1537              this.name = new StringType();
1538            this.name.setValue(value);
1539          return this;
1540        }
1541
1542        /**
1543         * @return {@link #type} (The type of deviceName.
1544RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1545         */
1546        public Enumeration<DeviceNameType> getTypeElement() { 
1547          if (this.type == null)
1548            if (Configuration.errorOnAutoCreate())
1549              throw new Error("Attempt to auto-create DeviceDefinitionDeviceNameComponent.type");
1550            else if (Configuration.doAutoCreate())
1551              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory()); // bb
1552          return this.type;
1553        }
1554
1555        public boolean hasTypeElement() { 
1556          return this.type != null && !this.type.isEmpty();
1557        }
1558
1559        public boolean hasType() { 
1560          return this.type != null && !this.type.isEmpty();
1561        }
1562
1563        /**
1564         * @param value {@link #type} (The type of deviceName.
1565RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1566         */
1567        public DeviceDefinitionDeviceNameComponent setTypeElement(Enumeration<DeviceNameType> value) { 
1568          this.type = value;
1569          return this;
1570        }
1571
1572        /**
1573         * @return The type of deviceName.
1574RegisteredName | UserFriendlyName | PatientReportedName.
1575         */
1576        public DeviceNameType getType() { 
1577          return this.type == null ? null : this.type.getValue();
1578        }
1579
1580        /**
1581         * @param value The type of deviceName.
1582RegisteredName | UserFriendlyName | PatientReportedName.
1583         */
1584        public DeviceDefinitionDeviceNameComponent setType(DeviceNameType value) { 
1585            if (this.type == null)
1586              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory());
1587            this.type.setValue(value);
1588          return this;
1589        }
1590
1591        protected void listChildren(List<Property> children) {
1592          super.listChildren(children);
1593          children.add(new Property("name", "string", "A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.", 0, 1, name));
1594          children.add(new Property("type", "code", "The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type));
1595        }
1596
1597        @Override
1598        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1599          switch (_hash) {
1600          case 3373707: /*name*/  return new Property("name", "string", "A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.", 0, 1, name);
1601          case 3575610: /*type*/  return new Property("type", "code", "The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type);
1602          default: return super.getNamedProperty(_hash, _name, _checkValid);
1603          }
1604
1605        }
1606
1607      @Override
1608      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1609        switch (hash) {
1610        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1611        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceNameType>
1612        default: return super.getProperty(hash, name, checkValid);
1613        }
1614
1615      }
1616
1617      @Override
1618      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1619        switch (hash) {
1620        case 3373707: // name
1621          this.name = TypeConvertor.castToString(value); // StringType
1622          return value;
1623        case 3575610: // type
1624          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1625          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1626          return value;
1627        default: return super.setProperty(hash, name, value);
1628        }
1629
1630      }
1631
1632      @Override
1633      public Base setProperty(String name, Base value) throws FHIRException {
1634        if (name.equals("name")) {
1635          this.name = TypeConvertor.castToString(value); // StringType
1636        } else if (name.equals("type")) {
1637          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1638          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1639        } else
1640          return super.setProperty(name, value);
1641        return value;
1642      }
1643
1644      @Override
1645      public Base makeProperty(int hash, String name) throws FHIRException {
1646        switch (hash) {
1647        case 3373707:  return getNameElement();
1648        case 3575610:  return getTypeElement();
1649        default: return super.makeProperty(hash, name);
1650        }
1651
1652      }
1653
1654      @Override
1655      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1656        switch (hash) {
1657        case 3373707: /*name*/ return new String[] {"string"};
1658        case 3575610: /*type*/ return new String[] {"code"};
1659        default: return super.getTypesForProperty(hash, name);
1660        }
1661
1662      }
1663
1664      @Override
1665      public Base addChild(String name) throws FHIRException {
1666        if (name.equals("name")) {
1667          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.deviceName.name");
1668        }
1669        else if (name.equals("type")) {
1670          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.deviceName.type");
1671        }
1672        else
1673          return super.addChild(name);
1674      }
1675
1676      public DeviceDefinitionDeviceNameComponent copy() {
1677        DeviceDefinitionDeviceNameComponent dst = new DeviceDefinitionDeviceNameComponent();
1678        copyValues(dst);
1679        return dst;
1680      }
1681
1682      public void copyValues(DeviceDefinitionDeviceNameComponent dst) {
1683        super.copyValues(dst);
1684        dst.name = name == null ? null : name.copy();
1685        dst.type = type == null ? null : type.copy();
1686      }
1687
1688      @Override
1689      public boolean equalsDeep(Base other_) {
1690        if (!super.equalsDeep(other_))
1691          return false;
1692        if (!(other_ instanceof DeviceDefinitionDeviceNameComponent))
1693          return false;
1694        DeviceDefinitionDeviceNameComponent o = (DeviceDefinitionDeviceNameComponent) other_;
1695        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
1696      }
1697
1698      @Override
1699      public boolean equalsShallow(Base other_) {
1700        if (!super.equalsShallow(other_))
1701          return false;
1702        if (!(other_ instanceof DeviceDefinitionDeviceNameComponent))
1703          return false;
1704        DeviceDefinitionDeviceNameComponent o = (DeviceDefinitionDeviceNameComponent) other_;
1705        return compareValues(name, o.name, true) && compareValues(type, o.type, true);
1706      }
1707
1708      public boolean isEmpty() {
1709        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
1710      }
1711
1712  public String fhirType() {
1713    return "DeviceDefinition.deviceName";
1714
1715  }
1716
1717  }
1718
1719    @Block()
1720    public static class DeviceDefinitionClassificationComponent extends BackboneElement implements IBaseBackboneElement {
1721        /**
1722         * A classification or risk class of the device model.
1723         */
1724        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1725        @Description(shortDefinition="A classification or risk class of the device model", formalDefinition="A classification or risk class of the device model." )
1726        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-type")
1727        protected CodeableConcept type;
1728
1729        /**
1730         * Further information qualifying this classification of the device model.
1731         */
1732        @Child(name = "justification", type = {RelatedArtifact.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1733        @Description(shortDefinition="Further information qualifying this classification of the device model", formalDefinition="Further information qualifying this classification of the device model." )
1734        protected List<RelatedArtifact> justification;
1735
1736        private static final long serialVersionUID = -1343788026L;
1737
1738    /**
1739     * Constructor
1740     */
1741      public DeviceDefinitionClassificationComponent() {
1742        super();
1743      }
1744
1745    /**
1746     * Constructor
1747     */
1748      public DeviceDefinitionClassificationComponent(CodeableConcept type) {
1749        super();
1750        this.setType(type);
1751      }
1752
1753        /**
1754         * @return {@link #type} (A classification or risk class of the device model.)
1755         */
1756        public CodeableConcept getType() { 
1757          if (this.type == null)
1758            if (Configuration.errorOnAutoCreate())
1759              throw new Error("Attempt to auto-create DeviceDefinitionClassificationComponent.type");
1760            else if (Configuration.doAutoCreate())
1761              this.type = new CodeableConcept(); // cc
1762          return this.type;
1763        }
1764
1765        public boolean hasType() { 
1766          return this.type != null && !this.type.isEmpty();
1767        }
1768
1769        /**
1770         * @param value {@link #type} (A classification or risk class of the device model.)
1771         */
1772        public DeviceDefinitionClassificationComponent setType(CodeableConcept value) { 
1773          this.type = value;
1774          return this;
1775        }
1776
1777        /**
1778         * @return {@link #justification} (Further information qualifying this classification of the device model.)
1779         */
1780        public List<RelatedArtifact> getJustification() { 
1781          if (this.justification == null)
1782            this.justification = new ArrayList<RelatedArtifact>();
1783          return this.justification;
1784        }
1785
1786        /**
1787         * @return Returns a reference to <code>this</code> for easy method chaining
1788         */
1789        public DeviceDefinitionClassificationComponent setJustification(List<RelatedArtifact> theJustification) { 
1790          this.justification = theJustification;
1791          return this;
1792        }
1793
1794        public boolean hasJustification() { 
1795          if (this.justification == null)
1796            return false;
1797          for (RelatedArtifact item : this.justification)
1798            if (!item.isEmpty())
1799              return true;
1800          return false;
1801        }
1802
1803        public RelatedArtifact addJustification() { //3
1804          RelatedArtifact t = new RelatedArtifact();
1805          if (this.justification == null)
1806            this.justification = new ArrayList<RelatedArtifact>();
1807          this.justification.add(t);
1808          return t;
1809        }
1810
1811        public DeviceDefinitionClassificationComponent addJustification(RelatedArtifact t) { //3
1812          if (t == null)
1813            return this;
1814          if (this.justification == null)
1815            this.justification = new ArrayList<RelatedArtifact>();
1816          this.justification.add(t);
1817          return this;
1818        }
1819
1820        /**
1821         * @return The first repetition of repeating field {@link #justification}, creating it if it does not already exist {3}
1822         */
1823        public RelatedArtifact getJustificationFirstRep() { 
1824          if (getJustification().isEmpty()) {
1825            addJustification();
1826          }
1827          return getJustification().get(0);
1828        }
1829
1830        protected void listChildren(List<Property> children) {
1831          super.listChildren(children);
1832          children.add(new Property("type", "CodeableConcept", "A classification or risk class of the device model.", 0, 1, type));
1833          children.add(new Property("justification", "RelatedArtifact", "Further information qualifying this classification of the device model.", 0, java.lang.Integer.MAX_VALUE, justification));
1834        }
1835
1836        @Override
1837        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1838          switch (_hash) {
1839          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A classification or risk class of the device model.", 0, 1, type);
1840          case 1864993522: /*justification*/  return new Property("justification", "RelatedArtifact", "Further information qualifying this classification of the device model.", 0, java.lang.Integer.MAX_VALUE, justification);
1841          default: return super.getNamedProperty(_hash, _name, _checkValid);
1842          }
1843
1844        }
1845
1846      @Override
1847      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1848        switch (hash) {
1849        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1850        case 1864993522: /*justification*/ return this.justification == null ? new Base[0] : this.justification.toArray(new Base[this.justification.size()]); // RelatedArtifact
1851        default: return super.getProperty(hash, name, checkValid);
1852        }
1853
1854      }
1855
1856      @Override
1857      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1858        switch (hash) {
1859        case 3575610: // type
1860          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1861          return value;
1862        case 1864993522: // justification
1863          this.getJustification().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
1864          return value;
1865        default: return super.setProperty(hash, name, value);
1866        }
1867
1868      }
1869
1870      @Override
1871      public Base setProperty(String name, Base value) throws FHIRException {
1872        if (name.equals("type")) {
1873          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1874        } else if (name.equals("justification")) {
1875          this.getJustification().add(TypeConvertor.castToRelatedArtifact(value));
1876        } else
1877          return super.setProperty(name, value);
1878        return value;
1879      }
1880
1881      @Override
1882      public Base makeProperty(int hash, String name) throws FHIRException {
1883        switch (hash) {
1884        case 3575610:  return getType();
1885        case 1864993522:  return addJustification(); 
1886        default: return super.makeProperty(hash, name);
1887        }
1888
1889      }
1890
1891      @Override
1892      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1893        switch (hash) {
1894        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1895        case 1864993522: /*justification*/ return new String[] {"RelatedArtifact"};
1896        default: return super.getTypesForProperty(hash, name);
1897        }
1898
1899      }
1900
1901      @Override
1902      public Base addChild(String name) throws FHIRException {
1903        if (name.equals("type")) {
1904          this.type = new CodeableConcept();
1905          return this.type;
1906        }
1907        else if (name.equals("justification")) {
1908          return addJustification();
1909        }
1910        else
1911          return super.addChild(name);
1912      }
1913
1914      public DeviceDefinitionClassificationComponent copy() {
1915        DeviceDefinitionClassificationComponent dst = new DeviceDefinitionClassificationComponent();
1916        copyValues(dst);
1917        return dst;
1918      }
1919
1920      public void copyValues(DeviceDefinitionClassificationComponent dst) {
1921        super.copyValues(dst);
1922        dst.type = type == null ? null : type.copy();
1923        if (justification != null) {
1924          dst.justification = new ArrayList<RelatedArtifact>();
1925          for (RelatedArtifact i : justification)
1926            dst.justification.add(i.copy());
1927        };
1928      }
1929
1930      @Override
1931      public boolean equalsDeep(Base other_) {
1932        if (!super.equalsDeep(other_))
1933          return false;
1934        if (!(other_ instanceof DeviceDefinitionClassificationComponent))
1935          return false;
1936        DeviceDefinitionClassificationComponent o = (DeviceDefinitionClassificationComponent) other_;
1937        return compareDeep(type, o.type, true) && compareDeep(justification, o.justification, true);
1938      }
1939
1940      @Override
1941      public boolean equalsShallow(Base other_) {
1942        if (!super.equalsShallow(other_))
1943          return false;
1944        if (!(other_ instanceof DeviceDefinitionClassificationComponent))
1945          return false;
1946        DeviceDefinitionClassificationComponent o = (DeviceDefinitionClassificationComponent) other_;
1947        return true;
1948      }
1949
1950      public boolean isEmpty() {
1951        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, justification);
1952      }
1953
1954  public String fhirType() {
1955    return "DeviceDefinition.classification";
1956
1957  }
1958
1959  }
1960
1961    @Block()
1962    public static class DeviceDefinitionHasPartComponent extends BackboneElement implements IBaseBackboneElement {
1963        /**
1964         * Reference to the device that is part of the current device.
1965         */
1966        @Child(name = "reference", type = {DeviceDefinition.class}, order=1, min=1, max=1, modifier=false, summary=false)
1967        @Description(shortDefinition="Reference to the part", formalDefinition="Reference to the device that is part of the current device." )
1968        protected Reference reference;
1969
1970        /**
1971         * Number of instances of the component device in the current device.
1972         */
1973        @Child(name = "count", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1974        @Description(shortDefinition="Number of occurrences of the part", formalDefinition="Number of instances of the component device in the current device." )
1975        protected IntegerType count;
1976
1977        private static final long serialVersionUID = -1166127369L;
1978
1979    /**
1980     * Constructor
1981     */
1982      public DeviceDefinitionHasPartComponent() {
1983        super();
1984      }
1985
1986    /**
1987     * Constructor
1988     */
1989      public DeviceDefinitionHasPartComponent(Reference reference) {
1990        super();
1991        this.setReference(reference);
1992      }
1993
1994        /**
1995         * @return {@link #reference} (Reference to the device that is part of the current device.)
1996         */
1997        public Reference getReference() { 
1998          if (this.reference == null)
1999            if (Configuration.errorOnAutoCreate())
2000              throw new Error("Attempt to auto-create DeviceDefinitionHasPartComponent.reference");
2001            else if (Configuration.doAutoCreate())
2002              this.reference = new Reference(); // cc
2003          return this.reference;
2004        }
2005
2006        public boolean hasReference() { 
2007          return this.reference != null && !this.reference.isEmpty();
2008        }
2009
2010        /**
2011         * @param value {@link #reference} (Reference to the device that is part of the current device.)
2012         */
2013        public DeviceDefinitionHasPartComponent setReference(Reference value) { 
2014          this.reference = value;
2015          return this;
2016        }
2017
2018        /**
2019         * @return {@link #count} (Number of instances of the component device in the current device.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2020         */
2021        public IntegerType getCountElement() { 
2022          if (this.count == null)
2023            if (Configuration.errorOnAutoCreate())
2024              throw new Error("Attempt to auto-create DeviceDefinitionHasPartComponent.count");
2025            else if (Configuration.doAutoCreate())
2026              this.count = new IntegerType(); // bb
2027          return this.count;
2028        }
2029
2030        public boolean hasCountElement() { 
2031          return this.count != null && !this.count.isEmpty();
2032        }
2033
2034        public boolean hasCount() { 
2035          return this.count != null && !this.count.isEmpty();
2036        }
2037
2038        /**
2039         * @param value {@link #count} (Number of instances of the component device in the current device.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2040         */
2041        public DeviceDefinitionHasPartComponent setCountElement(IntegerType value) { 
2042          this.count = value;
2043          return this;
2044        }
2045
2046        /**
2047         * @return Number of instances of the component device in the current device.
2048         */
2049        public int getCount() { 
2050          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
2051        }
2052
2053        /**
2054         * @param value Number of instances of the component device in the current device.
2055         */
2056        public DeviceDefinitionHasPartComponent setCount(int value) { 
2057            if (this.count == null)
2058              this.count = new IntegerType();
2059            this.count.setValue(value);
2060          return this;
2061        }
2062
2063        protected void listChildren(List<Property> children) {
2064          super.listChildren(children);
2065          children.add(new Property("reference", "Reference(DeviceDefinition)", "Reference to the device that is part of the current device.", 0, 1, reference));
2066          children.add(new Property("count", "integer", "Number of instances of the component device in the current device.", 0, 1, count));
2067        }
2068
2069        @Override
2070        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2071          switch (_hash) {
2072          case -925155509: /*reference*/  return new Property("reference", "Reference(DeviceDefinition)", "Reference to the device that is part of the current device.", 0, 1, reference);
2073          case 94851343: /*count*/  return new Property("count", "integer", "Number of instances of the component device in the current device.", 0, 1, count);
2074          default: return super.getNamedProperty(_hash, _name, _checkValid);
2075          }
2076
2077        }
2078
2079      @Override
2080      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2081        switch (hash) {
2082        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
2083        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
2084        default: return super.getProperty(hash, name, checkValid);
2085        }
2086
2087      }
2088
2089      @Override
2090      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2091        switch (hash) {
2092        case -925155509: // reference
2093          this.reference = TypeConvertor.castToReference(value); // Reference
2094          return value;
2095        case 94851343: // count
2096          this.count = TypeConvertor.castToInteger(value); // IntegerType
2097          return value;
2098        default: return super.setProperty(hash, name, value);
2099        }
2100
2101      }
2102
2103      @Override
2104      public Base setProperty(String name, Base value) throws FHIRException {
2105        if (name.equals("reference")) {
2106          this.reference = TypeConvertor.castToReference(value); // Reference
2107        } else if (name.equals("count")) {
2108          this.count = TypeConvertor.castToInteger(value); // IntegerType
2109        } else
2110          return super.setProperty(name, value);
2111        return value;
2112      }
2113
2114      @Override
2115      public Base makeProperty(int hash, String name) throws FHIRException {
2116        switch (hash) {
2117        case -925155509:  return getReference();
2118        case 94851343:  return getCountElement();
2119        default: return super.makeProperty(hash, name);
2120        }
2121
2122      }
2123
2124      @Override
2125      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2126        switch (hash) {
2127        case -925155509: /*reference*/ return new String[] {"Reference"};
2128        case 94851343: /*count*/ return new String[] {"integer"};
2129        default: return super.getTypesForProperty(hash, name);
2130        }
2131
2132      }
2133
2134      @Override
2135      public Base addChild(String name) throws FHIRException {
2136        if (name.equals("reference")) {
2137          this.reference = new Reference();
2138          return this.reference;
2139        }
2140        else if (name.equals("count")) {
2141          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.hasPart.count");
2142        }
2143        else
2144          return super.addChild(name);
2145      }
2146
2147      public DeviceDefinitionHasPartComponent copy() {
2148        DeviceDefinitionHasPartComponent dst = new DeviceDefinitionHasPartComponent();
2149        copyValues(dst);
2150        return dst;
2151      }
2152
2153      public void copyValues(DeviceDefinitionHasPartComponent dst) {
2154        super.copyValues(dst);
2155        dst.reference = reference == null ? null : reference.copy();
2156        dst.count = count == null ? null : count.copy();
2157      }
2158
2159      @Override
2160      public boolean equalsDeep(Base other_) {
2161        if (!super.equalsDeep(other_))
2162          return false;
2163        if (!(other_ instanceof DeviceDefinitionHasPartComponent))
2164          return false;
2165        DeviceDefinitionHasPartComponent o = (DeviceDefinitionHasPartComponent) other_;
2166        return compareDeep(reference, o.reference, true) && compareDeep(count, o.count, true);
2167      }
2168
2169      @Override
2170      public boolean equalsShallow(Base other_) {
2171        if (!super.equalsShallow(other_))
2172          return false;
2173        if (!(other_ instanceof DeviceDefinitionHasPartComponent))
2174          return false;
2175        DeviceDefinitionHasPartComponent o = (DeviceDefinitionHasPartComponent) other_;
2176        return compareValues(count, o.count, true);
2177      }
2178
2179      public boolean isEmpty() {
2180        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, count);
2181      }
2182
2183  public String fhirType() {
2184    return "DeviceDefinition.hasPart";
2185
2186  }
2187
2188  }
2189
2190    @Block()
2191    public static class DeviceDefinitionPackagingComponent extends BackboneElement implements IBaseBackboneElement {
2192        /**
2193         * The business identifier of the packaged medication.
2194         */
2195        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
2196        @Description(shortDefinition="Business identifier of the packaged medication", formalDefinition="The business identifier of the packaged medication." )
2197        protected Identifier identifier;
2198
2199        /**
2200         * A code that defines the specific type of packaging.
2201         */
2202        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2203        @Description(shortDefinition="A code that defines the specific type of packaging", formalDefinition="A code that defines the specific type of packaging." )
2204        protected CodeableConcept type;
2205
2206        /**
2207         * The number of items contained in the package (devices or sub-packages).
2208         */
2209        @Child(name = "count", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2210        @Description(shortDefinition="The number of items contained in the package (devices or sub-packages)", formalDefinition="The number of items contained in the package (devices or sub-packages)." )
2211        protected IntegerType count;
2212
2213        /**
2214         * An organization that distributes the packaged device.
2215         */
2216        @Child(name = "distributor", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2217        @Description(shortDefinition="An organization that distributes the packaged device", formalDefinition="An organization that distributes the packaged device." )
2218        protected List<DeviceDefinitionPackagingDistributorComponent> distributor;
2219
2220        /**
2221         * Unique Device Identifier (UDI) Barcode string on the packaging.
2222         */
2223        @Child(name = "udiDeviceIdentifier", type = {DeviceDefinitionUdiDeviceIdentifierComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2224        @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string on the packaging", formalDefinition="Unique Device Identifier (UDI) Barcode string on the packaging." )
2225        protected List<DeviceDefinitionUdiDeviceIdentifierComponent> udiDeviceIdentifier;
2226
2227        /**
2228         * Allows packages within packages.
2229         */
2230        @Child(name = "packaging", type = {DeviceDefinitionPackagingComponent.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2231        @Description(shortDefinition="Allows packages within packages", formalDefinition="Allows packages within packages." )
2232        protected List<DeviceDefinitionPackagingComponent> packaging;
2233
2234        private static final long serialVersionUID = -441544375L;
2235
2236    /**
2237     * Constructor
2238     */
2239      public DeviceDefinitionPackagingComponent() {
2240        super();
2241      }
2242
2243        /**
2244         * @return {@link #identifier} (The business identifier of the packaged medication.)
2245         */
2246        public Identifier getIdentifier() { 
2247          if (this.identifier == null)
2248            if (Configuration.errorOnAutoCreate())
2249              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.identifier");
2250            else if (Configuration.doAutoCreate())
2251              this.identifier = new Identifier(); // cc
2252          return this.identifier;
2253        }
2254
2255        public boolean hasIdentifier() { 
2256          return this.identifier != null && !this.identifier.isEmpty();
2257        }
2258
2259        /**
2260         * @param value {@link #identifier} (The business identifier of the packaged medication.)
2261         */
2262        public DeviceDefinitionPackagingComponent setIdentifier(Identifier value) { 
2263          this.identifier = value;
2264          return this;
2265        }
2266
2267        /**
2268         * @return {@link #type} (A code that defines the specific type of packaging.)
2269         */
2270        public CodeableConcept getType() { 
2271          if (this.type == null)
2272            if (Configuration.errorOnAutoCreate())
2273              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.type");
2274            else if (Configuration.doAutoCreate())
2275              this.type = new CodeableConcept(); // cc
2276          return this.type;
2277        }
2278
2279        public boolean hasType() { 
2280          return this.type != null && !this.type.isEmpty();
2281        }
2282
2283        /**
2284         * @param value {@link #type} (A code that defines the specific type of packaging.)
2285         */
2286        public DeviceDefinitionPackagingComponent setType(CodeableConcept value) { 
2287          this.type = value;
2288          return this;
2289        }
2290
2291        /**
2292         * @return {@link #count} (The number of items contained in the package (devices or sub-packages).). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2293         */
2294        public IntegerType getCountElement() { 
2295          if (this.count == null)
2296            if (Configuration.errorOnAutoCreate())
2297              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.count");
2298            else if (Configuration.doAutoCreate())
2299              this.count = new IntegerType(); // bb
2300          return this.count;
2301        }
2302
2303        public boolean hasCountElement() { 
2304          return this.count != null && !this.count.isEmpty();
2305        }
2306
2307        public boolean hasCount() { 
2308          return this.count != null && !this.count.isEmpty();
2309        }
2310
2311        /**
2312         * @param value {@link #count} (The number of items contained in the package (devices or sub-packages).). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2313         */
2314        public DeviceDefinitionPackagingComponent setCountElement(IntegerType value) { 
2315          this.count = value;
2316          return this;
2317        }
2318
2319        /**
2320         * @return The number of items contained in the package (devices or sub-packages).
2321         */
2322        public int getCount() { 
2323          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
2324        }
2325
2326        /**
2327         * @param value The number of items contained in the package (devices or sub-packages).
2328         */
2329        public DeviceDefinitionPackagingComponent setCount(int value) { 
2330            if (this.count == null)
2331              this.count = new IntegerType();
2332            this.count.setValue(value);
2333          return this;
2334        }
2335
2336        /**
2337         * @return {@link #distributor} (An organization that distributes the packaged device.)
2338         */
2339        public List<DeviceDefinitionPackagingDistributorComponent> getDistributor() { 
2340          if (this.distributor == null)
2341            this.distributor = new ArrayList<DeviceDefinitionPackagingDistributorComponent>();
2342          return this.distributor;
2343        }
2344
2345        /**
2346         * @return Returns a reference to <code>this</code> for easy method chaining
2347         */
2348        public DeviceDefinitionPackagingComponent setDistributor(List<DeviceDefinitionPackagingDistributorComponent> theDistributor) { 
2349          this.distributor = theDistributor;
2350          return this;
2351        }
2352
2353        public boolean hasDistributor() { 
2354          if (this.distributor == null)
2355            return false;
2356          for (DeviceDefinitionPackagingDistributorComponent item : this.distributor)
2357            if (!item.isEmpty())
2358              return true;
2359          return false;
2360        }
2361
2362        public DeviceDefinitionPackagingDistributorComponent addDistributor() { //3
2363          DeviceDefinitionPackagingDistributorComponent t = new DeviceDefinitionPackagingDistributorComponent();
2364          if (this.distributor == null)
2365            this.distributor = new ArrayList<DeviceDefinitionPackagingDistributorComponent>();
2366          this.distributor.add(t);
2367          return t;
2368        }
2369
2370        public DeviceDefinitionPackagingComponent addDistributor(DeviceDefinitionPackagingDistributorComponent t) { //3
2371          if (t == null)
2372            return this;
2373          if (this.distributor == null)
2374            this.distributor = new ArrayList<DeviceDefinitionPackagingDistributorComponent>();
2375          this.distributor.add(t);
2376          return this;
2377        }
2378
2379        /**
2380         * @return The first repetition of repeating field {@link #distributor}, creating it if it does not already exist {3}
2381         */
2382        public DeviceDefinitionPackagingDistributorComponent getDistributorFirstRep() { 
2383          if (getDistributor().isEmpty()) {
2384            addDistributor();
2385          }
2386          return getDistributor().get(0);
2387        }
2388
2389        /**
2390         * @return {@link #udiDeviceIdentifier} (Unique Device Identifier (UDI) Barcode string on the packaging.)
2391         */
2392        public List<DeviceDefinitionUdiDeviceIdentifierComponent> getUdiDeviceIdentifier() { 
2393          if (this.udiDeviceIdentifier == null)
2394            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2395          return this.udiDeviceIdentifier;
2396        }
2397
2398        /**
2399         * @return Returns a reference to <code>this</code> for easy method chaining
2400         */
2401        public DeviceDefinitionPackagingComponent setUdiDeviceIdentifier(List<DeviceDefinitionUdiDeviceIdentifierComponent> theUdiDeviceIdentifier) { 
2402          this.udiDeviceIdentifier = theUdiDeviceIdentifier;
2403          return this;
2404        }
2405
2406        public boolean hasUdiDeviceIdentifier() { 
2407          if (this.udiDeviceIdentifier == null)
2408            return false;
2409          for (DeviceDefinitionUdiDeviceIdentifierComponent item : this.udiDeviceIdentifier)
2410            if (!item.isEmpty())
2411              return true;
2412          return false;
2413        }
2414
2415        public DeviceDefinitionUdiDeviceIdentifierComponent addUdiDeviceIdentifier() { //3
2416          DeviceDefinitionUdiDeviceIdentifierComponent t = new DeviceDefinitionUdiDeviceIdentifierComponent();
2417          if (this.udiDeviceIdentifier == null)
2418            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2419          this.udiDeviceIdentifier.add(t);
2420          return t;
2421        }
2422
2423        public DeviceDefinitionPackagingComponent addUdiDeviceIdentifier(DeviceDefinitionUdiDeviceIdentifierComponent t) { //3
2424          if (t == null)
2425            return this;
2426          if (this.udiDeviceIdentifier == null)
2427            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2428          this.udiDeviceIdentifier.add(t);
2429          return this;
2430        }
2431
2432        /**
2433         * @return The first repetition of repeating field {@link #udiDeviceIdentifier}, creating it if it does not already exist {3}
2434         */
2435        public DeviceDefinitionUdiDeviceIdentifierComponent getUdiDeviceIdentifierFirstRep() { 
2436          if (getUdiDeviceIdentifier().isEmpty()) {
2437            addUdiDeviceIdentifier();
2438          }
2439          return getUdiDeviceIdentifier().get(0);
2440        }
2441
2442        /**
2443         * @return {@link #packaging} (Allows packages within packages.)
2444         */
2445        public List<DeviceDefinitionPackagingComponent> getPackaging() { 
2446          if (this.packaging == null)
2447            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2448          return this.packaging;
2449        }
2450
2451        /**
2452         * @return Returns a reference to <code>this</code> for easy method chaining
2453         */
2454        public DeviceDefinitionPackagingComponent setPackaging(List<DeviceDefinitionPackagingComponent> thePackaging) { 
2455          this.packaging = thePackaging;
2456          return this;
2457        }
2458
2459        public boolean hasPackaging() { 
2460          if (this.packaging == null)
2461            return false;
2462          for (DeviceDefinitionPackagingComponent item : this.packaging)
2463            if (!item.isEmpty())
2464              return true;
2465          return false;
2466        }
2467
2468        public DeviceDefinitionPackagingComponent addPackaging() { //3
2469          DeviceDefinitionPackagingComponent t = new DeviceDefinitionPackagingComponent();
2470          if (this.packaging == null)
2471            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2472          this.packaging.add(t);
2473          return t;
2474        }
2475
2476        public DeviceDefinitionPackagingComponent addPackaging(DeviceDefinitionPackagingComponent t) { //3
2477          if (t == null)
2478            return this;
2479          if (this.packaging == null)
2480            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2481          this.packaging.add(t);
2482          return this;
2483        }
2484
2485        /**
2486         * @return The first repetition of repeating field {@link #packaging}, creating it if it does not already exist {3}
2487         */
2488        public DeviceDefinitionPackagingComponent getPackagingFirstRep() { 
2489          if (getPackaging().isEmpty()) {
2490            addPackaging();
2491          }
2492          return getPackaging().get(0);
2493        }
2494
2495        protected void listChildren(List<Property> children) {
2496          super.listChildren(children);
2497          children.add(new Property("identifier", "Identifier", "The business identifier of the packaged medication.", 0, 1, identifier));
2498          children.add(new Property("type", "CodeableConcept", "A code that defines the specific type of packaging.", 0, 1, type));
2499          children.add(new Property("count", "integer", "The number of items contained in the package (devices or sub-packages).", 0, 1, count));
2500          children.add(new Property("distributor", "", "An organization that distributes the packaged device.", 0, java.lang.Integer.MAX_VALUE, distributor));
2501          children.add(new Property("udiDeviceIdentifier", "@DeviceDefinition.udiDeviceIdentifier", "Unique Device Identifier (UDI) Barcode string on the packaging.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier));
2502          children.add(new Property("packaging", "@DeviceDefinition.packaging", "Allows packages within packages.", 0, java.lang.Integer.MAX_VALUE, packaging));
2503        }
2504
2505        @Override
2506        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2507          switch (_hash) {
2508          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The business identifier of the packaged medication.", 0, 1, identifier);
2509          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code that defines the specific type of packaging.", 0, 1, type);
2510          case 94851343: /*count*/  return new Property("count", "integer", "The number of items contained in the package (devices or sub-packages).", 0, 1, count);
2511          case 1334482919: /*distributor*/  return new Property("distributor", "", "An organization that distributes the packaged device.", 0, java.lang.Integer.MAX_VALUE, distributor);
2512          case -99121287: /*udiDeviceIdentifier*/  return new Property("udiDeviceIdentifier", "@DeviceDefinition.udiDeviceIdentifier", "Unique Device Identifier (UDI) Barcode string on the packaging.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier);
2513          case 1802065795: /*packaging*/  return new Property("packaging", "@DeviceDefinition.packaging", "Allows packages within packages.", 0, java.lang.Integer.MAX_VALUE, packaging);
2514          default: return super.getNamedProperty(_hash, _name, _checkValid);
2515          }
2516
2517        }
2518
2519      @Override
2520      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2521        switch (hash) {
2522        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2523        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2524        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
2525        case 1334482919: /*distributor*/ return this.distributor == null ? new Base[0] : this.distributor.toArray(new Base[this.distributor.size()]); // DeviceDefinitionPackagingDistributorComponent
2526        case -99121287: /*udiDeviceIdentifier*/ return this.udiDeviceIdentifier == null ? new Base[0] : this.udiDeviceIdentifier.toArray(new Base[this.udiDeviceIdentifier.size()]); // DeviceDefinitionUdiDeviceIdentifierComponent
2527        case 1802065795: /*packaging*/ return this.packaging == null ? new Base[0] : this.packaging.toArray(new Base[this.packaging.size()]); // DeviceDefinitionPackagingComponent
2528        default: return super.getProperty(hash, name, checkValid);
2529        }
2530
2531      }
2532
2533      @Override
2534      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2535        switch (hash) {
2536        case -1618432855: // identifier
2537          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
2538          return value;
2539        case 3575610: // type
2540          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2541          return value;
2542        case 94851343: // count
2543          this.count = TypeConvertor.castToInteger(value); // IntegerType
2544          return value;
2545        case 1334482919: // distributor
2546          this.getDistributor().add((DeviceDefinitionPackagingDistributorComponent) value); // DeviceDefinitionPackagingDistributorComponent
2547          return value;
2548        case -99121287: // udiDeviceIdentifier
2549          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value); // DeviceDefinitionUdiDeviceIdentifierComponent
2550          return value;
2551        case 1802065795: // packaging
2552          this.getPackaging().add((DeviceDefinitionPackagingComponent) value); // DeviceDefinitionPackagingComponent
2553          return value;
2554        default: return super.setProperty(hash, name, value);
2555        }
2556
2557      }
2558
2559      @Override
2560      public Base setProperty(String name, Base value) throws FHIRException {
2561        if (name.equals("identifier")) {
2562          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
2563        } else if (name.equals("type")) {
2564          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2565        } else if (name.equals("count")) {
2566          this.count = TypeConvertor.castToInteger(value); // IntegerType
2567        } else if (name.equals("distributor")) {
2568          this.getDistributor().add((DeviceDefinitionPackagingDistributorComponent) value);
2569        } else if (name.equals("udiDeviceIdentifier")) {
2570          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value);
2571        } else if (name.equals("packaging")) {
2572          this.getPackaging().add((DeviceDefinitionPackagingComponent) value);
2573        } else
2574          return super.setProperty(name, value);
2575        return value;
2576      }
2577
2578      @Override
2579      public Base makeProperty(int hash, String name) throws FHIRException {
2580        switch (hash) {
2581        case -1618432855:  return getIdentifier();
2582        case 3575610:  return getType();
2583        case 94851343:  return getCountElement();
2584        case 1334482919:  return addDistributor(); 
2585        case -99121287:  return addUdiDeviceIdentifier(); 
2586        case 1802065795:  return addPackaging(); 
2587        default: return super.makeProperty(hash, name);
2588        }
2589
2590      }
2591
2592      @Override
2593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2594        switch (hash) {
2595        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2596        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2597        case 94851343: /*count*/ return new String[] {"integer"};
2598        case 1334482919: /*distributor*/ return new String[] {};
2599        case -99121287: /*udiDeviceIdentifier*/ return new String[] {"@DeviceDefinition.udiDeviceIdentifier"};
2600        case 1802065795: /*packaging*/ return new String[] {"@DeviceDefinition.packaging"};
2601        default: return super.getTypesForProperty(hash, name);
2602        }
2603
2604      }
2605
2606      @Override
2607      public Base addChild(String name) throws FHIRException {
2608        if (name.equals("identifier")) {
2609          this.identifier = new Identifier();
2610          return this.identifier;
2611        }
2612        else if (name.equals("type")) {
2613          this.type = new CodeableConcept();
2614          return this.type;
2615        }
2616        else if (name.equals("count")) {
2617          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.packaging.count");
2618        }
2619        else if (name.equals("distributor")) {
2620          return addDistributor();
2621        }
2622        else if (name.equals("udiDeviceIdentifier")) {
2623          return addUdiDeviceIdentifier();
2624        }
2625        else if (name.equals("packaging")) {
2626          return addPackaging();
2627        }
2628        else
2629          return super.addChild(name);
2630      }
2631
2632      public DeviceDefinitionPackagingComponent copy() {
2633        DeviceDefinitionPackagingComponent dst = new DeviceDefinitionPackagingComponent();
2634        copyValues(dst);
2635        return dst;
2636      }
2637
2638      public void copyValues(DeviceDefinitionPackagingComponent dst) {
2639        super.copyValues(dst);
2640        dst.identifier = identifier == null ? null : identifier.copy();
2641        dst.type = type == null ? null : type.copy();
2642        dst.count = count == null ? null : count.copy();
2643        if (distributor != null) {
2644          dst.distributor = new ArrayList<DeviceDefinitionPackagingDistributorComponent>();
2645          for (DeviceDefinitionPackagingDistributorComponent i : distributor)
2646            dst.distributor.add(i.copy());
2647        };
2648        if (udiDeviceIdentifier != null) {
2649          dst.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2650          for (DeviceDefinitionUdiDeviceIdentifierComponent i : udiDeviceIdentifier)
2651            dst.udiDeviceIdentifier.add(i.copy());
2652        };
2653        if (packaging != null) {
2654          dst.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2655          for (DeviceDefinitionPackagingComponent i : packaging)
2656            dst.packaging.add(i.copy());
2657        };
2658      }
2659
2660      @Override
2661      public boolean equalsDeep(Base other_) {
2662        if (!super.equalsDeep(other_))
2663          return false;
2664        if (!(other_ instanceof DeviceDefinitionPackagingComponent))
2665          return false;
2666        DeviceDefinitionPackagingComponent o = (DeviceDefinitionPackagingComponent) other_;
2667        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(count, o.count, true)
2668           && compareDeep(distributor, o.distributor, true) && compareDeep(udiDeviceIdentifier, o.udiDeviceIdentifier, true)
2669           && compareDeep(packaging, o.packaging, true);
2670      }
2671
2672      @Override
2673      public boolean equalsShallow(Base other_) {
2674        if (!super.equalsShallow(other_))
2675          return false;
2676        if (!(other_ instanceof DeviceDefinitionPackagingComponent))
2677          return false;
2678        DeviceDefinitionPackagingComponent o = (DeviceDefinitionPackagingComponent) other_;
2679        return compareValues(count, o.count, true);
2680      }
2681
2682      public boolean isEmpty() {
2683        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, count
2684          , distributor, udiDeviceIdentifier, packaging);
2685      }
2686
2687  public String fhirType() {
2688    return "DeviceDefinition.packaging";
2689
2690  }
2691
2692  }
2693
2694    @Block()
2695    public static class DeviceDefinitionPackagingDistributorComponent extends BackboneElement implements IBaseBackboneElement {
2696        /**
2697         * Distributor's human-readable name.
2698         */
2699        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2700        @Description(shortDefinition="Distributor's human-readable name", formalDefinition="Distributor's human-readable name." )
2701        protected StringType name;
2702
2703        /**
2704         * Distributor as an Organization resource.
2705         */
2706        @Child(name = "organizationReference", type = {Organization.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2707        @Description(shortDefinition="Distributor as an Organization resource", formalDefinition="Distributor as an Organization resource." )
2708        protected List<Reference> organizationReference;
2709
2710        private static final long serialVersionUID = 1587433419L;
2711
2712    /**
2713     * Constructor
2714     */
2715      public DeviceDefinitionPackagingDistributorComponent() {
2716        super();
2717      }
2718
2719        /**
2720         * @return {@link #name} (Distributor's human-readable name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2721         */
2722        public StringType getNameElement() { 
2723          if (this.name == null)
2724            if (Configuration.errorOnAutoCreate())
2725              throw new Error("Attempt to auto-create DeviceDefinitionPackagingDistributorComponent.name");
2726            else if (Configuration.doAutoCreate())
2727              this.name = new StringType(); // bb
2728          return this.name;
2729        }
2730
2731        public boolean hasNameElement() { 
2732          return this.name != null && !this.name.isEmpty();
2733        }
2734
2735        public boolean hasName() { 
2736          return this.name != null && !this.name.isEmpty();
2737        }
2738
2739        /**
2740         * @param value {@link #name} (Distributor's human-readable name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2741         */
2742        public DeviceDefinitionPackagingDistributorComponent setNameElement(StringType value) { 
2743          this.name = value;
2744          return this;
2745        }
2746
2747        /**
2748         * @return Distributor's human-readable name.
2749         */
2750        public String getName() { 
2751          return this.name == null ? null : this.name.getValue();
2752        }
2753
2754        /**
2755         * @param value Distributor's human-readable name.
2756         */
2757        public DeviceDefinitionPackagingDistributorComponent setName(String value) { 
2758          if (Utilities.noString(value))
2759            this.name = null;
2760          else {
2761            if (this.name == null)
2762              this.name = new StringType();
2763            this.name.setValue(value);
2764          }
2765          return this;
2766        }
2767
2768        /**
2769         * @return {@link #organizationReference} (Distributor as an Organization resource.)
2770         */
2771        public List<Reference> getOrganizationReference() { 
2772          if (this.organizationReference == null)
2773            this.organizationReference = new ArrayList<Reference>();
2774          return this.organizationReference;
2775        }
2776
2777        /**
2778         * @return Returns a reference to <code>this</code> for easy method chaining
2779         */
2780        public DeviceDefinitionPackagingDistributorComponent setOrganizationReference(List<Reference> theOrganizationReference) { 
2781          this.organizationReference = theOrganizationReference;
2782          return this;
2783        }
2784
2785        public boolean hasOrganizationReference() { 
2786          if (this.organizationReference == null)
2787            return false;
2788          for (Reference item : this.organizationReference)
2789            if (!item.isEmpty())
2790              return true;
2791          return false;
2792        }
2793
2794        public Reference addOrganizationReference() { //3
2795          Reference t = new Reference();
2796          if (this.organizationReference == null)
2797            this.organizationReference = new ArrayList<Reference>();
2798          this.organizationReference.add(t);
2799          return t;
2800        }
2801
2802        public DeviceDefinitionPackagingDistributorComponent addOrganizationReference(Reference t) { //3
2803          if (t == null)
2804            return this;
2805          if (this.organizationReference == null)
2806            this.organizationReference = new ArrayList<Reference>();
2807          this.organizationReference.add(t);
2808          return this;
2809        }
2810
2811        /**
2812         * @return The first repetition of repeating field {@link #organizationReference}, creating it if it does not already exist {3}
2813         */
2814        public Reference getOrganizationReferenceFirstRep() { 
2815          if (getOrganizationReference().isEmpty()) {
2816            addOrganizationReference();
2817          }
2818          return getOrganizationReference().get(0);
2819        }
2820
2821        protected void listChildren(List<Property> children) {
2822          super.listChildren(children);
2823          children.add(new Property("name", "string", "Distributor's human-readable name.", 0, 1, name));
2824          children.add(new Property("organizationReference", "Reference(Organization)", "Distributor as an Organization resource.", 0, java.lang.Integer.MAX_VALUE, organizationReference));
2825        }
2826
2827        @Override
2828        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2829          switch (_hash) {
2830          case 3373707: /*name*/  return new Property("name", "string", "Distributor's human-readable name.", 0, 1, name);
2831          case 1860475736: /*organizationReference*/  return new Property("organizationReference", "Reference(Organization)", "Distributor as an Organization resource.", 0, java.lang.Integer.MAX_VALUE, organizationReference);
2832          default: return super.getNamedProperty(_hash, _name, _checkValid);
2833          }
2834
2835        }
2836
2837      @Override
2838      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2839        switch (hash) {
2840        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2841        case 1860475736: /*organizationReference*/ return this.organizationReference == null ? new Base[0] : this.organizationReference.toArray(new Base[this.organizationReference.size()]); // Reference
2842        default: return super.getProperty(hash, name, checkValid);
2843        }
2844
2845      }
2846
2847      @Override
2848      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2849        switch (hash) {
2850        case 3373707: // name
2851          this.name = TypeConvertor.castToString(value); // StringType
2852          return value;
2853        case 1860475736: // organizationReference
2854          this.getOrganizationReference().add(TypeConvertor.castToReference(value)); // Reference
2855          return value;
2856        default: return super.setProperty(hash, name, value);
2857        }
2858
2859      }
2860
2861      @Override
2862      public Base setProperty(String name, Base value) throws FHIRException {
2863        if (name.equals("name")) {
2864          this.name = TypeConvertor.castToString(value); // StringType
2865        } else if (name.equals("organizationReference")) {
2866          this.getOrganizationReference().add(TypeConvertor.castToReference(value));
2867        } else
2868          return super.setProperty(name, value);
2869        return value;
2870      }
2871
2872      @Override
2873      public Base makeProperty(int hash, String name) throws FHIRException {
2874        switch (hash) {
2875        case 3373707:  return getNameElement();
2876        case 1860475736:  return addOrganizationReference(); 
2877        default: return super.makeProperty(hash, name);
2878        }
2879
2880      }
2881
2882      @Override
2883      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2884        switch (hash) {
2885        case 3373707: /*name*/ return new String[] {"string"};
2886        case 1860475736: /*organizationReference*/ return new String[] {"Reference"};
2887        default: return super.getTypesForProperty(hash, name);
2888        }
2889
2890      }
2891
2892      @Override
2893      public Base addChild(String name) throws FHIRException {
2894        if (name.equals("name")) {
2895          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.packaging.distributor.name");
2896        }
2897        else if (name.equals("organizationReference")) {
2898          return addOrganizationReference();
2899        }
2900        else
2901          return super.addChild(name);
2902      }
2903
2904      public DeviceDefinitionPackagingDistributorComponent copy() {
2905        DeviceDefinitionPackagingDistributorComponent dst = new DeviceDefinitionPackagingDistributorComponent();
2906        copyValues(dst);
2907        return dst;
2908      }
2909
2910      public void copyValues(DeviceDefinitionPackagingDistributorComponent dst) {
2911        super.copyValues(dst);
2912        dst.name = name == null ? null : name.copy();
2913        if (organizationReference != null) {
2914          dst.organizationReference = new ArrayList<Reference>();
2915          for (Reference i : organizationReference)
2916            dst.organizationReference.add(i.copy());
2917        };
2918      }
2919
2920      @Override
2921      public boolean equalsDeep(Base other_) {
2922        if (!super.equalsDeep(other_))
2923          return false;
2924        if (!(other_ instanceof DeviceDefinitionPackagingDistributorComponent))
2925          return false;
2926        DeviceDefinitionPackagingDistributorComponent o = (DeviceDefinitionPackagingDistributorComponent) other_;
2927        return compareDeep(name, o.name, true) && compareDeep(organizationReference, o.organizationReference, true)
2928          ;
2929      }
2930
2931      @Override
2932      public boolean equalsShallow(Base other_) {
2933        if (!super.equalsShallow(other_))
2934          return false;
2935        if (!(other_ instanceof DeviceDefinitionPackagingDistributorComponent))
2936          return false;
2937        DeviceDefinitionPackagingDistributorComponent o = (DeviceDefinitionPackagingDistributorComponent) other_;
2938        return compareValues(name, o.name, true);
2939      }
2940
2941      public boolean isEmpty() {
2942        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, organizationReference
2943          );
2944      }
2945
2946  public String fhirType() {
2947    return "DeviceDefinition.packaging.distributor";
2948
2949  }
2950
2951  }
2952
2953    @Block()
2954    public static class DeviceDefinitionVersionComponent extends BackboneElement implements IBaseBackboneElement {
2955        /**
2956         * The type of the device version, e.g. manufacturer, approved, internal.
2957         */
2958        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
2959        @Description(shortDefinition="The type of the device version, e.g. manufacturer, approved, internal", formalDefinition="The type of the device version, e.g. manufacturer, approved, internal." )
2960        protected CodeableConcept type;
2961
2962        /**
2963         * The hardware or software module of the device to which the version applies.
2964         */
2965        @Child(name = "component", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
2966        @Description(shortDefinition="The hardware or software module of the device to which the version applies", formalDefinition="The hardware or software module of the device to which the version applies." )
2967        protected Identifier component;
2968
2969        /**
2970         * The version text.
2971         */
2972        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
2973        @Description(shortDefinition="The version text", formalDefinition="The version text." )
2974        protected StringType value;
2975
2976        private static final long serialVersionUID = 645214295L;
2977
2978    /**
2979     * Constructor
2980     */
2981      public DeviceDefinitionVersionComponent() {
2982        super();
2983      }
2984
2985    /**
2986     * Constructor
2987     */
2988      public DeviceDefinitionVersionComponent(String value) {
2989        super();
2990        this.setValue(value);
2991      }
2992
2993        /**
2994         * @return {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
2995         */
2996        public CodeableConcept getType() { 
2997          if (this.type == null)
2998            if (Configuration.errorOnAutoCreate())
2999              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.type");
3000            else if (Configuration.doAutoCreate())
3001              this.type = new CodeableConcept(); // cc
3002          return this.type;
3003        }
3004
3005        public boolean hasType() { 
3006          return this.type != null && !this.type.isEmpty();
3007        }
3008
3009        /**
3010         * @param value {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
3011         */
3012        public DeviceDefinitionVersionComponent setType(CodeableConcept value) { 
3013          this.type = value;
3014          return this;
3015        }
3016
3017        /**
3018         * @return {@link #component} (The hardware or software module of the device to which the version applies.)
3019         */
3020        public Identifier getComponent() { 
3021          if (this.component == null)
3022            if (Configuration.errorOnAutoCreate())
3023              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.component");
3024            else if (Configuration.doAutoCreate())
3025              this.component = new Identifier(); // cc
3026          return this.component;
3027        }
3028
3029        public boolean hasComponent() { 
3030          return this.component != null && !this.component.isEmpty();
3031        }
3032
3033        /**
3034         * @param value {@link #component} (The hardware or software module of the device to which the version applies.)
3035         */
3036        public DeviceDefinitionVersionComponent setComponent(Identifier value) { 
3037          this.component = value;
3038          return this;
3039        }
3040
3041        /**
3042         * @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
3043         */
3044        public StringType getValueElement() { 
3045          if (this.value == null)
3046            if (Configuration.errorOnAutoCreate())
3047              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.value");
3048            else if (Configuration.doAutoCreate())
3049              this.value = new StringType(); // bb
3050          return this.value;
3051        }
3052
3053        public boolean hasValueElement() { 
3054          return this.value != null && !this.value.isEmpty();
3055        }
3056
3057        public boolean hasValue() { 
3058          return this.value != null && !this.value.isEmpty();
3059        }
3060
3061        /**
3062         * @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
3063         */
3064        public DeviceDefinitionVersionComponent setValueElement(StringType value) { 
3065          this.value = value;
3066          return this;
3067        }
3068
3069        /**
3070         * @return The version text.
3071         */
3072        public String getValue() { 
3073          return this.value == null ? null : this.value.getValue();
3074        }
3075
3076        /**
3077         * @param value The version text.
3078         */
3079        public DeviceDefinitionVersionComponent setValue(String value) { 
3080            if (this.value == null)
3081              this.value = new StringType();
3082            this.value.setValue(value);
3083          return this;
3084        }
3085
3086        protected void listChildren(List<Property> children) {
3087          super.listChildren(children);
3088          children.add(new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type));
3089          children.add(new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component));
3090          children.add(new Property("value", "string", "The version text.", 0, 1, value));
3091        }
3092
3093        @Override
3094        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3095          switch (_hash) {
3096          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type);
3097          case -1399907075: /*component*/  return new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component);
3098          case 111972721: /*value*/  return new Property("value", "string", "The version text.", 0, 1, value);
3099          default: return super.getNamedProperty(_hash, _name, _checkValid);
3100          }
3101
3102        }
3103
3104      @Override
3105      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3106        switch (hash) {
3107        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3108        case -1399907075: /*component*/ return this.component == null ? new Base[0] : new Base[] {this.component}; // Identifier
3109        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
3110        default: return super.getProperty(hash, name, checkValid);
3111        }
3112
3113      }
3114
3115      @Override
3116      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3117        switch (hash) {
3118        case 3575610: // type
3119          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3120          return value;
3121        case -1399907075: // component
3122          this.component = TypeConvertor.castToIdentifier(value); // Identifier
3123          return value;
3124        case 111972721: // value
3125          this.value = TypeConvertor.castToString(value); // StringType
3126          return value;
3127        default: return super.setProperty(hash, name, value);
3128        }
3129
3130      }
3131
3132      @Override
3133      public Base setProperty(String name, Base value) throws FHIRException {
3134        if (name.equals("type")) {
3135          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3136        } else if (name.equals("component")) {
3137          this.component = TypeConvertor.castToIdentifier(value); // Identifier
3138        } else if (name.equals("value")) {
3139          this.value = TypeConvertor.castToString(value); // StringType
3140        } else
3141          return super.setProperty(name, value);
3142        return value;
3143      }
3144
3145      @Override
3146      public Base makeProperty(int hash, String name) throws FHIRException {
3147        switch (hash) {
3148        case 3575610:  return getType();
3149        case -1399907075:  return getComponent();
3150        case 111972721:  return getValueElement();
3151        default: return super.makeProperty(hash, name);
3152        }
3153
3154      }
3155
3156      @Override
3157      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3158        switch (hash) {
3159        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3160        case -1399907075: /*component*/ return new String[] {"Identifier"};
3161        case 111972721: /*value*/ return new String[] {"string"};
3162        default: return super.getTypesForProperty(hash, name);
3163        }
3164
3165      }
3166
3167      @Override
3168      public Base addChild(String name) throws FHIRException {
3169        if (name.equals("type")) {
3170          this.type = new CodeableConcept();
3171          return this.type;
3172        }
3173        else if (name.equals("component")) {
3174          this.component = new Identifier();
3175          return this.component;
3176        }
3177        else if (name.equals("value")) {
3178          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.version.value");
3179        }
3180        else
3181          return super.addChild(name);
3182      }
3183
3184      public DeviceDefinitionVersionComponent copy() {
3185        DeviceDefinitionVersionComponent dst = new DeviceDefinitionVersionComponent();
3186        copyValues(dst);
3187        return dst;
3188      }
3189
3190      public void copyValues(DeviceDefinitionVersionComponent dst) {
3191        super.copyValues(dst);
3192        dst.type = type == null ? null : type.copy();
3193        dst.component = component == null ? null : component.copy();
3194        dst.value = value == null ? null : value.copy();
3195      }
3196
3197      @Override
3198      public boolean equalsDeep(Base other_) {
3199        if (!super.equalsDeep(other_))
3200          return false;
3201        if (!(other_ instanceof DeviceDefinitionVersionComponent))
3202          return false;
3203        DeviceDefinitionVersionComponent o = (DeviceDefinitionVersionComponent) other_;
3204        return compareDeep(type, o.type, true) && compareDeep(component, o.component, true) && compareDeep(value, o.value, true)
3205          ;
3206      }
3207
3208      @Override
3209      public boolean equalsShallow(Base other_) {
3210        if (!super.equalsShallow(other_))
3211          return false;
3212        if (!(other_ instanceof DeviceDefinitionVersionComponent))
3213          return false;
3214        DeviceDefinitionVersionComponent o = (DeviceDefinitionVersionComponent) other_;
3215        return compareValues(value, o.value, true);
3216      }
3217
3218      public boolean isEmpty() {
3219        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, component, value);
3220      }
3221
3222  public String fhirType() {
3223    return "DeviceDefinition.version";
3224
3225  }
3226
3227  }
3228
3229    @Block()
3230    public static class DeviceDefinitionPropertyComponent extends BackboneElement implements IBaseBackboneElement {
3231        /**
3232         * Code that specifies the property.
3233         */
3234        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
3235        @Description(shortDefinition="Code that specifies the property", formalDefinition="Code that specifies the property." )
3236        protected CodeableConcept type;
3237
3238        /**
3239         * Property value - the data type depends on the property type.
3240         */
3241        @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Range.class, Attachment.class}, order=2, min=1, max=1, modifier=false, summary=false)
3242        @Description(shortDefinition="Property value - as a code or quantity", formalDefinition="Property value - the data type depends on the property type." )
3243        protected DataType value;
3244
3245        private static final long serialVersionUID = -1659186716L;
3246
3247    /**
3248     * Constructor
3249     */
3250      public DeviceDefinitionPropertyComponent() {
3251        super();
3252      }
3253
3254    /**
3255     * Constructor
3256     */
3257      public DeviceDefinitionPropertyComponent(CodeableConcept type, DataType value) {
3258        super();
3259        this.setType(type);
3260        this.setValue(value);
3261      }
3262
3263        /**
3264         * @return {@link #type} (Code that specifies the property.)
3265         */
3266        public CodeableConcept getType() { 
3267          if (this.type == null)
3268            if (Configuration.errorOnAutoCreate())
3269              throw new Error("Attempt to auto-create DeviceDefinitionPropertyComponent.type");
3270            else if (Configuration.doAutoCreate())
3271              this.type = new CodeableConcept(); // cc
3272          return this.type;
3273        }
3274
3275        public boolean hasType() { 
3276          return this.type != null && !this.type.isEmpty();
3277        }
3278
3279        /**
3280         * @param value {@link #type} (Code that specifies the property.)
3281         */
3282        public DeviceDefinitionPropertyComponent setType(CodeableConcept value) { 
3283          this.type = value;
3284          return this;
3285        }
3286
3287        /**
3288         * @return {@link #value} (Property value - the data type depends on the property type.)
3289         */
3290        public DataType getValue() { 
3291          return this.value;
3292        }
3293
3294        /**
3295         * @return {@link #value} (Property value - the data type depends on the property type.)
3296         */
3297        public Quantity getValueQuantity() throws FHIRException { 
3298          if (this.value == null)
3299            this.value = new Quantity();
3300          if (!(this.value instanceof Quantity))
3301            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3302          return (Quantity) this.value;
3303        }
3304
3305        public boolean hasValueQuantity() { 
3306          return this != null && this.value instanceof Quantity;
3307        }
3308
3309        /**
3310         * @return {@link #value} (Property value - the data type depends on the property type.)
3311         */
3312        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
3313          if (this.value == null)
3314            this.value = new CodeableConcept();
3315          if (!(this.value instanceof CodeableConcept))
3316            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
3317          return (CodeableConcept) this.value;
3318        }
3319
3320        public boolean hasValueCodeableConcept() { 
3321          return this != null && this.value instanceof CodeableConcept;
3322        }
3323
3324        /**
3325         * @return {@link #value} (Property value - the data type depends on the property type.)
3326         */
3327        public StringType getValueStringType() throws FHIRException { 
3328          if (this.value == null)
3329            this.value = new StringType();
3330          if (!(this.value instanceof StringType))
3331            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3332          return (StringType) this.value;
3333        }
3334
3335        public boolean hasValueStringType() { 
3336          return this != null && this.value instanceof StringType;
3337        }
3338
3339        /**
3340         * @return {@link #value} (Property value - the data type depends on the property type.)
3341         */
3342        public BooleanType getValueBooleanType() throws FHIRException { 
3343          if (this.value == null)
3344            this.value = new BooleanType();
3345          if (!(this.value instanceof BooleanType))
3346            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3347          return (BooleanType) this.value;
3348        }
3349
3350        public boolean hasValueBooleanType() { 
3351          return this != null && this.value instanceof BooleanType;
3352        }
3353
3354        /**
3355         * @return {@link #value} (Property value - the data type depends on the property type.)
3356         */
3357        public IntegerType getValueIntegerType() throws FHIRException { 
3358          if (this.value == null)
3359            this.value = new IntegerType();
3360          if (!(this.value instanceof IntegerType))
3361            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3362          return (IntegerType) this.value;
3363        }
3364
3365        public boolean hasValueIntegerType() { 
3366          return this != null && this.value instanceof IntegerType;
3367        }
3368
3369        /**
3370         * @return {@link #value} (Property value - the data type depends on the property type.)
3371         */
3372        public Range getValueRange() throws FHIRException { 
3373          if (this.value == null)
3374            this.value = new Range();
3375          if (!(this.value instanceof Range))
3376            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
3377          return (Range) this.value;
3378        }
3379
3380        public boolean hasValueRange() { 
3381          return this != null && this.value instanceof Range;
3382        }
3383
3384        /**
3385         * @return {@link #value} (Property value - the data type depends on the property type.)
3386         */
3387        public Attachment getValueAttachment() throws FHIRException { 
3388          if (this.value == null)
3389            this.value = new Attachment();
3390          if (!(this.value instanceof Attachment))
3391            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3392          return (Attachment) this.value;
3393        }
3394
3395        public boolean hasValueAttachment() { 
3396          return this != null && this.value instanceof Attachment;
3397        }
3398
3399        public boolean hasValue() { 
3400          return this.value != null && !this.value.isEmpty();
3401        }
3402
3403        /**
3404         * @param value {@link #value} (Property value - the data type depends on the property type.)
3405         */
3406        public DeviceDefinitionPropertyComponent setValue(DataType value) { 
3407          if (value != null && !(value instanceof Quantity || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Range || value instanceof Attachment))
3408            throw new Error("Not the right type for DeviceDefinition.property.value[x]: "+value.fhirType());
3409          this.value = value;
3410          return this;
3411        }
3412
3413        protected void listChildren(List<Property> children) {
3414          super.listChildren(children);
3415          children.add(new Property("type", "CodeableConcept", "Code that specifies the property.", 0, 1, type));
3416          children.add(new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - the data type depends on the property type.", 0, 1, value));
3417        }
3418
3419        @Override
3420        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3421          switch (_hash) {
3422          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property.", 0, 1, type);
3423          case -1410166417: /*value[x]*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - the data type depends on the property type.", 0, 1, value);
3424          case 111972721: /*value*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "Property value - the data type depends on the property type.", 0, 1, value);
3425          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "Property value - the data type depends on the property type.", 0, 1, value);
3426          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "Property value - the data type depends on the property type.", 0, 1, value);
3427          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "Property value - the data type depends on the property type.", 0, 1, value);
3428          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "Property value - the data type depends on the property type.", 0, 1, value);
3429          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "Property value - the data type depends on the property type.", 0, 1, value);
3430          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "Property value - the data type depends on the property type.", 0, 1, value);
3431          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "Property value - the data type depends on the property type.", 0, 1, value);
3432          default: return super.getNamedProperty(_hash, _name, _checkValid);
3433          }
3434
3435        }
3436
3437      @Override
3438      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3439        switch (hash) {
3440        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3441        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3442        default: return super.getProperty(hash, name, checkValid);
3443        }
3444
3445      }
3446
3447      @Override
3448      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3449        switch (hash) {
3450        case 3575610: // type
3451          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3452          return value;
3453        case 111972721: // value
3454          this.value = TypeConvertor.castToType(value); // DataType
3455          return value;
3456        default: return super.setProperty(hash, name, value);
3457        }
3458
3459      }
3460
3461      @Override
3462      public Base setProperty(String name, Base value) throws FHIRException {
3463        if (name.equals("type")) {
3464          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3465        } else if (name.equals("value[x]")) {
3466          this.value = TypeConvertor.castToType(value); // DataType
3467        } else
3468          return super.setProperty(name, value);
3469        return value;
3470      }
3471
3472      @Override
3473      public Base makeProperty(int hash, String name) throws FHIRException {
3474        switch (hash) {
3475        case 3575610:  return getType();
3476        case -1410166417:  return getValue();
3477        case 111972721:  return getValue();
3478        default: return super.makeProperty(hash, name);
3479        }
3480
3481      }
3482
3483      @Override
3484      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3485        switch (hash) {
3486        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3487        case 111972721: /*value*/ return new String[] {"Quantity", "CodeableConcept", "string", "boolean", "integer", "Range", "Attachment"};
3488        default: return super.getTypesForProperty(hash, name);
3489        }
3490
3491      }
3492
3493      @Override
3494      public Base addChild(String name) throws FHIRException {
3495        if (name.equals("type")) {
3496          this.type = new CodeableConcept();
3497          return this.type;
3498        }
3499        else if (name.equals("valueQuantity")) {
3500          this.value = new Quantity();
3501          return this.value;
3502        }
3503        else if (name.equals("valueCodeableConcept")) {
3504          this.value = new CodeableConcept();
3505          return this.value;
3506        }
3507        else if (name.equals("valueString")) {
3508          this.value = new StringType();
3509          return this.value;
3510        }
3511        else if (name.equals("valueBoolean")) {
3512          this.value = new BooleanType();
3513          return this.value;
3514        }
3515        else if (name.equals("valueInteger")) {
3516          this.value = new IntegerType();
3517          return this.value;
3518        }
3519        else if (name.equals("valueRange")) {
3520          this.value = new Range();
3521          return this.value;
3522        }
3523        else if (name.equals("valueAttachment")) {
3524          this.value = new Attachment();
3525          return this.value;
3526        }
3527        else
3528          return super.addChild(name);
3529      }
3530
3531      public DeviceDefinitionPropertyComponent copy() {
3532        DeviceDefinitionPropertyComponent dst = new DeviceDefinitionPropertyComponent();
3533        copyValues(dst);
3534        return dst;
3535      }
3536
3537      public void copyValues(DeviceDefinitionPropertyComponent dst) {
3538        super.copyValues(dst);
3539        dst.type = type == null ? null : type.copy();
3540        dst.value = value == null ? null : value.copy();
3541      }
3542
3543      @Override
3544      public boolean equalsDeep(Base other_) {
3545        if (!super.equalsDeep(other_))
3546          return false;
3547        if (!(other_ instanceof DeviceDefinitionPropertyComponent))
3548          return false;
3549        DeviceDefinitionPropertyComponent o = (DeviceDefinitionPropertyComponent) other_;
3550        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
3551      }
3552
3553      @Override
3554      public boolean equalsShallow(Base other_) {
3555        if (!super.equalsShallow(other_))
3556          return false;
3557        if (!(other_ instanceof DeviceDefinitionPropertyComponent))
3558          return false;
3559        DeviceDefinitionPropertyComponent o = (DeviceDefinitionPropertyComponent) other_;
3560        return true;
3561      }
3562
3563      public boolean isEmpty() {
3564        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
3565      }
3566
3567  public String fhirType() {
3568    return "DeviceDefinition.property";
3569
3570  }
3571
3572  }
3573
3574    @Block()
3575    public static class DeviceDefinitionLinkComponent extends BackboneElement implements IBaseBackboneElement {
3576        /**
3577         * The type indicates the relationship of the related device to the device instance.
3578         */
3579        @Child(name = "relation", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
3580        @Description(shortDefinition="The type indicates the relationship of the related device to the device instance", formalDefinition="The type indicates the relationship of the related device to the device instance." )
3581        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedefinition-relationtype")
3582        protected Coding relation;
3583
3584        /**
3585         * A reference to the linked device.
3586         */
3587        @Child(name = "relatedDevice", type = {CodeableReference.class}, order=2, min=1, max=1, modifier=false, summary=false)
3588        @Description(shortDefinition="A reference to the linked device", formalDefinition="A reference to the linked device." )
3589        protected CodeableReference relatedDevice;
3590
3591        private static final long serialVersionUID = 627614461L;
3592
3593    /**
3594     * Constructor
3595     */
3596      public DeviceDefinitionLinkComponent() {
3597        super();
3598      }
3599
3600    /**
3601     * Constructor
3602     */
3603      public DeviceDefinitionLinkComponent(Coding relation, CodeableReference relatedDevice) {
3604        super();
3605        this.setRelation(relation);
3606        this.setRelatedDevice(relatedDevice);
3607      }
3608
3609        /**
3610         * @return {@link #relation} (The type indicates the relationship of the related device to the device instance.)
3611         */
3612        public Coding getRelation() { 
3613          if (this.relation == null)
3614            if (Configuration.errorOnAutoCreate())
3615              throw new Error("Attempt to auto-create DeviceDefinitionLinkComponent.relation");
3616            else if (Configuration.doAutoCreate())
3617              this.relation = new Coding(); // cc
3618          return this.relation;
3619        }
3620
3621        public boolean hasRelation() { 
3622          return this.relation != null && !this.relation.isEmpty();
3623        }
3624
3625        /**
3626         * @param value {@link #relation} (The type indicates the relationship of the related device to the device instance.)
3627         */
3628        public DeviceDefinitionLinkComponent setRelation(Coding value) { 
3629          this.relation = value;
3630          return this;
3631        }
3632
3633        /**
3634         * @return {@link #relatedDevice} (A reference to the linked device.)
3635         */
3636        public CodeableReference getRelatedDevice() { 
3637          if (this.relatedDevice == null)
3638            if (Configuration.errorOnAutoCreate())
3639              throw new Error("Attempt to auto-create DeviceDefinitionLinkComponent.relatedDevice");
3640            else if (Configuration.doAutoCreate())
3641              this.relatedDevice = new CodeableReference(); // cc
3642          return this.relatedDevice;
3643        }
3644
3645        public boolean hasRelatedDevice() { 
3646          return this.relatedDevice != null && !this.relatedDevice.isEmpty();
3647        }
3648
3649        /**
3650         * @param value {@link #relatedDevice} (A reference to the linked device.)
3651         */
3652        public DeviceDefinitionLinkComponent setRelatedDevice(CodeableReference value) { 
3653          this.relatedDevice = value;
3654          return this;
3655        }
3656
3657        protected void listChildren(List<Property> children) {
3658          super.listChildren(children);
3659          children.add(new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation));
3660          children.add(new Property("relatedDevice", "CodeableReference(DeviceDefinition)", "A reference to the linked device.", 0, 1, relatedDevice));
3661        }
3662
3663        @Override
3664        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3665          switch (_hash) {
3666          case -554436100: /*relation*/  return new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation);
3667          case -296314271: /*relatedDevice*/  return new Property("relatedDevice", "CodeableReference(DeviceDefinition)", "A reference to the linked device.", 0, 1, relatedDevice);
3668          default: return super.getNamedProperty(_hash, _name, _checkValid);
3669          }
3670
3671        }
3672
3673      @Override
3674      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3675        switch (hash) {
3676        case -554436100: /*relation*/ return this.relation == null ? new Base[0] : new Base[] {this.relation}; // Coding
3677        case -296314271: /*relatedDevice*/ return this.relatedDevice == null ? new Base[0] : new Base[] {this.relatedDevice}; // CodeableReference
3678        default: return super.getProperty(hash, name, checkValid);
3679        }
3680
3681      }
3682
3683      @Override
3684      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3685        switch (hash) {
3686        case -554436100: // relation
3687          this.relation = TypeConvertor.castToCoding(value); // Coding
3688          return value;
3689        case -296314271: // relatedDevice
3690          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
3691          return value;
3692        default: return super.setProperty(hash, name, value);
3693        }
3694
3695      }
3696
3697      @Override
3698      public Base setProperty(String name, Base value) throws FHIRException {
3699        if (name.equals("relation")) {
3700          this.relation = TypeConvertor.castToCoding(value); // Coding
3701        } else if (name.equals("relatedDevice")) {
3702          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
3703        } else
3704          return super.setProperty(name, value);
3705        return value;
3706      }
3707
3708      @Override
3709      public Base makeProperty(int hash, String name) throws FHIRException {
3710        switch (hash) {
3711        case -554436100:  return getRelation();
3712        case -296314271:  return getRelatedDevice();
3713        default: return super.makeProperty(hash, name);
3714        }
3715
3716      }
3717
3718      @Override
3719      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3720        switch (hash) {
3721        case -554436100: /*relation*/ return new String[] {"Coding"};
3722        case -296314271: /*relatedDevice*/ return new String[] {"CodeableReference"};
3723        default: return super.getTypesForProperty(hash, name);
3724        }
3725
3726      }
3727
3728      @Override
3729      public Base addChild(String name) throws FHIRException {
3730        if (name.equals("relation")) {
3731          this.relation = new Coding();
3732          return this.relation;
3733        }
3734        else if (name.equals("relatedDevice")) {
3735          this.relatedDevice = new CodeableReference();
3736          return this.relatedDevice;
3737        }
3738        else
3739          return super.addChild(name);
3740      }
3741
3742      public DeviceDefinitionLinkComponent copy() {
3743        DeviceDefinitionLinkComponent dst = new DeviceDefinitionLinkComponent();
3744        copyValues(dst);
3745        return dst;
3746      }
3747
3748      public void copyValues(DeviceDefinitionLinkComponent dst) {
3749        super.copyValues(dst);
3750        dst.relation = relation == null ? null : relation.copy();
3751        dst.relatedDevice = relatedDevice == null ? null : relatedDevice.copy();
3752      }
3753
3754      @Override
3755      public boolean equalsDeep(Base other_) {
3756        if (!super.equalsDeep(other_))
3757          return false;
3758        if (!(other_ instanceof DeviceDefinitionLinkComponent))
3759          return false;
3760        DeviceDefinitionLinkComponent o = (DeviceDefinitionLinkComponent) other_;
3761        return compareDeep(relation, o.relation, true) && compareDeep(relatedDevice, o.relatedDevice, true)
3762          ;
3763      }
3764
3765      @Override
3766      public boolean equalsShallow(Base other_) {
3767        if (!super.equalsShallow(other_))
3768          return false;
3769        if (!(other_ instanceof DeviceDefinitionLinkComponent))
3770          return false;
3771        DeviceDefinitionLinkComponent o = (DeviceDefinitionLinkComponent) other_;
3772        return true;
3773      }
3774
3775      public boolean isEmpty() {
3776        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relation, relatedDevice);
3777      }
3778
3779  public String fhirType() {
3780    return "DeviceDefinition.link";
3781
3782  }
3783
3784  }
3785
3786    @Block()
3787    public static class DeviceDefinitionMaterialComponent extends BackboneElement implements IBaseBackboneElement {
3788        /**
3789         * A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.
3790         */
3791        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
3792        @Description(shortDefinition="A relevant substance that the device contains, may contain, or is made of", formalDefinition="A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials." )
3793        protected CodeableConcept substance;
3794
3795        /**
3796         * Indicates an alternative material of the device.
3797         */
3798        @Child(name = "alternate", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
3799        @Description(shortDefinition="Indicates an alternative material of the device", formalDefinition="Indicates an alternative material of the device." )
3800        protected BooleanType alternate;
3801
3802        /**
3803         * Whether the substance is a known or suspected allergen.
3804         */
3805        @Child(name = "allergenicIndicator", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3806        @Description(shortDefinition="Whether the substance is a known or suspected allergen", formalDefinition="Whether the substance is a known or suspected allergen." )
3807        protected BooleanType allergenicIndicator;
3808
3809        private static final long serialVersionUID = 1232736508L;
3810
3811    /**
3812     * Constructor
3813     */
3814      public DeviceDefinitionMaterialComponent() {
3815        super();
3816      }
3817
3818    /**
3819     * Constructor
3820     */
3821      public DeviceDefinitionMaterialComponent(CodeableConcept substance) {
3822        super();
3823        this.setSubstance(substance);
3824      }
3825
3826        /**
3827         * @return {@link #substance} (A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.)
3828         */
3829        public CodeableConcept getSubstance() { 
3830          if (this.substance == null)
3831            if (Configuration.errorOnAutoCreate())
3832              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.substance");
3833            else if (Configuration.doAutoCreate())
3834              this.substance = new CodeableConcept(); // cc
3835          return this.substance;
3836        }
3837
3838        public boolean hasSubstance() { 
3839          return this.substance != null && !this.substance.isEmpty();
3840        }
3841
3842        /**
3843         * @param value {@link #substance} (A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.)
3844         */
3845        public DeviceDefinitionMaterialComponent setSubstance(CodeableConcept value) { 
3846          this.substance = value;
3847          return this;
3848        }
3849
3850        /**
3851         * @return {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
3852         */
3853        public BooleanType getAlternateElement() { 
3854          if (this.alternate == null)
3855            if (Configuration.errorOnAutoCreate())
3856              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.alternate");
3857            else if (Configuration.doAutoCreate())
3858              this.alternate = new BooleanType(); // bb
3859          return this.alternate;
3860        }
3861
3862        public boolean hasAlternateElement() { 
3863          return this.alternate != null && !this.alternate.isEmpty();
3864        }
3865
3866        public boolean hasAlternate() { 
3867          return this.alternate != null && !this.alternate.isEmpty();
3868        }
3869
3870        /**
3871         * @param value {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
3872         */
3873        public DeviceDefinitionMaterialComponent setAlternateElement(BooleanType value) { 
3874          this.alternate = value;
3875          return this;
3876        }
3877
3878        /**
3879         * @return Indicates an alternative material of the device.
3880         */
3881        public boolean getAlternate() { 
3882          return this.alternate == null || this.alternate.isEmpty() ? false : this.alternate.getValue();
3883        }
3884
3885        /**
3886         * @param value Indicates an alternative material of the device.
3887         */
3888        public DeviceDefinitionMaterialComponent setAlternate(boolean value) { 
3889            if (this.alternate == null)
3890              this.alternate = new BooleanType();
3891            this.alternate.setValue(value);
3892          return this;
3893        }
3894
3895        /**
3896         * @return {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
3897         */
3898        public BooleanType getAllergenicIndicatorElement() { 
3899          if (this.allergenicIndicator == null)
3900            if (Configuration.errorOnAutoCreate())
3901              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.allergenicIndicator");
3902            else if (Configuration.doAutoCreate())
3903              this.allergenicIndicator = new BooleanType(); // bb
3904          return this.allergenicIndicator;
3905        }
3906
3907        public boolean hasAllergenicIndicatorElement() { 
3908          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
3909        }
3910
3911        public boolean hasAllergenicIndicator() { 
3912          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
3913        }
3914
3915        /**
3916         * @param value {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
3917         */
3918        public DeviceDefinitionMaterialComponent setAllergenicIndicatorElement(BooleanType value) { 
3919          this.allergenicIndicator = value;
3920          return this;
3921        }
3922
3923        /**
3924         * @return Whether the substance is a known or suspected allergen.
3925         */
3926        public boolean getAllergenicIndicator() { 
3927          return this.allergenicIndicator == null || this.allergenicIndicator.isEmpty() ? false : this.allergenicIndicator.getValue();
3928        }
3929
3930        /**
3931         * @param value Whether the substance is a known or suspected allergen.
3932         */
3933        public DeviceDefinitionMaterialComponent setAllergenicIndicator(boolean value) { 
3934            if (this.allergenicIndicator == null)
3935              this.allergenicIndicator = new BooleanType();
3936            this.allergenicIndicator.setValue(value);
3937          return this;
3938        }
3939
3940        protected void listChildren(List<Property> children) {
3941          super.listChildren(children);
3942          children.add(new Property("substance", "CodeableConcept", "A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.", 0, 1, substance));
3943          children.add(new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate));
3944          children.add(new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator));
3945        }
3946
3947        @Override
3948        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3949          switch (_hash) {
3950          case 530040176: /*substance*/  return new Property("substance", "CodeableConcept", "A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.", 0, 1, substance);
3951          case -1408024454: /*alternate*/  return new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate);
3952          case 75406931: /*allergenicIndicator*/  return new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator);
3953          default: return super.getNamedProperty(_hash, _name, _checkValid);
3954          }
3955
3956        }
3957
3958      @Override
3959      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3960        switch (hash) {
3961        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
3962        case -1408024454: /*alternate*/ return this.alternate == null ? new Base[0] : new Base[] {this.alternate}; // BooleanType
3963        case 75406931: /*allergenicIndicator*/ return this.allergenicIndicator == null ? new Base[0] : new Base[] {this.allergenicIndicator}; // BooleanType
3964        default: return super.getProperty(hash, name, checkValid);
3965        }
3966
3967      }
3968
3969      @Override
3970      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3971        switch (hash) {
3972        case 530040176: // substance
3973          this.substance = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3974          return value;
3975        case -1408024454: // alternate
3976          this.alternate = TypeConvertor.castToBoolean(value); // BooleanType
3977          return value;
3978        case 75406931: // allergenicIndicator
3979          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
3980          return value;
3981        default: return super.setProperty(hash, name, value);
3982        }
3983
3984      }
3985
3986      @Override
3987      public Base setProperty(String name, Base value) throws FHIRException {
3988        if (name.equals("substance")) {
3989          this.substance = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3990        } else if (name.equals("alternate")) {
3991          this.alternate = TypeConvertor.castToBoolean(value); // BooleanType
3992        } else if (name.equals("allergenicIndicator")) {
3993          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
3994        } else
3995          return super.setProperty(name, value);
3996        return value;
3997      }
3998
3999      @Override
4000      public Base makeProperty(int hash, String name) throws FHIRException {
4001        switch (hash) {
4002        case 530040176:  return getSubstance();
4003        case -1408024454:  return getAlternateElement();
4004        case 75406931:  return getAllergenicIndicatorElement();
4005        default: return super.makeProperty(hash, name);
4006        }
4007
4008      }
4009
4010      @Override
4011      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4012        switch (hash) {
4013        case 530040176: /*substance*/ return new String[] {"CodeableConcept"};
4014        case -1408024454: /*alternate*/ return new String[] {"boolean"};
4015        case 75406931: /*allergenicIndicator*/ return new String[] {"boolean"};
4016        default: return super.getTypesForProperty(hash, name);
4017        }
4018
4019      }
4020
4021      @Override
4022      public Base addChild(String name) throws FHIRException {
4023        if (name.equals("substance")) {
4024          this.substance = new CodeableConcept();
4025          return this.substance;
4026        }
4027        else if (name.equals("alternate")) {
4028          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.material.alternate");
4029        }
4030        else if (name.equals("allergenicIndicator")) {
4031          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.material.allergenicIndicator");
4032        }
4033        else
4034          return super.addChild(name);
4035      }
4036
4037      public DeviceDefinitionMaterialComponent copy() {
4038        DeviceDefinitionMaterialComponent dst = new DeviceDefinitionMaterialComponent();
4039        copyValues(dst);
4040        return dst;
4041      }
4042
4043      public void copyValues(DeviceDefinitionMaterialComponent dst) {
4044        super.copyValues(dst);
4045        dst.substance = substance == null ? null : substance.copy();
4046        dst.alternate = alternate == null ? null : alternate.copy();
4047        dst.allergenicIndicator = allergenicIndicator == null ? null : allergenicIndicator.copy();
4048      }
4049
4050      @Override
4051      public boolean equalsDeep(Base other_) {
4052        if (!super.equalsDeep(other_))
4053          return false;
4054        if (!(other_ instanceof DeviceDefinitionMaterialComponent))
4055          return false;
4056        DeviceDefinitionMaterialComponent o = (DeviceDefinitionMaterialComponent) other_;
4057        return compareDeep(substance, o.substance, true) && compareDeep(alternate, o.alternate, true) && compareDeep(allergenicIndicator, o.allergenicIndicator, true)
4058          ;
4059      }
4060
4061      @Override
4062      public boolean equalsShallow(Base other_) {
4063        if (!super.equalsShallow(other_))
4064          return false;
4065        if (!(other_ instanceof DeviceDefinitionMaterialComponent))
4066          return false;
4067        DeviceDefinitionMaterialComponent o = (DeviceDefinitionMaterialComponent) other_;
4068        return compareValues(alternate, o.alternate, true) && compareValues(allergenicIndicator, o.allergenicIndicator, true)
4069          ;
4070      }
4071
4072      public boolean isEmpty() {
4073        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, alternate, allergenicIndicator
4074          );
4075      }
4076
4077  public String fhirType() {
4078    return "DeviceDefinition.material";
4079
4080  }
4081
4082  }
4083
4084    @Block()
4085    public static class DeviceDefinitionGuidelineComponent extends BackboneElement implements IBaseBackboneElement {
4086        /**
4087         * The circumstances that form the setting for using the device.
4088         */
4089        @Child(name = "useContext", type = {UsageContext.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4090        @Description(shortDefinition="The circumstances that form the setting for using the device", formalDefinition="The circumstances that form the setting for using the device." )
4091        protected List<UsageContext> useContext;
4092
4093        /**
4094         * Detailed written and visual directions for the user on how to use the device.
4095         */
4096        @Child(name = "usageInstruction", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
4097        @Description(shortDefinition="Detailed written and visual directions for the user on how to use the device", formalDefinition="Detailed written and visual directions for the user on how to use the device." )
4098        protected MarkdownType usageInstruction;
4099
4100        /**
4101         * A source of information or reference for this guideline.
4102         */
4103        @Child(name = "relatedArtifact", type = {RelatedArtifact.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4104        @Description(shortDefinition="A source of information or reference for this guideline", formalDefinition="A source of information or reference for this guideline." )
4105        protected List<RelatedArtifact> relatedArtifact;
4106
4107        /**
4108         * A clinical condition for which the device was designed to be used.
4109         */
4110        @Child(name = "indication", type = {CodeableReference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4111        @Description(shortDefinition="A clinical condition for which the device was designed to be used", formalDefinition="A clinical condition for which the device was designed to be used." )
4112        protected List<CodeableReference> indication;
4113
4114        /**
4115         * A specific situation when a device should not be used because it may cause harm.
4116         */
4117        @Child(name = "contraindication", type = {CodeableReference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4118        @Description(shortDefinition="A specific situation when a device should not be used because it may cause harm", formalDefinition="A specific situation when a device should not be used because it may cause harm." )
4119        protected List<CodeableReference> contraindication;
4120
4121        /**
4122         * Specific hazard alert information that a user needs to know before using the device.
4123         */
4124        @Child(name = "warning", type = {CodeableReference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4125        @Description(shortDefinition="Specific hazard alert information that a user needs to know before using the device", formalDefinition="Specific hazard alert information that a user needs to know before using the device." )
4126        protected List<CodeableReference> warning;
4127
4128        /**
4129         * A description of the general purpose or medical use of the device or its function.
4130         */
4131        @Child(name = "intendedUse", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
4132        @Description(shortDefinition="A description of the general purpose or medical use of the device or its function", formalDefinition="A description of the general purpose or medical use of the device or its function." )
4133        protected StringType intendedUse;
4134
4135        private static final long serialVersionUID = -591777054L;
4136
4137    /**
4138     * Constructor
4139     */
4140      public DeviceDefinitionGuidelineComponent() {
4141        super();
4142      }
4143
4144        /**
4145         * @return {@link #useContext} (The circumstances that form the setting for using the device.)
4146         */
4147        public List<UsageContext> getUseContext() { 
4148          if (this.useContext == null)
4149            this.useContext = new ArrayList<UsageContext>();
4150          return this.useContext;
4151        }
4152
4153        /**
4154         * @return Returns a reference to <code>this</code> for easy method chaining
4155         */
4156        public DeviceDefinitionGuidelineComponent setUseContext(List<UsageContext> theUseContext) { 
4157          this.useContext = theUseContext;
4158          return this;
4159        }
4160
4161        public boolean hasUseContext() { 
4162          if (this.useContext == null)
4163            return false;
4164          for (UsageContext item : this.useContext)
4165            if (!item.isEmpty())
4166              return true;
4167          return false;
4168        }
4169
4170        public UsageContext addUseContext() { //3
4171          UsageContext t = new UsageContext();
4172          if (this.useContext == null)
4173            this.useContext = new ArrayList<UsageContext>();
4174          this.useContext.add(t);
4175          return t;
4176        }
4177
4178        public DeviceDefinitionGuidelineComponent addUseContext(UsageContext t) { //3
4179          if (t == null)
4180            return this;
4181          if (this.useContext == null)
4182            this.useContext = new ArrayList<UsageContext>();
4183          this.useContext.add(t);
4184          return this;
4185        }
4186
4187        /**
4188         * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
4189         */
4190        public UsageContext getUseContextFirstRep() { 
4191          if (getUseContext().isEmpty()) {
4192            addUseContext();
4193          }
4194          return getUseContext().get(0);
4195        }
4196
4197        /**
4198         * @return {@link #usageInstruction} (Detailed written and visual directions for the user on how to use the device.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value
4199         */
4200        public MarkdownType getUsageInstructionElement() { 
4201          if (this.usageInstruction == null)
4202            if (Configuration.errorOnAutoCreate())
4203              throw new Error("Attempt to auto-create DeviceDefinitionGuidelineComponent.usageInstruction");
4204            else if (Configuration.doAutoCreate())
4205              this.usageInstruction = new MarkdownType(); // bb
4206          return this.usageInstruction;
4207        }
4208
4209        public boolean hasUsageInstructionElement() { 
4210          return this.usageInstruction != null && !this.usageInstruction.isEmpty();
4211        }
4212
4213        public boolean hasUsageInstruction() { 
4214          return this.usageInstruction != null && !this.usageInstruction.isEmpty();
4215        }
4216
4217        /**
4218         * @param value {@link #usageInstruction} (Detailed written and visual directions for the user on how to use the device.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value
4219         */
4220        public DeviceDefinitionGuidelineComponent setUsageInstructionElement(MarkdownType value) { 
4221          this.usageInstruction = value;
4222          return this;
4223        }
4224
4225        /**
4226         * @return Detailed written and visual directions for the user on how to use the device.
4227         */
4228        public String getUsageInstruction() { 
4229          return this.usageInstruction == null ? null : this.usageInstruction.getValue();
4230        }
4231
4232        /**
4233         * @param value Detailed written and visual directions for the user on how to use the device.
4234         */
4235        public DeviceDefinitionGuidelineComponent setUsageInstruction(String value) { 
4236          if (value == null)
4237            this.usageInstruction = null;
4238          else {
4239            if (this.usageInstruction == null)
4240              this.usageInstruction = new MarkdownType();
4241            this.usageInstruction.setValue(value);
4242          }
4243          return this;
4244        }
4245
4246        /**
4247         * @return {@link #relatedArtifact} (A source of information or reference for this guideline.)
4248         */
4249        public List<RelatedArtifact> getRelatedArtifact() { 
4250          if (this.relatedArtifact == null)
4251            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4252          return this.relatedArtifact;
4253        }
4254
4255        /**
4256         * @return Returns a reference to <code>this</code> for easy method chaining
4257         */
4258        public DeviceDefinitionGuidelineComponent setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
4259          this.relatedArtifact = theRelatedArtifact;
4260          return this;
4261        }
4262
4263        public boolean hasRelatedArtifact() { 
4264          if (this.relatedArtifact == null)
4265            return false;
4266          for (RelatedArtifact item : this.relatedArtifact)
4267            if (!item.isEmpty())
4268              return true;
4269          return false;
4270        }
4271
4272        public RelatedArtifact addRelatedArtifact() { //3
4273          RelatedArtifact t = new RelatedArtifact();
4274          if (this.relatedArtifact == null)
4275            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4276          this.relatedArtifact.add(t);
4277          return t;
4278        }
4279
4280        public DeviceDefinitionGuidelineComponent addRelatedArtifact(RelatedArtifact t) { //3
4281          if (t == null)
4282            return this;
4283          if (this.relatedArtifact == null)
4284            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4285          this.relatedArtifact.add(t);
4286          return this;
4287        }
4288
4289        /**
4290         * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist {3}
4291         */
4292        public RelatedArtifact getRelatedArtifactFirstRep() { 
4293          if (getRelatedArtifact().isEmpty()) {
4294            addRelatedArtifact();
4295          }
4296          return getRelatedArtifact().get(0);
4297        }
4298
4299        /**
4300         * @return {@link #indication} (A clinical condition for which the device was designed to be used.)
4301         */
4302        public List<CodeableReference> getIndication() { 
4303          if (this.indication == null)
4304            this.indication = new ArrayList<CodeableReference>();
4305          return this.indication;
4306        }
4307
4308        /**
4309         * @return Returns a reference to <code>this</code> for easy method chaining
4310         */
4311        public DeviceDefinitionGuidelineComponent setIndication(List<CodeableReference> theIndication) { 
4312          this.indication = theIndication;
4313          return this;
4314        }
4315
4316        public boolean hasIndication() { 
4317          if (this.indication == null)
4318            return false;
4319          for (CodeableReference item : this.indication)
4320            if (!item.isEmpty())
4321              return true;
4322          return false;
4323        }
4324
4325        public CodeableReference addIndication() { //3
4326          CodeableReference t = new CodeableReference();
4327          if (this.indication == null)
4328            this.indication = new ArrayList<CodeableReference>();
4329          this.indication.add(t);
4330          return t;
4331        }
4332
4333        public DeviceDefinitionGuidelineComponent addIndication(CodeableReference t) { //3
4334          if (t == null)
4335            return this;
4336          if (this.indication == null)
4337            this.indication = new ArrayList<CodeableReference>();
4338          this.indication.add(t);
4339          return this;
4340        }
4341
4342        /**
4343         * @return The first repetition of repeating field {@link #indication}, creating it if it does not already exist {3}
4344         */
4345        public CodeableReference getIndicationFirstRep() { 
4346          if (getIndication().isEmpty()) {
4347            addIndication();
4348          }
4349          return getIndication().get(0);
4350        }
4351
4352        /**
4353         * @return {@link #contraindication} (A specific situation when a device should not be used because it may cause harm.)
4354         */
4355        public List<CodeableReference> getContraindication() { 
4356          if (this.contraindication == null)
4357            this.contraindication = new ArrayList<CodeableReference>();
4358          return this.contraindication;
4359        }
4360
4361        /**
4362         * @return Returns a reference to <code>this</code> for easy method chaining
4363         */
4364        public DeviceDefinitionGuidelineComponent setContraindication(List<CodeableReference> theContraindication) { 
4365          this.contraindication = theContraindication;
4366          return this;
4367        }
4368
4369        public boolean hasContraindication() { 
4370          if (this.contraindication == null)
4371            return false;
4372          for (CodeableReference item : this.contraindication)
4373            if (!item.isEmpty())
4374              return true;
4375          return false;
4376        }
4377
4378        public CodeableReference addContraindication() { //3
4379          CodeableReference t = new CodeableReference();
4380          if (this.contraindication == null)
4381            this.contraindication = new ArrayList<CodeableReference>();
4382          this.contraindication.add(t);
4383          return t;
4384        }
4385
4386        public DeviceDefinitionGuidelineComponent addContraindication(CodeableReference t) { //3
4387          if (t == null)
4388            return this;
4389          if (this.contraindication == null)
4390            this.contraindication = new ArrayList<CodeableReference>();
4391          this.contraindication.add(t);
4392          return this;
4393        }
4394
4395        /**
4396         * @return The first repetition of repeating field {@link #contraindication}, creating it if it does not already exist {3}
4397         */
4398        public CodeableReference getContraindicationFirstRep() { 
4399          if (getContraindication().isEmpty()) {
4400            addContraindication();
4401          }
4402          return getContraindication().get(0);
4403        }
4404
4405        /**
4406         * @return {@link #warning} (Specific hazard alert information that a user needs to know before using the device.)
4407         */
4408        public List<CodeableReference> getWarning() { 
4409          if (this.warning == null)
4410            this.warning = new ArrayList<CodeableReference>();
4411          return this.warning;
4412        }
4413
4414        /**
4415         * @return Returns a reference to <code>this</code> for easy method chaining
4416         */
4417        public DeviceDefinitionGuidelineComponent setWarning(List<CodeableReference> theWarning) { 
4418          this.warning = theWarning;
4419          return this;
4420        }
4421
4422        public boolean hasWarning() { 
4423          if (this.warning == null)
4424            return false;
4425          for (CodeableReference item : this.warning)
4426            if (!item.isEmpty())
4427              return true;
4428          return false;
4429        }
4430
4431        public CodeableReference addWarning() { //3
4432          CodeableReference t = new CodeableReference();
4433          if (this.warning == null)
4434            this.warning = new ArrayList<CodeableReference>();
4435          this.warning.add(t);
4436          return t;
4437        }
4438
4439        public DeviceDefinitionGuidelineComponent addWarning(CodeableReference t) { //3
4440          if (t == null)
4441            return this;
4442          if (this.warning == null)
4443            this.warning = new ArrayList<CodeableReference>();
4444          this.warning.add(t);
4445          return this;
4446        }
4447
4448        /**
4449         * @return The first repetition of repeating field {@link #warning}, creating it if it does not already exist {3}
4450         */
4451        public CodeableReference getWarningFirstRep() { 
4452          if (getWarning().isEmpty()) {
4453            addWarning();
4454          }
4455          return getWarning().get(0);
4456        }
4457
4458        /**
4459         * @return {@link #intendedUse} (A description of the general purpose or medical use of the device or its function.). This is the underlying object with id, value and extensions. The accessor "getIntendedUse" gives direct access to the value
4460         */
4461        public StringType getIntendedUseElement() { 
4462          if (this.intendedUse == null)
4463            if (Configuration.errorOnAutoCreate())
4464              throw new Error("Attempt to auto-create DeviceDefinitionGuidelineComponent.intendedUse");
4465            else if (Configuration.doAutoCreate())
4466              this.intendedUse = new StringType(); // bb
4467          return this.intendedUse;
4468        }
4469
4470        public boolean hasIntendedUseElement() { 
4471          return this.intendedUse != null && !this.intendedUse.isEmpty();
4472        }
4473
4474        public boolean hasIntendedUse() { 
4475          return this.intendedUse != null && !this.intendedUse.isEmpty();
4476        }
4477
4478        /**
4479         * @param value {@link #intendedUse} (A description of the general purpose or medical use of the device or its function.). This is the underlying object with id, value and extensions. The accessor "getIntendedUse" gives direct access to the value
4480         */
4481        public DeviceDefinitionGuidelineComponent setIntendedUseElement(StringType value) { 
4482          this.intendedUse = value;
4483          return this;
4484        }
4485
4486        /**
4487         * @return A description of the general purpose or medical use of the device or its function.
4488         */
4489        public String getIntendedUse() { 
4490          return this.intendedUse == null ? null : this.intendedUse.getValue();
4491        }
4492
4493        /**
4494         * @param value A description of the general purpose or medical use of the device or its function.
4495         */
4496        public DeviceDefinitionGuidelineComponent setIntendedUse(String value) { 
4497          if (Utilities.noString(value))
4498            this.intendedUse = null;
4499          else {
4500            if (this.intendedUse == null)
4501              this.intendedUse = new StringType();
4502            this.intendedUse.setValue(value);
4503          }
4504          return this;
4505        }
4506
4507        protected void listChildren(List<Property> children) {
4508          super.listChildren(children);
4509          children.add(new Property("useContext", "UsageContext", "The circumstances that form the setting for using the device.", 0, java.lang.Integer.MAX_VALUE, useContext));
4510          children.add(new Property("usageInstruction", "markdown", "Detailed written and visual directions for the user on how to use the device.", 0, 1, usageInstruction));
4511          children.add(new Property("relatedArtifact", "RelatedArtifact", "A source of information or reference for this guideline.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
4512          children.add(new Property("indication", "CodeableReference(ClinicalUseDefinition)", "A clinical condition for which the device was designed to be used.", 0, java.lang.Integer.MAX_VALUE, indication));
4513          children.add(new Property("contraindication", "CodeableReference(ClinicalUseDefinition)", "A specific situation when a device should not be used because it may cause harm.", 0, java.lang.Integer.MAX_VALUE, contraindication));
4514          children.add(new Property("warning", "CodeableReference(ClinicalUseDefinition)", "Specific hazard alert information that a user needs to know before using the device.", 0, java.lang.Integer.MAX_VALUE, warning));
4515          children.add(new Property("intendedUse", "string", "A description of the general purpose or medical use of the device or its function.", 0, 1, intendedUse));
4516        }
4517
4518        @Override
4519        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4520          switch (_hash) {
4521          case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The circumstances that form the setting for using the device.", 0, java.lang.Integer.MAX_VALUE, useContext);
4522          case 2138372141: /*usageInstruction*/  return new Property("usageInstruction", "markdown", "Detailed written and visual directions for the user on how to use the device.", 0, 1, usageInstruction);
4523          case 666807069: /*relatedArtifact*/  return new Property("relatedArtifact", "RelatedArtifact", "A source of information or reference for this guideline.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
4524          case -597168804: /*indication*/  return new Property("indication", "CodeableReference(ClinicalUseDefinition)", "A clinical condition for which the device was designed to be used.", 0, java.lang.Integer.MAX_VALUE, indication);
4525          case 107135229: /*contraindication*/  return new Property("contraindication", "CodeableReference(ClinicalUseDefinition)", "A specific situation when a device should not be used because it may cause harm.", 0, java.lang.Integer.MAX_VALUE, contraindication);
4526          case 1124446108: /*warning*/  return new Property("warning", "CodeableReference(ClinicalUseDefinition)", "Specific hazard alert information that a user needs to know before using the device.", 0, java.lang.Integer.MAX_VALUE, warning);
4527          case -1618671268: /*intendedUse*/  return new Property("intendedUse", "string", "A description of the general purpose or medical use of the device or its function.", 0, 1, intendedUse);
4528          default: return super.getNamedProperty(_hash, _name, _checkValid);
4529          }
4530
4531        }
4532
4533      @Override
4534      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4535        switch (hash) {
4536        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
4537        case 2138372141: /*usageInstruction*/ return this.usageInstruction == null ? new Base[0] : new Base[] {this.usageInstruction}; // MarkdownType
4538        case 666807069: /*relatedArtifact*/ return this.relatedArtifact == null ? new Base[0] : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
4539        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : this.indication.toArray(new Base[this.indication.size()]); // CodeableReference
4540        case 107135229: /*contraindication*/ return this.contraindication == null ? new Base[0] : this.contraindication.toArray(new Base[this.contraindication.size()]); // CodeableReference
4541        case 1124446108: /*warning*/ return this.warning == null ? new Base[0] : this.warning.toArray(new Base[this.warning.size()]); // CodeableReference
4542        case -1618671268: /*intendedUse*/ return this.intendedUse == null ? new Base[0] : new Base[] {this.intendedUse}; // StringType
4543        default: return super.getProperty(hash, name, checkValid);
4544        }
4545
4546      }
4547
4548      @Override
4549      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4550        switch (hash) {
4551        case -669707736: // useContext
4552          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
4553          return value;
4554        case 2138372141: // usageInstruction
4555          this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
4556          return value;
4557        case 666807069: // relatedArtifact
4558          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
4559          return value;
4560        case -597168804: // indication
4561          this.getIndication().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
4562          return value;
4563        case 107135229: // contraindication
4564          this.getContraindication().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
4565          return value;
4566        case 1124446108: // warning
4567          this.getWarning().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
4568          return value;
4569        case -1618671268: // intendedUse
4570          this.intendedUse = TypeConvertor.castToString(value); // StringType
4571          return value;
4572        default: return super.setProperty(hash, name, value);
4573        }
4574
4575      }
4576
4577      @Override
4578      public Base setProperty(String name, Base value) throws FHIRException {
4579        if (name.equals("useContext")) {
4580          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
4581        } else if (name.equals("usageInstruction")) {
4582          this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
4583        } else if (name.equals("relatedArtifact")) {
4584          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value));
4585        } else if (name.equals("indication")) {
4586          this.getIndication().add(TypeConvertor.castToCodeableReference(value));
4587        } else if (name.equals("contraindication")) {
4588          this.getContraindication().add(TypeConvertor.castToCodeableReference(value));
4589        } else if (name.equals("warning")) {
4590          this.getWarning().add(TypeConvertor.castToCodeableReference(value));
4591        } else if (name.equals("intendedUse")) {
4592          this.intendedUse = TypeConvertor.castToString(value); // StringType
4593        } else
4594          return super.setProperty(name, value);
4595        return value;
4596      }
4597
4598      @Override
4599      public Base makeProperty(int hash, String name) throws FHIRException {
4600        switch (hash) {
4601        case -669707736:  return addUseContext(); 
4602        case 2138372141:  return getUsageInstructionElement();
4603        case 666807069:  return addRelatedArtifact(); 
4604        case -597168804:  return addIndication(); 
4605        case 107135229:  return addContraindication(); 
4606        case 1124446108:  return addWarning(); 
4607        case -1618671268:  return getIntendedUseElement();
4608        default: return super.makeProperty(hash, name);
4609        }
4610
4611      }
4612
4613      @Override
4614      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4615        switch (hash) {
4616        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4617        case 2138372141: /*usageInstruction*/ return new String[] {"markdown"};
4618        case 666807069: /*relatedArtifact*/ return new String[] {"RelatedArtifact"};
4619        case -597168804: /*indication*/ return new String[] {"CodeableReference"};
4620        case 107135229: /*contraindication*/ return new String[] {"CodeableReference"};
4621        case 1124446108: /*warning*/ return new String[] {"CodeableReference"};
4622        case -1618671268: /*intendedUse*/ return new String[] {"string"};
4623        default: return super.getTypesForProperty(hash, name);
4624        }
4625
4626      }
4627
4628      @Override
4629      public Base addChild(String name) throws FHIRException {
4630        if (name.equals("useContext")) {
4631          return addUseContext();
4632        }
4633        else if (name.equals("usageInstruction")) {
4634          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.guideline.usageInstruction");
4635        }
4636        else if (name.equals("relatedArtifact")) {
4637          return addRelatedArtifact();
4638        }
4639        else if (name.equals("indication")) {
4640          return addIndication();
4641        }
4642        else if (name.equals("contraindication")) {
4643          return addContraindication();
4644        }
4645        else if (name.equals("warning")) {
4646          return addWarning();
4647        }
4648        else if (name.equals("intendedUse")) {
4649          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.guideline.intendedUse");
4650        }
4651        else
4652          return super.addChild(name);
4653      }
4654
4655      public DeviceDefinitionGuidelineComponent copy() {
4656        DeviceDefinitionGuidelineComponent dst = new DeviceDefinitionGuidelineComponent();
4657        copyValues(dst);
4658        return dst;
4659      }
4660
4661      public void copyValues(DeviceDefinitionGuidelineComponent dst) {
4662        super.copyValues(dst);
4663        if (useContext != null) {
4664          dst.useContext = new ArrayList<UsageContext>();
4665          for (UsageContext i : useContext)
4666            dst.useContext.add(i.copy());
4667        };
4668        dst.usageInstruction = usageInstruction == null ? null : usageInstruction.copy();
4669        if (relatedArtifact != null) {
4670          dst.relatedArtifact = new ArrayList<RelatedArtifact>();
4671          for (RelatedArtifact i : relatedArtifact)
4672            dst.relatedArtifact.add(i.copy());
4673        };
4674        if (indication != null) {
4675          dst.indication = new ArrayList<CodeableReference>();
4676          for (CodeableReference i : indication)
4677            dst.indication.add(i.copy());
4678        };
4679        if (contraindication != null) {
4680          dst.contraindication = new ArrayList<CodeableReference>();
4681          for (CodeableReference i : contraindication)
4682            dst.contraindication.add(i.copy());
4683        };
4684        if (warning != null) {
4685          dst.warning = new ArrayList<CodeableReference>();
4686          for (CodeableReference i : warning)
4687            dst.warning.add(i.copy());
4688        };
4689        dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
4690      }
4691
4692      @Override
4693      public boolean equalsDeep(Base other_) {
4694        if (!super.equalsDeep(other_))
4695          return false;
4696        if (!(other_ instanceof DeviceDefinitionGuidelineComponent))
4697          return false;
4698        DeviceDefinitionGuidelineComponent o = (DeviceDefinitionGuidelineComponent) other_;
4699        return compareDeep(useContext, o.useContext, true) && compareDeep(usageInstruction, o.usageInstruction, true)
4700           && compareDeep(relatedArtifact, o.relatedArtifact, true) && compareDeep(indication, o.indication, true)
4701           && compareDeep(contraindication, o.contraindication, true) && compareDeep(warning, o.warning, true)
4702           && compareDeep(intendedUse, o.intendedUse, true);
4703      }
4704
4705      @Override
4706      public boolean equalsShallow(Base other_) {
4707        if (!super.equalsShallow(other_))
4708          return false;
4709        if (!(other_ instanceof DeviceDefinitionGuidelineComponent))
4710          return false;
4711        DeviceDefinitionGuidelineComponent o = (DeviceDefinitionGuidelineComponent) other_;
4712        return compareValues(usageInstruction, o.usageInstruction, true) && compareValues(intendedUse, o.intendedUse, true)
4713          ;
4714      }
4715
4716      public boolean isEmpty() {
4717        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(useContext, usageInstruction
4718          , relatedArtifact, indication, contraindication, warning, intendedUse);
4719      }
4720
4721  public String fhirType() {
4722    return "DeviceDefinition.guideline";
4723
4724  }
4725
4726  }
4727
4728    @Block()
4729    public static class DeviceDefinitionCorrectiveActionComponent extends BackboneElement implements IBaseBackboneElement {
4730        /**
4731         * Whether the last corrective action known for this device was a recall.
4732         */
4733        @Child(name = "recall", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4734        @Description(shortDefinition="Whether the corrective action was a recall", formalDefinition="Whether the last corrective action known for this device was a recall." )
4735        protected BooleanType recall;
4736
4737        /**
4738         * The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
4739         */
4740        @Child(name = "scope", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
4741        @Description(shortDefinition="model | lot-numbers | serial-numbers", formalDefinition="The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name." )
4742        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-correctiveactionscope")
4743        protected Enumeration<DeviceCorrectiveActionScope> scope;
4744
4745        /**
4746         * Start and end dates of the  corrective action.
4747         */
4748        @Child(name = "period", type = {Period.class}, order=3, min=1, max=1, modifier=false, summary=false)
4749        @Description(shortDefinition="Start and end dates of the  corrective action", formalDefinition="Start and end dates of the  corrective action." )
4750        protected Period period;
4751
4752        private static final long serialVersionUID = -1936691252L;
4753
4754    /**
4755     * Constructor
4756     */
4757      public DeviceDefinitionCorrectiveActionComponent() {
4758        super();
4759      }
4760
4761    /**
4762     * Constructor
4763     */
4764      public DeviceDefinitionCorrectiveActionComponent(boolean recall, Period period) {
4765        super();
4766        this.setRecall(recall);
4767        this.setPeriod(period);
4768      }
4769
4770        /**
4771         * @return {@link #recall} (Whether the last corrective action known for this device was a recall.). This is the underlying object with id, value and extensions. The accessor "getRecall" gives direct access to the value
4772         */
4773        public BooleanType getRecallElement() { 
4774          if (this.recall == null)
4775            if (Configuration.errorOnAutoCreate())
4776              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.recall");
4777            else if (Configuration.doAutoCreate())
4778              this.recall = new BooleanType(); // bb
4779          return this.recall;
4780        }
4781
4782        public boolean hasRecallElement() { 
4783          return this.recall != null && !this.recall.isEmpty();
4784        }
4785
4786        public boolean hasRecall() { 
4787          return this.recall != null && !this.recall.isEmpty();
4788        }
4789
4790        /**
4791         * @param value {@link #recall} (Whether the last corrective action known for this device was a recall.). This is the underlying object with id, value and extensions. The accessor "getRecall" gives direct access to the value
4792         */
4793        public DeviceDefinitionCorrectiveActionComponent setRecallElement(BooleanType value) { 
4794          this.recall = value;
4795          return this;
4796        }
4797
4798        /**
4799         * @return Whether the last corrective action known for this device was a recall.
4800         */
4801        public boolean getRecall() { 
4802          return this.recall == null || this.recall.isEmpty() ? false : this.recall.getValue();
4803        }
4804
4805        /**
4806         * @param value Whether the last corrective action known for this device was a recall.
4807         */
4808        public DeviceDefinitionCorrectiveActionComponent setRecall(boolean value) { 
4809            if (this.recall == null)
4810              this.recall = new BooleanType();
4811            this.recall.setValue(value);
4812          return this;
4813        }
4814
4815        /**
4816         * @return {@link #scope} (The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
4817         */
4818        public Enumeration<DeviceCorrectiveActionScope> getScopeElement() { 
4819          if (this.scope == null)
4820            if (Configuration.errorOnAutoCreate())
4821              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.scope");
4822            else if (Configuration.doAutoCreate())
4823              this.scope = new Enumeration<DeviceCorrectiveActionScope>(new DeviceCorrectiveActionScopeEnumFactory()); // bb
4824          return this.scope;
4825        }
4826
4827        public boolean hasScopeElement() { 
4828          return this.scope != null && !this.scope.isEmpty();
4829        }
4830
4831        public boolean hasScope() { 
4832          return this.scope != null && !this.scope.isEmpty();
4833        }
4834
4835        /**
4836         * @param value {@link #scope} (The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
4837         */
4838        public DeviceDefinitionCorrectiveActionComponent setScopeElement(Enumeration<DeviceCorrectiveActionScope> value) { 
4839          this.scope = value;
4840          return this;
4841        }
4842
4843        /**
4844         * @return The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
4845         */
4846        public DeviceCorrectiveActionScope getScope() { 
4847          return this.scope == null ? null : this.scope.getValue();
4848        }
4849
4850        /**
4851         * @param value The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
4852         */
4853        public DeviceDefinitionCorrectiveActionComponent setScope(DeviceCorrectiveActionScope value) { 
4854          if (value == null)
4855            this.scope = null;
4856          else {
4857            if (this.scope == null)
4858              this.scope = new Enumeration<DeviceCorrectiveActionScope>(new DeviceCorrectiveActionScopeEnumFactory());
4859            this.scope.setValue(value);
4860          }
4861          return this;
4862        }
4863
4864        /**
4865         * @return {@link #period} (Start and end dates of the  corrective action.)
4866         */
4867        public Period getPeriod() { 
4868          if (this.period == null)
4869            if (Configuration.errorOnAutoCreate())
4870              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.period");
4871            else if (Configuration.doAutoCreate())
4872              this.period = new Period(); // cc
4873          return this.period;
4874        }
4875
4876        public boolean hasPeriod() { 
4877          return this.period != null && !this.period.isEmpty();
4878        }
4879
4880        /**
4881         * @param value {@link #period} (Start and end dates of the  corrective action.)
4882         */
4883        public DeviceDefinitionCorrectiveActionComponent setPeriod(Period value) { 
4884          this.period = value;
4885          return this;
4886        }
4887
4888        protected void listChildren(List<Property> children) {
4889          super.listChildren(children);
4890          children.add(new Property("recall", "boolean", "Whether the last corrective action known for this device was a recall.", 0, 1, recall));
4891          children.add(new Property("scope", "code", "The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.", 0, 1, scope));
4892          children.add(new Property("period", "Period", "Start and end dates of the  corrective action.", 0, 1, period));
4893        }
4894
4895        @Override
4896        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4897          switch (_hash) {
4898          case -934922479: /*recall*/  return new Property("recall", "boolean", "Whether the last corrective action known for this device was a recall.", 0, 1, recall);
4899          case 109264468: /*scope*/  return new Property("scope", "code", "The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.", 0, 1, scope);
4900          case -991726143: /*period*/  return new Property("period", "Period", "Start and end dates of the  corrective action.", 0, 1, period);
4901          default: return super.getNamedProperty(_hash, _name, _checkValid);
4902          }
4903
4904        }
4905
4906      @Override
4907      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4908        switch (hash) {
4909        case -934922479: /*recall*/ return this.recall == null ? new Base[0] : new Base[] {this.recall}; // BooleanType
4910        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // Enumeration<DeviceCorrectiveActionScope>
4911        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
4912        default: return super.getProperty(hash, name, checkValid);
4913        }
4914
4915      }
4916
4917      @Override
4918      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4919        switch (hash) {
4920        case -934922479: // recall
4921          this.recall = TypeConvertor.castToBoolean(value); // BooleanType
4922          return value;
4923        case 109264468: // scope
4924          value = new DeviceCorrectiveActionScopeEnumFactory().fromType(TypeConvertor.castToCode(value));
4925          this.scope = (Enumeration) value; // Enumeration<DeviceCorrectiveActionScope>
4926          return value;
4927        case -991726143: // period
4928          this.period = TypeConvertor.castToPeriod(value); // Period
4929          return value;
4930        default: return super.setProperty(hash, name, value);
4931        }
4932
4933      }
4934
4935      @Override
4936      public Base setProperty(String name, Base value) throws FHIRException {
4937        if (name.equals("recall")) {
4938          this.recall = TypeConvertor.castToBoolean(value); // BooleanType
4939        } else if (name.equals("scope")) {
4940          value = new DeviceCorrectiveActionScopeEnumFactory().fromType(TypeConvertor.castToCode(value));
4941          this.scope = (Enumeration) value; // Enumeration<DeviceCorrectiveActionScope>
4942        } else if (name.equals("period")) {
4943          this.period = TypeConvertor.castToPeriod(value); // Period
4944        } else
4945          return super.setProperty(name, value);
4946        return value;
4947      }
4948
4949      @Override
4950      public Base makeProperty(int hash, String name) throws FHIRException {
4951        switch (hash) {
4952        case -934922479:  return getRecallElement();
4953        case 109264468:  return getScopeElement();
4954        case -991726143:  return getPeriod();
4955        default: return super.makeProperty(hash, name);
4956        }
4957
4958      }
4959
4960      @Override
4961      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4962        switch (hash) {
4963        case -934922479: /*recall*/ return new String[] {"boolean"};
4964        case 109264468: /*scope*/ return new String[] {"code"};
4965        case -991726143: /*period*/ return new String[] {"Period"};
4966        default: return super.getTypesForProperty(hash, name);
4967        }
4968
4969      }
4970
4971      @Override
4972      public Base addChild(String name) throws FHIRException {
4973        if (name.equals("recall")) {
4974          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.correctiveAction.recall");
4975        }
4976        else if (name.equals("scope")) {
4977          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.correctiveAction.scope");
4978        }
4979        else if (name.equals("period")) {
4980          this.period = new Period();
4981          return this.period;
4982        }
4983        else
4984          return super.addChild(name);
4985      }
4986
4987      public DeviceDefinitionCorrectiveActionComponent copy() {
4988        DeviceDefinitionCorrectiveActionComponent dst = new DeviceDefinitionCorrectiveActionComponent();
4989        copyValues(dst);
4990        return dst;
4991      }
4992
4993      public void copyValues(DeviceDefinitionCorrectiveActionComponent dst) {
4994        super.copyValues(dst);
4995        dst.recall = recall == null ? null : recall.copy();
4996        dst.scope = scope == null ? null : scope.copy();
4997        dst.period = period == null ? null : period.copy();
4998      }
4999
5000      @Override
5001      public boolean equalsDeep(Base other_) {
5002        if (!super.equalsDeep(other_))
5003          return false;
5004        if (!(other_ instanceof DeviceDefinitionCorrectiveActionComponent))
5005          return false;
5006        DeviceDefinitionCorrectiveActionComponent o = (DeviceDefinitionCorrectiveActionComponent) other_;
5007        return compareDeep(recall, o.recall, true) && compareDeep(scope, o.scope, true) && compareDeep(period, o.period, true)
5008          ;
5009      }
5010
5011      @Override
5012      public boolean equalsShallow(Base other_) {
5013        if (!super.equalsShallow(other_))
5014          return false;
5015        if (!(other_ instanceof DeviceDefinitionCorrectiveActionComponent))
5016          return false;
5017        DeviceDefinitionCorrectiveActionComponent o = (DeviceDefinitionCorrectiveActionComponent) other_;
5018        return compareValues(recall, o.recall, true) && compareValues(scope, o.scope, true);
5019      }
5020
5021      public boolean isEmpty() {
5022        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(recall, scope, period);
5023      }
5024
5025  public String fhirType() {
5026    return "DeviceDefinition.correctiveAction";
5027
5028  }
5029
5030  }
5031
5032    @Block()
5033    public static class DeviceDefinitionChargeItemComponent extends BackboneElement implements IBaseBackboneElement {
5034        /**
5035         * The code or reference for the charge item.
5036         */
5037        @Child(name = "chargeItemCode", type = {CodeableReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
5038        @Description(shortDefinition="The code or reference for the charge item", formalDefinition="The code or reference for the charge item." )
5039        protected CodeableReference chargeItemCode;
5040
5041        /**
5042         * Coefficient applicable to the billing code.
5043         */
5044        @Child(name = "count", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=false)
5045        @Description(shortDefinition="Coefficient applicable to the billing code", formalDefinition="Coefficient applicable to the billing code." )
5046        protected Quantity count;
5047
5048        /**
5049         * A specific time period in which this charge item applies.
5050         */
5051        @Child(name = "effectivePeriod", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
5052        @Description(shortDefinition="A specific time period in which this charge item applies", formalDefinition="A specific time period in which this charge item applies." )
5053        protected Period effectivePeriod;
5054
5055        /**
5056         * The context to which this charge item applies.
5057         */
5058        @Child(name = "useContext", type = {UsageContext.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5059        @Description(shortDefinition="The context to which this charge item applies", formalDefinition="The context to which this charge item applies." )
5060        protected List<UsageContext> useContext;
5061
5062        private static final long serialVersionUID = 1312166907L;
5063
5064    /**
5065     * Constructor
5066     */
5067      public DeviceDefinitionChargeItemComponent() {
5068        super();
5069      }
5070
5071    /**
5072     * Constructor
5073     */
5074      public DeviceDefinitionChargeItemComponent(CodeableReference chargeItemCode, Quantity count) {
5075        super();
5076        this.setChargeItemCode(chargeItemCode);
5077        this.setCount(count);
5078      }
5079
5080        /**
5081         * @return {@link #chargeItemCode} (The code or reference for the charge item.)
5082         */
5083        public CodeableReference getChargeItemCode() { 
5084          if (this.chargeItemCode == null)
5085            if (Configuration.errorOnAutoCreate())
5086              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.chargeItemCode");
5087            else if (Configuration.doAutoCreate())
5088              this.chargeItemCode = new CodeableReference(); // cc
5089          return this.chargeItemCode;
5090        }
5091
5092        public boolean hasChargeItemCode() { 
5093          return this.chargeItemCode != null && !this.chargeItemCode.isEmpty();
5094        }
5095
5096        /**
5097         * @param value {@link #chargeItemCode} (The code or reference for the charge item.)
5098         */
5099        public DeviceDefinitionChargeItemComponent setChargeItemCode(CodeableReference value) { 
5100          this.chargeItemCode = value;
5101          return this;
5102        }
5103
5104        /**
5105         * @return {@link #count} (Coefficient applicable to the billing code.)
5106         */
5107        public Quantity getCount() { 
5108          if (this.count == null)
5109            if (Configuration.errorOnAutoCreate())
5110              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.count");
5111            else if (Configuration.doAutoCreate())
5112              this.count = new Quantity(); // cc
5113          return this.count;
5114        }
5115
5116        public boolean hasCount() { 
5117          return this.count != null && !this.count.isEmpty();
5118        }
5119
5120        /**
5121         * @param value {@link #count} (Coefficient applicable to the billing code.)
5122         */
5123        public DeviceDefinitionChargeItemComponent setCount(Quantity value) { 
5124          this.count = value;
5125          return this;
5126        }
5127
5128        /**
5129         * @return {@link #effectivePeriod} (A specific time period in which this charge item applies.)
5130         */
5131        public Period getEffectivePeriod() { 
5132          if (this.effectivePeriod == null)
5133            if (Configuration.errorOnAutoCreate())
5134              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.effectivePeriod");
5135            else if (Configuration.doAutoCreate())
5136              this.effectivePeriod = new Period(); // cc
5137          return this.effectivePeriod;
5138        }
5139
5140        public boolean hasEffectivePeriod() { 
5141          return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
5142        }
5143
5144        /**
5145         * @param value {@link #effectivePeriod} (A specific time period in which this charge item applies.)
5146         */
5147        public DeviceDefinitionChargeItemComponent setEffectivePeriod(Period value) { 
5148          this.effectivePeriod = value;
5149          return this;
5150        }
5151
5152        /**
5153         * @return {@link #useContext} (The context to which this charge item applies.)
5154         */
5155        public List<UsageContext> getUseContext() { 
5156          if (this.useContext == null)
5157            this.useContext = new ArrayList<UsageContext>();
5158          return this.useContext;
5159        }
5160
5161        /**
5162         * @return Returns a reference to <code>this</code> for easy method chaining
5163         */
5164        public DeviceDefinitionChargeItemComponent setUseContext(List<UsageContext> theUseContext) { 
5165          this.useContext = theUseContext;
5166          return this;
5167        }
5168
5169        public boolean hasUseContext() { 
5170          if (this.useContext == null)
5171            return false;
5172          for (UsageContext item : this.useContext)
5173            if (!item.isEmpty())
5174              return true;
5175          return false;
5176        }
5177
5178        public UsageContext addUseContext() { //3
5179          UsageContext t = new UsageContext();
5180          if (this.useContext == null)
5181            this.useContext = new ArrayList<UsageContext>();
5182          this.useContext.add(t);
5183          return t;
5184        }
5185
5186        public DeviceDefinitionChargeItemComponent addUseContext(UsageContext t) { //3
5187          if (t == null)
5188            return this;
5189          if (this.useContext == null)
5190            this.useContext = new ArrayList<UsageContext>();
5191          this.useContext.add(t);
5192          return this;
5193        }
5194
5195        /**
5196         * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
5197         */
5198        public UsageContext getUseContextFirstRep() { 
5199          if (getUseContext().isEmpty()) {
5200            addUseContext();
5201          }
5202          return getUseContext().get(0);
5203        }
5204
5205        protected void listChildren(List<Property> children) {
5206          super.listChildren(children);
5207          children.add(new Property("chargeItemCode", "CodeableReference(ChargeItemDefinition)", "The code or reference for the charge item.", 0, 1, chargeItemCode));
5208          children.add(new Property("count", "Quantity", "Coefficient applicable to the billing code.", 0, 1, count));
5209          children.add(new Property("effectivePeriod", "Period", "A specific time period in which this charge item applies.", 0, 1, effectivePeriod));
5210          children.add(new Property("useContext", "UsageContext", "The context to which this charge item applies.", 0, java.lang.Integer.MAX_VALUE, useContext));
5211        }
5212
5213        @Override
5214        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5215          switch (_hash) {
5216          case -2001375628: /*chargeItemCode*/  return new Property("chargeItemCode", "CodeableReference(ChargeItemDefinition)", "The code or reference for the charge item.", 0, 1, chargeItemCode);
5217          case 94851343: /*count*/  return new Property("count", "Quantity", "Coefficient applicable to the billing code.", 0, 1, count);
5218          case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "A specific time period in which this charge item applies.", 0, 1, effectivePeriod);
5219          case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The context to which this charge item applies.", 0, java.lang.Integer.MAX_VALUE, useContext);
5220          default: return super.getNamedProperty(_hash, _name, _checkValid);
5221          }
5222
5223        }
5224
5225      @Override
5226      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5227        switch (hash) {
5228        case -2001375628: /*chargeItemCode*/ return this.chargeItemCode == null ? new Base[0] : new Base[] {this.chargeItemCode}; // CodeableReference
5229        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // Quantity
5230        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
5231        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
5232        default: return super.getProperty(hash, name, checkValid);
5233        }
5234
5235      }
5236
5237      @Override
5238      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5239        switch (hash) {
5240        case -2001375628: // chargeItemCode
5241          this.chargeItemCode = TypeConvertor.castToCodeableReference(value); // CodeableReference
5242          return value;
5243        case 94851343: // count
5244          this.count = TypeConvertor.castToQuantity(value); // Quantity
5245          return value;
5246        case -403934648: // effectivePeriod
5247          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5248          return value;
5249        case -669707736: // useContext
5250          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5251          return value;
5252        default: return super.setProperty(hash, name, value);
5253        }
5254
5255      }
5256
5257      @Override
5258      public Base setProperty(String name, Base value) throws FHIRException {
5259        if (name.equals("chargeItemCode")) {
5260          this.chargeItemCode = TypeConvertor.castToCodeableReference(value); // CodeableReference
5261        } else if (name.equals("count")) {
5262          this.count = TypeConvertor.castToQuantity(value); // Quantity
5263        } else if (name.equals("effectivePeriod")) {
5264          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5265        } else if (name.equals("useContext")) {
5266          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
5267        } else
5268          return super.setProperty(name, value);
5269        return value;
5270      }
5271
5272      @Override
5273      public Base makeProperty(int hash, String name) throws FHIRException {
5274        switch (hash) {
5275        case -2001375628:  return getChargeItemCode();
5276        case 94851343:  return getCount();
5277        case -403934648:  return getEffectivePeriod();
5278        case -669707736:  return addUseContext(); 
5279        default: return super.makeProperty(hash, name);
5280        }
5281
5282      }
5283
5284      @Override
5285      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5286        switch (hash) {
5287        case -2001375628: /*chargeItemCode*/ return new String[] {"CodeableReference"};
5288        case 94851343: /*count*/ return new String[] {"Quantity"};
5289        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
5290        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
5291        default: return super.getTypesForProperty(hash, name);
5292        }
5293
5294      }
5295
5296      @Override
5297      public Base addChild(String name) throws FHIRException {
5298        if (name.equals("chargeItemCode")) {
5299          this.chargeItemCode = new CodeableReference();
5300          return this.chargeItemCode;
5301        }
5302        else if (name.equals("count")) {
5303          this.count = new Quantity();
5304          return this.count;
5305        }
5306        else if (name.equals("effectivePeriod")) {
5307          this.effectivePeriod = new Period();
5308          return this.effectivePeriod;
5309        }
5310        else if (name.equals("useContext")) {
5311          return addUseContext();
5312        }
5313        else
5314          return super.addChild(name);
5315      }
5316
5317      public DeviceDefinitionChargeItemComponent copy() {
5318        DeviceDefinitionChargeItemComponent dst = new DeviceDefinitionChargeItemComponent();
5319        copyValues(dst);
5320        return dst;
5321      }
5322
5323      public void copyValues(DeviceDefinitionChargeItemComponent dst) {
5324        super.copyValues(dst);
5325        dst.chargeItemCode = chargeItemCode == null ? null : chargeItemCode.copy();
5326        dst.count = count == null ? null : count.copy();
5327        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
5328        if (useContext != null) {
5329          dst.useContext = new ArrayList<UsageContext>();
5330          for (UsageContext i : useContext)
5331            dst.useContext.add(i.copy());
5332        };
5333      }
5334
5335      @Override
5336      public boolean equalsDeep(Base other_) {
5337        if (!super.equalsDeep(other_))
5338          return false;
5339        if (!(other_ instanceof DeviceDefinitionChargeItemComponent))
5340          return false;
5341        DeviceDefinitionChargeItemComponent o = (DeviceDefinitionChargeItemComponent) other_;
5342        return compareDeep(chargeItemCode, o.chargeItemCode, true) && compareDeep(count, o.count, true)
5343           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(useContext, o.useContext, true)
5344          ;
5345      }
5346
5347      @Override
5348      public boolean equalsShallow(Base other_) {
5349        if (!super.equalsShallow(other_))
5350          return false;
5351        if (!(other_ instanceof DeviceDefinitionChargeItemComponent))
5352          return false;
5353        DeviceDefinitionChargeItemComponent o = (DeviceDefinitionChargeItemComponent) other_;
5354        return true;
5355      }
5356
5357      public boolean isEmpty() {
5358        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(chargeItemCode, count, effectivePeriod
5359          , useContext);
5360      }
5361
5362  public String fhirType() {
5363    return "DeviceDefinition.chargeItem";
5364
5365  }
5366
5367  }
5368
5369    /**
5370     * Additional information to describe the device.
5371     */
5372    @Child(name = "description", type = {MarkdownType.class}, order=0, min=0, max=1, modifier=false, summary=false)
5373    @Description(shortDefinition="Additional information to describe the device", formalDefinition="Additional information to describe the device." )
5374    protected MarkdownType description;
5375
5376    /**
5377     * Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.
5378     */
5379    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5380    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type." )
5381    protected List<Identifier> identifier;
5382
5383    /**
5384     * 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.
5385     */
5386    @Child(name = "udiDeviceIdentifier", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5387    @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." )
5388    protected List<DeviceDefinitionUdiDeviceIdentifierComponent> udiDeviceIdentifier;
5389
5390    /**
5391     * Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.
5392     */
5393    @Child(name = "regulatoryIdentifier", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5394    @Description(shortDefinition="Regulatory identifier(s) associated with this device", formalDefinition="Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe." )
5395    protected List<DeviceDefinitionRegulatoryIdentifierComponent> regulatoryIdentifier;
5396
5397    /**
5398     * The part number or catalog number of the device.
5399     */
5400    @Child(name = "partNumber", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5401    @Description(shortDefinition="The part number or catalog number of the device", formalDefinition="The part number or catalog number of the device." )
5402    protected StringType partNumber;
5403
5404    /**
5405     * A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.
5406     */
5407    @Child(name = "manufacturer", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=false)
5408    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction." )
5409    protected Reference manufacturer;
5410
5411    /**
5412     * The name or names of the device as given by the manufacturer.
5413     */
5414    @Child(name = "deviceName", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5415    @Description(shortDefinition="The name or names of the device as given by the manufacturer", formalDefinition="The name or names of the device as given by the manufacturer." )
5416    protected List<DeviceDefinitionDeviceNameComponent> deviceName;
5417
5418    /**
5419     * The model number for the device for example as defined by the manufacturer or labeler, or other agency.
5420     */
5421    @Child(name = "modelNumber", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
5422    @Description(shortDefinition="The catalog or model number for the device for example as defined by the manufacturer", formalDefinition="The model number for the device for example as defined by the manufacturer or labeler, or other agency." )
5423    protected StringType modelNumber;
5424
5425    /**
5426     * What kind of device or device system this is.
5427     */
5428    @Child(name = "classification", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5429    @Description(shortDefinition="What kind of device or device system this is", formalDefinition="What kind of device or device system this is." )
5430    protected List<DeviceDefinitionClassificationComponent> classification;
5431
5432    /**
5433     * The capabilities supported on a  device, the standards to which the device conforms for a particular purpose, and used for the communication.
5434     */
5435    @Child(name = "specialization", type = {RelatedArtifact.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5436    @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." )
5437    protected List<RelatedArtifact> specialization;
5438
5439    /**
5440     * A device that is part (for example a component) of the present device.
5441     */
5442    @Child(name = "hasPart", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5443    @Description(shortDefinition="A device, part of the current one", formalDefinition="A device that is part (for example a component) of the present device." )
5444    protected List<DeviceDefinitionHasPartComponent> hasPart;
5445
5446    /**
5447     * Information about the packaging of the device, i.e. how the device is packaged.
5448     */
5449    @Child(name = "packaging", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5450    @Description(shortDefinition="Information about the packaging of the device, i.e. how the device is packaged", formalDefinition="Information about the packaging of the device, i.e. how the device is packaged." )
5451    protected List<DeviceDefinitionPackagingComponent> packaging;
5452
5453    /**
5454     * The version of the device or software.
5455     */
5456    @Child(name = "version", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5457    @Description(shortDefinition="The version of the device or software", formalDefinition="The version of the device or software." )
5458    protected List<DeviceDefinitionVersionComponent> version;
5459
5460    /**
5461     * Safety characteristics of the device.
5462     */
5463    @Child(name = "safety", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5464    @Description(shortDefinition="Safety characteristics of the device", formalDefinition="Safety characteristics of the device." )
5465    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-safety")
5466    protected List<CodeableConcept> safety;
5467
5468    /**
5469     * Shelf Life and storage information.
5470     */
5471    @Child(name = "shelfLifeStorage", type = {ProductShelfLife.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5472    @Description(shortDefinition="Shelf Life and storage information", formalDefinition="Shelf Life and storage information." )
5473    protected List<ProductShelfLife> shelfLifeStorage;
5474
5475    /**
5476     * Language code for the human-readable text strings produced by the device (all supported).
5477     */
5478    @Child(name = "languageCode", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5479    @Description(shortDefinition="Language code for the human-readable text strings produced by the device (all supported)", formalDefinition="Language code for the human-readable text strings produced by the device (all supported)." )
5480    protected List<CodeableConcept> languageCode;
5481
5482    /**
5483     * The potential, valid configuration settings of a device, e.g., regulation status, time properties.
5484     */
5485    @Child(name = "property", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5486    @Description(shortDefinition="The potential, valid configuration settings of a device, e.g., regulation status, time properties", formalDefinition="The potential, valid configuration settings of a device, e.g., regulation status, time properties." )
5487    protected List<DeviceDefinitionPropertyComponent> property;
5488
5489    /**
5490     * An organization that is responsible for the provision and ongoing maintenance of the device.
5491     */
5492    @Child(name = "owner", type = {Organization.class}, order=17, min=0, max=1, modifier=false, summary=false)
5493    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
5494    protected Reference owner;
5495
5496    /**
5497     * Contact details for an organization or a particular human that is responsible for the device.
5498     */
5499    @Child(name = "contact", type = {ContactPoint.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5500    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
5501    protected List<ContactPoint> contact;
5502
5503    /**
5504     * An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.
5505     */
5506    @Child(name = "link", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5507    @Description(shortDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device", formalDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device." )
5508    protected List<DeviceDefinitionLinkComponent> link;
5509
5510    /**
5511     * Descriptive information, usage information or implantation information that is not captured in an existing element.
5512     */
5513    @Child(name = "note", type = {Annotation.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5514    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
5515    protected List<Annotation> note;
5516
5517    /**
5518     * The parent device it can be part of.
5519     */
5520    @Child(name = "parentDevice", type = {DeviceDefinition.class}, order=21, min=0, max=1, modifier=false, summary=true)
5521    @Description(shortDefinition="The parent device it can be part of", formalDefinition="The parent device it can be part of." )
5522    protected Reference parentDevice;
5523
5524    /**
5525     * A substance used to create the material(s) of which the device is made.
5526     */
5527    @Child(name = "material", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5528    @Description(shortDefinition="A substance used to create the material(s) of which the device is made", formalDefinition="A substance used to create the material(s) of which the device is made." )
5529    protected List<DeviceDefinitionMaterialComponent> material;
5530
5531    /**
5532     * Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.
5533     */
5534    @Child(name = "productionIdentifierInUDI", type = {CodeType.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5535    @Description(shortDefinition="lot-number | manufactured-date | serial-number | expiration-date | biological-source | software-version", formalDefinition="Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label." )
5536    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-productidentifierinudi")
5537    protected List<Enumeration<DeviceProductionIdentifierInUDI>> productionIdentifierInUDI;
5538
5539    /**
5540     * Information aimed at providing directions for the usage of this model of device.
5541     */
5542    @Child(name = "guideline", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
5543    @Description(shortDefinition="Information aimed at providing directions for the usage of this model of device", formalDefinition="Information aimed at providing directions for the usage of this model of device." )
5544    protected DeviceDefinitionGuidelineComponent guideline;
5545
5546    /**
5547     * Tracking of latest field safety corrective action.
5548     */
5549    @Child(name = "correctiveAction", type = {}, order=25, min=0, max=1, modifier=false, summary=false)
5550    @Description(shortDefinition="Tracking of latest field safety corrective action", formalDefinition="Tracking of latest field safety corrective action." )
5551    protected DeviceDefinitionCorrectiveActionComponent correctiveAction;
5552
5553    /**
5554     * Billing code or reference associated with the device.
5555     */
5556    @Child(name = "chargeItem", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5557    @Description(shortDefinition="Billing code or reference associated with the device", formalDefinition="Billing code or reference associated with the device." )
5558    protected List<DeviceDefinitionChargeItemComponent> chargeItem;
5559
5560    private static final long serialVersionUID = 1343213621L;
5561
5562  /**
5563   * Constructor
5564   */
5565    public DeviceDefinition() {
5566      super();
5567    }
5568
5569    /**
5570     * @return {@link #description} (Additional information to describe the device.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5571     */
5572    public MarkdownType getDescriptionElement() { 
5573      if (this.description == null)
5574        if (Configuration.errorOnAutoCreate())
5575          throw new Error("Attempt to auto-create DeviceDefinition.description");
5576        else if (Configuration.doAutoCreate())
5577          this.description = new MarkdownType(); // bb
5578      return this.description;
5579    }
5580
5581    public boolean hasDescriptionElement() { 
5582      return this.description != null && !this.description.isEmpty();
5583    }
5584
5585    public boolean hasDescription() { 
5586      return this.description != null && !this.description.isEmpty();
5587    }
5588
5589    /**
5590     * @param value {@link #description} (Additional information to describe the device.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5591     */
5592    public DeviceDefinition setDescriptionElement(MarkdownType value) { 
5593      this.description = value;
5594      return this;
5595    }
5596
5597    /**
5598     * @return Additional information to describe the device.
5599     */
5600    public String getDescription() { 
5601      return this.description == null ? null : this.description.getValue();
5602    }
5603
5604    /**
5605     * @param value Additional information to describe the device.
5606     */
5607    public DeviceDefinition setDescription(String value) { 
5608      if (value == null)
5609        this.description = null;
5610      else {
5611        if (this.description == null)
5612          this.description = new MarkdownType();
5613        this.description.setValue(value);
5614      }
5615      return this;
5616    }
5617
5618    /**
5619     * @return {@link #identifier} (Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.)
5620     */
5621    public List<Identifier> getIdentifier() { 
5622      if (this.identifier == null)
5623        this.identifier = new ArrayList<Identifier>();
5624      return this.identifier;
5625    }
5626
5627    /**
5628     * @return Returns a reference to <code>this</code> for easy method chaining
5629     */
5630    public DeviceDefinition setIdentifier(List<Identifier> theIdentifier) { 
5631      this.identifier = theIdentifier;
5632      return this;
5633    }
5634
5635    public boolean hasIdentifier() { 
5636      if (this.identifier == null)
5637        return false;
5638      for (Identifier item : this.identifier)
5639        if (!item.isEmpty())
5640          return true;
5641      return false;
5642    }
5643
5644    public Identifier addIdentifier() { //3
5645      Identifier t = new Identifier();
5646      if (this.identifier == null)
5647        this.identifier = new ArrayList<Identifier>();
5648      this.identifier.add(t);
5649      return t;
5650    }
5651
5652    public DeviceDefinition addIdentifier(Identifier t) { //3
5653      if (t == null)
5654        return this;
5655      if (this.identifier == null)
5656        this.identifier = new ArrayList<Identifier>();
5657      this.identifier.add(t);
5658      return this;
5659    }
5660
5661    /**
5662     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
5663     */
5664    public Identifier getIdentifierFirstRep() { 
5665      if (getIdentifier().isEmpty()) {
5666        addIdentifier();
5667      }
5668      return getIdentifier().get(0);
5669    }
5670
5671    /**
5672     * @return {@link #udiDeviceIdentifier} (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.)
5673     */
5674    public List<DeviceDefinitionUdiDeviceIdentifierComponent> getUdiDeviceIdentifier() { 
5675      if (this.udiDeviceIdentifier == null)
5676        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
5677      return this.udiDeviceIdentifier;
5678    }
5679
5680    /**
5681     * @return Returns a reference to <code>this</code> for easy method chaining
5682     */
5683    public DeviceDefinition setUdiDeviceIdentifier(List<DeviceDefinitionUdiDeviceIdentifierComponent> theUdiDeviceIdentifier) { 
5684      this.udiDeviceIdentifier = theUdiDeviceIdentifier;
5685      return this;
5686    }
5687
5688    public boolean hasUdiDeviceIdentifier() { 
5689      if (this.udiDeviceIdentifier == null)
5690        return false;
5691      for (DeviceDefinitionUdiDeviceIdentifierComponent item : this.udiDeviceIdentifier)
5692        if (!item.isEmpty())
5693          return true;
5694      return false;
5695    }
5696
5697    public DeviceDefinitionUdiDeviceIdentifierComponent addUdiDeviceIdentifier() { //3
5698      DeviceDefinitionUdiDeviceIdentifierComponent t = new DeviceDefinitionUdiDeviceIdentifierComponent();
5699      if (this.udiDeviceIdentifier == null)
5700        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
5701      this.udiDeviceIdentifier.add(t);
5702      return t;
5703    }
5704
5705    public DeviceDefinition addUdiDeviceIdentifier(DeviceDefinitionUdiDeviceIdentifierComponent t) { //3
5706      if (t == null)
5707        return this;
5708      if (this.udiDeviceIdentifier == null)
5709        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
5710      this.udiDeviceIdentifier.add(t);
5711      return this;
5712    }
5713
5714    /**
5715     * @return The first repetition of repeating field {@link #udiDeviceIdentifier}, creating it if it does not already exist {3}
5716     */
5717    public DeviceDefinitionUdiDeviceIdentifierComponent getUdiDeviceIdentifierFirstRep() { 
5718      if (getUdiDeviceIdentifier().isEmpty()) {
5719        addUdiDeviceIdentifier();
5720      }
5721      return getUdiDeviceIdentifier().get(0);
5722    }
5723
5724    /**
5725     * @return {@link #regulatoryIdentifier} (Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.)
5726     */
5727    public List<DeviceDefinitionRegulatoryIdentifierComponent> getRegulatoryIdentifier() { 
5728      if (this.regulatoryIdentifier == null)
5729        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
5730      return this.regulatoryIdentifier;
5731    }
5732
5733    /**
5734     * @return Returns a reference to <code>this</code> for easy method chaining
5735     */
5736    public DeviceDefinition setRegulatoryIdentifier(List<DeviceDefinitionRegulatoryIdentifierComponent> theRegulatoryIdentifier) { 
5737      this.regulatoryIdentifier = theRegulatoryIdentifier;
5738      return this;
5739    }
5740
5741    public boolean hasRegulatoryIdentifier() { 
5742      if (this.regulatoryIdentifier == null)
5743        return false;
5744      for (DeviceDefinitionRegulatoryIdentifierComponent item : this.regulatoryIdentifier)
5745        if (!item.isEmpty())
5746          return true;
5747      return false;
5748    }
5749
5750    public DeviceDefinitionRegulatoryIdentifierComponent addRegulatoryIdentifier() { //3
5751      DeviceDefinitionRegulatoryIdentifierComponent t = new DeviceDefinitionRegulatoryIdentifierComponent();
5752      if (this.regulatoryIdentifier == null)
5753        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
5754      this.regulatoryIdentifier.add(t);
5755      return t;
5756    }
5757
5758    public DeviceDefinition addRegulatoryIdentifier(DeviceDefinitionRegulatoryIdentifierComponent t) { //3
5759      if (t == null)
5760        return this;
5761      if (this.regulatoryIdentifier == null)
5762        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
5763      this.regulatoryIdentifier.add(t);
5764      return this;
5765    }
5766
5767    /**
5768     * @return The first repetition of repeating field {@link #regulatoryIdentifier}, creating it if it does not already exist {3}
5769     */
5770    public DeviceDefinitionRegulatoryIdentifierComponent getRegulatoryIdentifierFirstRep() { 
5771      if (getRegulatoryIdentifier().isEmpty()) {
5772        addRegulatoryIdentifier();
5773      }
5774      return getRegulatoryIdentifier().get(0);
5775    }
5776
5777    /**
5778     * @return {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
5779     */
5780    public StringType getPartNumberElement() { 
5781      if (this.partNumber == null)
5782        if (Configuration.errorOnAutoCreate())
5783          throw new Error("Attempt to auto-create DeviceDefinition.partNumber");
5784        else if (Configuration.doAutoCreate())
5785          this.partNumber = new StringType(); // bb
5786      return this.partNumber;
5787    }
5788
5789    public boolean hasPartNumberElement() { 
5790      return this.partNumber != null && !this.partNumber.isEmpty();
5791    }
5792
5793    public boolean hasPartNumber() { 
5794      return this.partNumber != null && !this.partNumber.isEmpty();
5795    }
5796
5797    /**
5798     * @param value {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
5799     */
5800    public DeviceDefinition setPartNumberElement(StringType value) { 
5801      this.partNumber = value;
5802      return this;
5803    }
5804
5805    /**
5806     * @return The part number or catalog number of the device.
5807     */
5808    public String getPartNumber() { 
5809      return this.partNumber == null ? null : this.partNumber.getValue();
5810    }
5811
5812    /**
5813     * @param value The part number or catalog number of the device.
5814     */
5815    public DeviceDefinition setPartNumber(String value) { 
5816      if (Utilities.noString(value))
5817        this.partNumber = null;
5818      else {
5819        if (this.partNumber == null)
5820          this.partNumber = new StringType();
5821        this.partNumber.setValue(value);
5822      }
5823      return this;
5824    }
5825
5826    /**
5827     * @return {@link #manufacturer} (A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.)
5828     */
5829    public Reference getManufacturer() { 
5830      if (this.manufacturer == null)
5831        if (Configuration.errorOnAutoCreate())
5832          throw new Error("Attempt to auto-create DeviceDefinition.manufacturer");
5833        else if (Configuration.doAutoCreate())
5834          this.manufacturer = new Reference(); // cc
5835      return this.manufacturer;
5836    }
5837
5838    public boolean hasManufacturer() { 
5839      return this.manufacturer != null && !this.manufacturer.isEmpty();
5840    }
5841
5842    /**
5843     * @param value {@link #manufacturer} (A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.)
5844     */
5845    public DeviceDefinition setManufacturer(Reference value) { 
5846      this.manufacturer = value;
5847      return this;
5848    }
5849
5850    /**
5851     * @return {@link #deviceName} (The name or names of the device as given by the manufacturer.)
5852     */
5853    public List<DeviceDefinitionDeviceNameComponent> getDeviceName() { 
5854      if (this.deviceName == null)
5855        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
5856      return this.deviceName;
5857    }
5858
5859    /**
5860     * @return Returns a reference to <code>this</code> for easy method chaining
5861     */
5862    public DeviceDefinition setDeviceName(List<DeviceDefinitionDeviceNameComponent> theDeviceName) { 
5863      this.deviceName = theDeviceName;
5864      return this;
5865    }
5866
5867    public boolean hasDeviceName() { 
5868      if (this.deviceName == null)
5869        return false;
5870      for (DeviceDefinitionDeviceNameComponent item : this.deviceName)
5871        if (!item.isEmpty())
5872          return true;
5873      return false;
5874    }
5875
5876    public DeviceDefinitionDeviceNameComponent addDeviceName() { //3
5877      DeviceDefinitionDeviceNameComponent t = new DeviceDefinitionDeviceNameComponent();
5878      if (this.deviceName == null)
5879        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
5880      this.deviceName.add(t);
5881      return t;
5882    }
5883
5884    public DeviceDefinition addDeviceName(DeviceDefinitionDeviceNameComponent t) { //3
5885      if (t == null)
5886        return this;
5887      if (this.deviceName == null)
5888        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
5889      this.deviceName.add(t);
5890      return this;
5891    }
5892
5893    /**
5894     * @return The first repetition of repeating field {@link #deviceName}, creating it if it does not already exist {3}
5895     */
5896    public DeviceDefinitionDeviceNameComponent getDeviceNameFirstRep() { 
5897      if (getDeviceName().isEmpty()) {
5898        addDeviceName();
5899      }
5900      return getDeviceName().get(0);
5901    }
5902
5903    /**
5904     * @return {@link #modelNumber} (The model number for the device for example as defined by the manufacturer or labeler, or other agency.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
5905     */
5906    public StringType getModelNumberElement() { 
5907      if (this.modelNumber == null)
5908        if (Configuration.errorOnAutoCreate())
5909          throw new Error("Attempt to auto-create DeviceDefinition.modelNumber");
5910        else if (Configuration.doAutoCreate())
5911          this.modelNumber = new StringType(); // bb
5912      return this.modelNumber;
5913    }
5914
5915    public boolean hasModelNumberElement() { 
5916      return this.modelNumber != null && !this.modelNumber.isEmpty();
5917    }
5918
5919    public boolean hasModelNumber() { 
5920      return this.modelNumber != null && !this.modelNumber.isEmpty();
5921    }
5922
5923    /**
5924     * @param value {@link #modelNumber} (The model number for the device for example as defined by the manufacturer or labeler, or other agency.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
5925     */
5926    public DeviceDefinition setModelNumberElement(StringType value) { 
5927      this.modelNumber = value;
5928      return this;
5929    }
5930
5931    /**
5932     * @return The model number for the device for example as defined by the manufacturer or labeler, or other agency.
5933     */
5934    public String getModelNumber() { 
5935      return this.modelNumber == null ? null : this.modelNumber.getValue();
5936    }
5937
5938    /**
5939     * @param value The model number for the device for example as defined by the manufacturer or labeler, or other agency.
5940     */
5941    public DeviceDefinition setModelNumber(String value) { 
5942      if (Utilities.noString(value))
5943        this.modelNumber = null;
5944      else {
5945        if (this.modelNumber == null)
5946          this.modelNumber = new StringType();
5947        this.modelNumber.setValue(value);
5948      }
5949      return this;
5950    }
5951
5952    /**
5953     * @return {@link #classification} (What kind of device or device system this is.)
5954     */
5955    public List<DeviceDefinitionClassificationComponent> getClassification() { 
5956      if (this.classification == null)
5957        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
5958      return this.classification;
5959    }
5960
5961    /**
5962     * @return Returns a reference to <code>this</code> for easy method chaining
5963     */
5964    public DeviceDefinition setClassification(List<DeviceDefinitionClassificationComponent> theClassification) { 
5965      this.classification = theClassification;
5966      return this;
5967    }
5968
5969    public boolean hasClassification() { 
5970      if (this.classification == null)
5971        return false;
5972      for (DeviceDefinitionClassificationComponent item : this.classification)
5973        if (!item.isEmpty())
5974          return true;
5975      return false;
5976    }
5977
5978    public DeviceDefinitionClassificationComponent addClassification() { //3
5979      DeviceDefinitionClassificationComponent t = new DeviceDefinitionClassificationComponent();
5980      if (this.classification == null)
5981        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
5982      this.classification.add(t);
5983      return t;
5984    }
5985
5986    public DeviceDefinition addClassification(DeviceDefinitionClassificationComponent t) { //3
5987      if (t == null)
5988        return this;
5989      if (this.classification == null)
5990        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
5991      this.classification.add(t);
5992      return this;
5993    }
5994
5995    /**
5996     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist {3}
5997     */
5998    public DeviceDefinitionClassificationComponent getClassificationFirstRep() { 
5999      if (getClassification().isEmpty()) {
6000        addClassification();
6001      }
6002      return getClassification().get(0);
6003    }
6004
6005    /**
6006     * @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.)
6007     */
6008    public List<RelatedArtifact> getSpecialization() { 
6009      if (this.specialization == null)
6010        this.specialization = new ArrayList<RelatedArtifact>();
6011      return this.specialization;
6012    }
6013
6014    /**
6015     * @return Returns a reference to <code>this</code> for easy method chaining
6016     */
6017    public DeviceDefinition setSpecialization(List<RelatedArtifact> theSpecialization) { 
6018      this.specialization = theSpecialization;
6019      return this;
6020    }
6021
6022    public boolean hasSpecialization() { 
6023      if (this.specialization == null)
6024        return false;
6025      for (RelatedArtifact item : this.specialization)
6026        if (!item.isEmpty())
6027          return true;
6028      return false;
6029    }
6030
6031    public RelatedArtifact addSpecialization() { //3
6032      RelatedArtifact t = new RelatedArtifact();
6033      if (this.specialization == null)
6034        this.specialization = new ArrayList<RelatedArtifact>();
6035      this.specialization.add(t);
6036      return t;
6037    }
6038
6039    public DeviceDefinition addSpecialization(RelatedArtifact t) { //3
6040      if (t == null)
6041        return this;
6042      if (this.specialization == null)
6043        this.specialization = new ArrayList<RelatedArtifact>();
6044      this.specialization.add(t);
6045      return this;
6046    }
6047
6048    /**
6049     * @return The first repetition of repeating field {@link #specialization}, creating it if it does not already exist {3}
6050     */
6051    public RelatedArtifact getSpecializationFirstRep() { 
6052      if (getSpecialization().isEmpty()) {
6053        addSpecialization();
6054      }
6055      return getSpecialization().get(0);
6056    }
6057
6058    /**
6059     * @return {@link #hasPart} (A device that is part (for example a component) of the present device.)
6060     */
6061    public List<DeviceDefinitionHasPartComponent> getHasPart() { 
6062      if (this.hasPart == null)
6063        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6064      return this.hasPart;
6065    }
6066
6067    /**
6068     * @return Returns a reference to <code>this</code> for easy method chaining
6069     */
6070    public DeviceDefinition setHasPart(List<DeviceDefinitionHasPartComponent> theHasPart) { 
6071      this.hasPart = theHasPart;
6072      return this;
6073    }
6074
6075    public boolean hasHasPart() { 
6076      if (this.hasPart == null)
6077        return false;
6078      for (DeviceDefinitionHasPartComponent item : this.hasPart)
6079        if (!item.isEmpty())
6080          return true;
6081      return false;
6082    }
6083
6084    public DeviceDefinitionHasPartComponent addHasPart() { //3
6085      DeviceDefinitionHasPartComponent t = new DeviceDefinitionHasPartComponent();
6086      if (this.hasPart == null)
6087        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6088      this.hasPart.add(t);
6089      return t;
6090    }
6091
6092    public DeviceDefinition addHasPart(DeviceDefinitionHasPartComponent t) { //3
6093      if (t == null)
6094        return this;
6095      if (this.hasPart == null)
6096        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6097      this.hasPart.add(t);
6098      return this;
6099    }
6100
6101    /**
6102     * @return The first repetition of repeating field {@link #hasPart}, creating it if it does not already exist {3}
6103     */
6104    public DeviceDefinitionHasPartComponent getHasPartFirstRep() { 
6105      if (getHasPart().isEmpty()) {
6106        addHasPart();
6107      }
6108      return getHasPart().get(0);
6109    }
6110
6111    /**
6112     * @return {@link #packaging} (Information about the packaging of the device, i.e. how the device is packaged.)
6113     */
6114    public List<DeviceDefinitionPackagingComponent> getPackaging() { 
6115      if (this.packaging == null)
6116        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6117      return this.packaging;
6118    }
6119
6120    /**
6121     * @return Returns a reference to <code>this</code> for easy method chaining
6122     */
6123    public DeviceDefinition setPackaging(List<DeviceDefinitionPackagingComponent> thePackaging) { 
6124      this.packaging = thePackaging;
6125      return this;
6126    }
6127
6128    public boolean hasPackaging() { 
6129      if (this.packaging == null)
6130        return false;
6131      for (DeviceDefinitionPackagingComponent item : this.packaging)
6132        if (!item.isEmpty())
6133          return true;
6134      return false;
6135    }
6136
6137    public DeviceDefinitionPackagingComponent addPackaging() { //3
6138      DeviceDefinitionPackagingComponent t = new DeviceDefinitionPackagingComponent();
6139      if (this.packaging == null)
6140        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6141      this.packaging.add(t);
6142      return t;
6143    }
6144
6145    public DeviceDefinition addPackaging(DeviceDefinitionPackagingComponent t) { //3
6146      if (t == null)
6147        return this;
6148      if (this.packaging == null)
6149        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6150      this.packaging.add(t);
6151      return this;
6152    }
6153
6154    /**
6155     * @return The first repetition of repeating field {@link #packaging}, creating it if it does not already exist {3}
6156     */
6157    public DeviceDefinitionPackagingComponent getPackagingFirstRep() { 
6158      if (getPackaging().isEmpty()) {
6159        addPackaging();
6160      }
6161      return getPackaging().get(0);
6162    }
6163
6164    /**
6165     * @return {@link #version} (The version of the device or software.)
6166     */
6167    public List<DeviceDefinitionVersionComponent> getVersion() { 
6168      if (this.version == null)
6169        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6170      return this.version;
6171    }
6172
6173    /**
6174     * @return Returns a reference to <code>this</code> for easy method chaining
6175     */
6176    public DeviceDefinition setVersion(List<DeviceDefinitionVersionComponent> theVersion) { 
6177      this.version = theVersion;
6178      return this;
6179    }
6180
6181    public boolean hasVersion() { 
6182      if (this.version == null)
6183        return false;
6184      for (DeviceDefinitionVersionComponent item : this.version)
6185        if (!item.isEmpty())
6186          return true;
6187      return false;
6188    }
6189
6190    public DeviceDefinitionVersionComponent addVersion() { //3
6191      DeviceDefinitionVersionComponent t = new DeviceDefinitionVersionComponent();
6192      if (this.version == null)
6193        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6194      this.version.add(t);
6195      return t;
6196    }
6197
6198    public DeviceDefinition addVersion(DeviceDefinitionVersionComponent t) { //3
6199      if (t == null)
6200        return this;
6201      if (this.version == null)
6202        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6203      this.version.add(t);
6204      return this;
6205    }
6206
6207    /**
6208     * @return The first repetition of repeating field {@link #version}, creating it if it does not already exist {3}
6209     */
6210    public DeviceDefinitionVersionComponent getVersionFirstRep() { 
6211      if (getVersion().isEmpty()) {
6212        addVersion();
6213      }
6214      return getVersion().get(0);
6215    }
6216
6217    /**
6218     * @return {@link #safety} (Safety characteristics of the device.)
6219     */
6220    public List<CodeableConcept> getSafety() { 
6221      if (this.safety == null)
6222        this.safety = new ArrayList<CodeableConcept>();
6223      return this.safety;
6224    }
6225
6226    /**
6227     * @return Returns a reference to <code>this</code> for easy method chaining
6228     */
6229    public DeviceDefinition setSafety(List<CodeableConcept> theSafety) { 
6230      this.safety = theSafety;
6231      return this;
6232    }
6233
6234    public boolean hasSafety() { 
6235      if (this.safety == null)
6236        return false;
6237      for (CodeableConcept item : this.safety)
6238        if (!item.isEmpty())
6239          return true;
6240      return false;
6241    }
6242
6243    public CodeableConcept addSafety() { //3
6244      CodeableConcept t = new CodeableConcept();
6245      if (this.safety == null)
6246        this.safety = new ArrayList<CodeableConcept>();
6247      this.safety.add(t);
6248      return t;
6249    }
6250
6251    public DeviceDefinition addSafety(CodeableConcept t) { //3
6252      if (t == null)
6253        return this;
6254      if (this.safety == null)
6255        this.safety = new ArrayList<CodeableConcept>();
6256      this.safety.add(t);
6257      return this;
6258    }
6259
6260    /**
6261     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist {3}
6262     */
6263    public CodeableConcept getSafetyFirstRep() { 
6264      if (getSafety().isEmpty()) {
6265        addSafety();
6266      }
6267      return getSafety().get(0);
6268    }
6269
6270    /**
6271     * @return {@link #shelfLifeStorage} (Shelf Life and storage information.)
6272     */
6273    public List<ProductShelfLife> getShelfLifeStorage() { 
6274      if (this.shelfLifeStorage == null)
6275        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6276      return this.shelfLifeStorage;
6277    }
6278
6279    /**
6280     * @return Returns a reference to <code>this</code> for easy method chaining
6281     */
6282    public DeviceDefinition setShelfLifeStorage(List<ProductShelfLife> theShelfLifeStorage) { 
6283      this.shelfLifeStorage = theShelfLifeStorage;
6284      return this;
6285    }
6286
6287    public boolean hasShelfLifeStorage() { 
6288      if (this.shelfLifeStorage == null)
6289        return false;
6290      for (ProductShelfLife item : this.shelfLifeStorage)
6291        if (!item.isEmpty())
6292          return true;
6293      return false;
6294    }
6295
6296    public ProductShelfLife addShelfLifeStorage() { //3
6297      ProductShelfLife t = new ProductShelfLife();
6298      if (this.shelfLifeStorage == null)
6299        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6300      this.shelfLifeStorage.add(t);
6301      return t;
6302    }
6303
6304    public DeviceDefinition addShelfLifeStorage(ProductShelfLife t) { //3
6305      if (t == null)
6306        return this;
6307      if (this.shelfLifeStorage == null)
6308        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6309      this.shelfLifeStorage.add(t);
6310      return this;
6311    }
6312
6313    /**
6314     * @return The first repetition of repeating field {@link #shelfLifeStorage}, creating it if it does not already exist {3}
6315     */
6316    public ProductShelfLife getShelfLifeStorageFirstRep() { 
6317      if (getShelfLifeStorage().isEmpty()) {
6318        addShelfLifeStorage();
6319      }
6320      return getShelfLifeStorage().get(0);
6321    }
6322
6323    /**
6324     * @return {@link #languageCode} (Language code for the human-readable text strings produced by the device (all supported).)
6325     */
6326    public List<CodeableConcept> getLanguageCode() { 
6327      if (this.languageCode == null)
6328        this.languageCode = new ArrayList<CodeableConcept>();
6329      return this.languageCode;
6330    }
6331
6332    /**
6333     * @return Returns a reference to <code>this</code> for easy method chaining
6334     */
6335    public DeviceDefinition setLanguageCode(List<CodeableConcept> theLanguageCode) { 
6336      this.languageCode = theLanguageCode;
6337      return this;
6338    }
6339
6340    public boolean hasLanguageCode() { 
6341      if (this.languageCode == null)
6342        return false;
6343      for (CodeableConcept item : this.languageCode)
6344        if (!item.isEmpty())
6345          return true;
6346      return false;
6347    }
6348
6349    public CodeableConcept addLanguageCode() { //3
6350      CodeableConcept t = new CodeableConcept();
6351      if (this.languageCode == null)
6352        this.languageCode = new ArrayList<CodeableConcept>();
6353      this.languageCode.add(t);
6354      return t;
6355    }
6356
6357    public DeviceDefinition addLanguageCode(CodeableConcept t) { //3
6358      if (t == null)
6359        return this;
6360      if (this.languageCode == null)
6361        this.languageCode = new ArrayList<CodeableConcept>();
6362      this.languageCode.add(t);
6363      return this;
6364    }
6365
6366    /**
6367     * @return The first repetition of repeating field {@link #languageCode}, creating it if it does not already exist {3}
6368     */
6369    public CodeableConcept getLanguageCodeFirstRep() { 
6370      if (getLanguageCode().isEmpty()) {
6371        addLanguageCode();
6372      }
6373      return getLanguageCode().get(0);
6374    }
6375
6376    /**
6377     * @return {@link #property} (The potential, valid configuration settings of a device, e.g., regulation status, time properties.)
6378     */
6379    public List<DeviceDefinitionPropertyComponent> getProperty() { 
6380      if (this.property == null)
6381        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
6382      return this.property;
6383    }
6384
6385    /**
6386     * @return Returns a reference to <code>this</code> for easy method chaining
6387     */
6388    public DeviceDefinition setProperty(List<DeviceDefinitionPropertyComponent> theProperty) { 
6389      this.property = theProperty;
6390      return this;
6391    }
6392
6393    public boolean hasProperty() { 
6394      if (this.property == null)
6395        return false;
6396      for (DeviceDefinitionPropertyComponent item : this.property)
6397        if (!item.isEmpty())
6398          return true;
6399      return false;
6400    }
6401
6402    public DeviceDefinitionPropertyComponent addProperty() { //3
6403      DeviceDefinitionPropertyComponent t = new DeviceDefinitionPropertyComponent();
6404      if (this.property == null)
6405        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
6406      this.property.add(t);
6407      return t;
6408    }
6409
6410    public DeviceDefinition addProperty(DeviceDefinitionPropertyComponent t) { //3
6411      if (t == null)
6412        return this;
6413      if (this.property == null)
6414        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
6415      this.property.add(t);
6416      return this;
6417    }
6418
6419    /**
6420     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
6421     */
6422    public DeviceDefinitionPropertyComponent getPropertyFirstRep() { 
6423      if (getProperty().isEmpty()) {
6424        addProperty();
6425      }
6426      return getProperty().get(0);
6427    }
6428
6429    /**
6430     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
6431     */
6432    public Reference getOwner() { 
6433      if (this.owner == null)
6434        if (Configuration.errorOnAutoCreate())
6435          throw new Error("Attempt to auto-create DeviceDefinition.owner");
6436        else if (Configuration.doAutoCreate())
6437          this.owner = new Reference(); // cc
6438      return this.owner;
6439    }
6440
6441    public boolean hasOwner() { 
6442      return this.owner != null && !this.owner.isEmpty();
6443    }
6444
6445    /**
6446     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
6447     */
6448    public DeviceDefinition setOwner(Reference value) { 
6449      this.owner = value;
6450      return this;
6451    }
6452
6453    /**
6454     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
6455     */
6456    public List<ContactPoint> getContact() { 
6457      if (this.contact == null)
6458        this.contact = new ArrayList<ContactPoint>();
6459      return this.contact;
6460    }
6461
6462    /**
6463     * @return Returns a reference to <code>this</code> for easy method chaining
6464     */
6465    public DeviceDefinition setContact(List<ContactPoint> theContact) { 
6466      this.contact = theContact;
6467      return this;
6468    }
6469
6470    public boolean hasContact() { 
6471      if (this.contact == null)
6472        return false;
6473      for (ContactPoint item : this.contact)
6474        if (!item.isEmpty())
6475          return true;
6476      return false;
6477    }
6478
6479    public ContactPoint addContact() { //3
6480      ContactPoint t = new ContactPoint();
6481      if (this.contact == null)
6482        this.contact = new ArrayList<ContactPoint>();
6483      this.contact.add(t);
6484      return t;
6485    }
6486
6487    public DeviceDefinition addContact(ContactPoint t) { //3
6488      if (t == null)
6489        return this;
6490      if (this.contact == null)
6491        this.contact = new ArrayList<ContactPoint>();
6492      this.contact.add(t);
6493      return this;
6494    }
6495
6496    /**
6497     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
6498     */
6499    public ContactPoint getContactFirstRep() { 
6500      if (getContact().isEmpty()) {
6501        addContact();
6502      }
6503      return getContact().get(0);
6504    }
6505
6506    /**
6507     * @return {@link #link} (An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.)
6508     */
6509    public List<DeviceDefinitionLinkComponent> getLink() { 
6510      if (this.link == null)
6511        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
6512      return this.link;
6513    }
6514
6515    /**
6516     * @return Returns a reference to <code>this</code> for easy method chaining
6517     */
6518    public DeviceDefinition setLink(List<DeviceDefinitionLinkComponent> theLink) { 
6519      this.link = theLink;
6520      return this;
6521    }
6522
6523    public boolean hasLink() { 
6524      if (this.link == null)
6525        return false;
6526      for (DeviceDefinitionLinkComponent item : this.link)
6527        if (!item.isEmpty())
6528          return true;
6529      return false;
6530    }
6531
6532    public DeviceDefinitionLinkComponent addLink() { //3
6533      DeviceDefinitionLinkComponent t = new DeviceDefinitionLinkComponent();
6534      if (this.link == null)
6535        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
6536      this.link.add(t);
6537      return t;
6538    }
6539
6540    public DeviceDefinition addLink(DeviceDefinitionLinkComponent t) { //3
6541      if (t == null)
6542        return this;
6543      if (this.link == null)
6544        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
6545      this.link.add(t);
6546      return this;
6547    }
6548
6549    /**
6550     * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist {3}
6551     */
6552    public DeviceDefinitionLinkComponent getLinkFirstRep() { 
6553      if (getLink().isEmpty()) {
6554        addLink();
6555      }
6556      return getLink().get(0);
6557    }
6558
6559    /**
6560     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
6561     */
6562    public List<Annotation> getNote() { 
6563      if (this.note == null)
6564        this.note = new ArrayList<Annotation>();
6565      return this.note;
6566    }
6567
6568    /**
6569     * @return Returns a reference to <code>this</code> for easy method chaining
6570     */
6571    public DeviceDefinition setNote(List<Annotation> theNote) { 
6572      this.note = theNote;
6573      return this;
6574    }
6575
6576    public boolean hasNote() { 
6577      if (this.note == null)
6578        return false;
6579      for (Annotation item : this.note)
6580        if (!item.isEmpty())
6581          return true;
6582      return false;
6583    }
6584
6585    public Annotation addNote() { //3
6586      Annotation t = new Annotation();
6587      if (this.note == null)
6588        this.note = new ArrayList<Annotation>();
6589      this.note.add(t);
6590      return t;
6591    }
6592
6593    public DeviceDefinition addNote(Annotation t) { //3
6594      if (t == null)
6595        return this;
6596      if (this.note == null)
6597        this.note = new ArrayList<Annotation>();
6598      this.note.add(t);
6599      return this;
6600    }
6601
6602    /**
6603     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
6604     */
6605    public Annotation getNoteFirstRep() { 
6606      if (getNote().isEmpty()) {
6607        addNote();
6608      }
6609      return getNote().get(0);
6610    }
6611
6612    /**
6613     * @return {@link #parentDevice} (The parent device it can be part of.)
6614     */
6615    public Reference getParentDevice() { 
6616      if (this.parentDevice == null)
6617        if (Configuration.errorOnAutoCreate())
6618          throw new Error("Attempt to auto-create DeviceDefinition.parentDevice");
6619        else if (Configuration.doAutoCreate())
6620          this.parentDevice = new Reference(); // cc
6621      return this.parentDevice;
6622    }
6623
6624    public boolean hasParentDevice() { 
6625      return this.parentDevice != null && !this.parentDevice.isEmpty();
6626    }
6627
6628    /**
6629     * @param value {@link #parentDevice} (The parent device it can be part of.)
6630     */
6631    public DeviceDefinition setParentDevice(Reference value) { 
6632      this.parentDevice = value;
6633      return this;
6634    }
6635
6636    /**
6637     * @return {@link #material} (A substance used to create the material(s) of which the device is made.)
6638     */
6639    public List<DeviceDefinitionMaterialComponent> getMaterial() { 
6640      if (this.material == null)
6641        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
6642      return this.material;
6643    }
6644
6645    /**
6646     * @return Returns a reference to <code>this</code> for easy method chaining
6647     */
6648    public DeviceDefinition setMaterial(List<DeviceDefinitionMaterialComponent> theMaterial) { 
6649      this.material = theMaterial;
6650      return this;
6651    }
6652
6653    public boolean hasMaterial() { 
6654      if (this.material == null)
6655        return false;
6656      for (DeviceDefinitionMaterialComponent item : this.material)
6657        if (!item.isEmpty())
6658          return true;
6659      return false;
6660    }
6661
6662    public DeviceDefinitionMaterialComponent addMaterial() { //3
6663      DeviceDefinitionMaterialComponent t = new DeviceDefinitionMaterialComponent();
6664      if (this.material == null)
6665        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
6666      this.material.add(t);
6667      return t;
6668    }
6669
6670    public DeviceDefinition addMaterial(DeviceDefinitionMaterialComponent t) { //3
6671      if (t == null)
6672        return this;
6673      if (this.material == null)
6674        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
6675      this.material.add(t);
6676      return this;
6677    }
6678
6679    /**
6680     * @return The first repetition of repeating field {@link #material}, creating it if it does not already exist {3}
6681     */
6682    public DeviceDefinitionMaterialComponent getMaterialFirstRep() { 
6683      if (getMaterial().isEmpty()) {
6684        addMaterial();
6685      }
6686      return getMaterial().get(0);
6687    }
6688
6689    /**
6690     * @return {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
6691     */
6692    public List<Enumeration<DeviceProductionIdentifierInUDI>> getProductionIdentifierInUDI() { 
6693      if (this.productionIdentifierInUDI == null)
6694        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
6695      return this.productionIdentifierInUDI;
6696    }
6697
6698    /**
6699     * @return Returns a reference to <code>this</code> for easy method chaining
6700     */
6701    public DeviceDefinition setProductionIdentifierInUDI(List<Enumeration<DeviceProductionIdentifierInUDI>> theProductionIdentifierInUDI) { 
6702      this.productionIdentifierInUDI = theProductionIdentifierInUDI;
6703      return this;
6704    }
6705
6706    public boolean hasProductionIdentifierInUDI() { 
6707      if (this.productionIdentifierInUDI == null)
6708        return false;
6709      for (Enumeration<DeviceProductionIdentifierInUDI> item : this.productionIdentifierInUDI)
6710        if (!item.isEmpty())
6711          return true;
6712      return false;
6713    }
6714
6715    /**
6716     * @return {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
6717     */
6718    public Enumeration<DeviceProductionIdentifierInUDI> addProductionIdentifierInUDIElement() {//2 
6719      Enumeration<DeviceProductionIdentifierInUDI> t = new Enumeration<DeviceProductionIdentifierInUDI>(new DeviceProductionIdentifierInUDIEnumFactory());
6720      if (this.productionIdentifierInUDI == null)
6721        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
6722      this.productionIdentifierInUDI.add(t);
6723      return t;
6724    }
6725
6726    /**
6727     * @param value {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
6728     */
6729    public DeviceDefinition addProductionIdentifierInUDI(DeviceProductionIdentifierInUDI value) { //1
6730      Enumeration<DeviceProductionIdentifierInUDI> t = new Enumeration<DeviceProductionIdentifierInUDI>(new DeviceProductionIdentifierInUDIEnumFactory());
6731      t.setValue(value);
6732      if (this.productionIdentifierInUDI == null)
6733        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
6734      this.productionIdentifierInUDI.add(t);
6735      return this;
6736    }
6737
6738    /**
6739     * @param value {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
6740     */
6741    public boolean hasProductionIdentifierInUDI(DeviceProductionIdentifierInUDI value) { 
6742      if (this.productionIdentifierInUDI == null)
6743        return false;
6744      for (Enumeration<DeviceProductionIdentifierInUDI> v : this.productionIdentifierInUDI)
6745        if (v.getValue().equals(value)) // code
6746          return true;
6747      return false;
6748    }
6749
6750    /**
6751     * @return {@link #guideline} (Information aimed at providing directions for the usage of this model of device.)
6752     */
6753    public DeviceDefinitionGuidelineComponent getGuideline() { 
6754      if (this.guideline == null)
6755        if (Configuration.errorOnAutoCreate())
6756          throw new Error("Attempt to auto-create DeviceDefinition.guideline");
6757        else if (Configuration.doAutoCreate())
6758          this.guideline = new DeviceDefinitionGuidelineComponent(); // cc
6759      return this.guideline;
6760    }
6761
6762    public boolean hasGuideline() { 
6763      return this.guideline != null && !this.guideline.isEmpty();
6764    }
6765
6766    /**
6767     * @param value {@link #guideline} (Information aimed at providing directions for the usage of this model of device.)
6768     */
6769    public DeviceDefinition setGuideline(DeviceDefinitionGuidelineComponent value) { 
6770      this.guideline = value;
6771      return this;
6772    }
6773
6774    /**
6775     * @return {@link #correctiveAction} (Tracking of latest field safety corrective action.)
6776     */
6777    public DeviceDefinitionCorrectiveActionComponent getCorrectiveAction() { 
6778      if (this.correctiveAction == null)
6779        if (Configuration.errorOnAutoCreate())
6780          throw new Error("Attempt to auto-create DeviceDefinition.correctiveAction");
6781        else if (Configuration.doAutoCreate())
6782          this.correctiveAction = new DeviceDefinitionCorrectiveActionComponent(); // cc
6783      return this.correctiveAction;
6784    }
6785
6786    public boolean hasCorrectiveAction() { 
6787      return this.correctiveAction != null && !this.correctiveAction.isEmpty();
6788    }
6789
6790    /**
6791     * @param value {@link #correctiveAction} (Tracking of latest field safety corrective action.)
6792     */
6793    public DeviceDefinition setCorrectiveAction(DeviceDefinitionCorrectiveActionComponent value) { 
6794      this.correctiveAction = value;
6795      return this;
6796    }
6797
6798    /**
6799     * @return {@link #chargeItem} (Billing code or reference associated with the device.)
6800     */
6801    public List<DeviceDefinitionChargeItemComponent> getChargeItem() { 
6802      if (this.chargeItem == null)
6803        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
6804      return this.chargeItem;
6805    }
6806
6807    /**
6808     * @return Returns a reference to <code>this</code> for easy method chaining
6809     */
6810    public DeviceDefinition setChargeItem(List<DeviceDefinitionChargeItemComponent> theChargeItem) { 
6811      this.chargeItem = theChargeItem;
6812      return this;
6813    }
6814
6815    public boolean hasChargeItem() { 
6816      if (this.chargeItem == null)
6817        return false;
6818      for (DeviceDefinitionChargeItemComponent item : this.chargeItem)
6819        if (!item.isEmpty())
6820          return true;
6821      return false;
6822    }
6823
6824    public DeviceDefinitionChargeItemComponent addChargeItem() { //3
6825      DeviceDefinitionChargeItemComponent t = new DeviceDefinitionChargeItemComponent();
6826      if (this.chargeItem == null)
6827        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
6828      this.chargeItem.add(t);
6829      return t;
6830    }
6831
6832    public DeviceDefinition addChargeItem(DeviceDefinitionChargeItemComponent t) { //3
6833      if (t == null)
6834        return this;
6835      if (this.chargeItem == null)
6836        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
6837      this.chargeItem.add(t);
6838      return this;
6839    }
6840
6841    /**
6842     * @return The first repetition of repeating field {@link #chargeItem}, creating it if it does not already exist {3}
6843     */
6844    public DeviceDefinitionChargeItemComponent getChargeItemFirstRep() { 
6845      if (getChargeItem().isEmpty()) {
6846        addChargeItem();
6847      }
6848      return getChargeItem().get(0);
6849    }
6850
6851      protected void listChildren(List<Property> children) {
6852        super.listChildren(children);
6853        children.add(new Property("description", "markdown", "Additional information to describe the device.", 0, 1, description));
6854        children.add(new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.", 0, java.lang.Integer.MAX_VALUE, identifier));
6855        children.add(new Property("udiDeviceIdentifier", "", "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, udiDeviceIdentifier));
6856        children.add(new Property("regulatoryIdentifier", "", "Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.", 0, java.lang.Integer.MAX_VALUE, regulatoryIdentifier));
6857        children.add(new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber));
6858        children.add(new Property("manufacturer", "Reference(Organization)", "A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.", 0, 1, manufacturer));
6859        children.add(new Property("deviceName", "", "The name or names of the device as given by the manufacturer.", 0, java.lang.Integer.MAX_VALUE, deviceName));
6860        children.add(new Property("modelNumber", "string", "The model number for the device for example as defined by the manufacturer or labeler, or other agency.", 0, 1, modelNumber));
6861        children.add(new Property("classification", "", "What kind of device or device system this is.", 0, java.lang.Integer.MAX_VALUE, classification));
6862        children.add(new Property("specialization", "RelatedArtifact", "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));
6863        children.add(new Property("hasPart", "", "A device that is part (for example a component) of the present device.", 0, java.lang.Integer.MAX_VALUE, hasPart));
6864        children.add(new Property("packaging", "", "Information about the packaging of the device, i.e. how the device is packaged.", 0, java.lang.Integer.MAX_VALUE, packaging));
6865        children.add(new Property("version", "", "The version of the device or software.", 0, java.lang.Integer.MAX_VALUE, version));
6866        children.add(new Property("safety", "CodeableConcept", "Safety characteristics of the device.", 0, java.lang.Integer.MAX_VALUE, safety));
6867        children.add(new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage));
6868        children.add(new Property("languageCode", "CodeableConcept", "Language code for the human-readable text strings produced by the device (all supported).", 0, java.lang.Integer.MAX_VALUE, languageCode));
6869        children.add(new Property("property", "", "The potential, valid configuration settings of a device, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property));
6870        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
6871        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));
6872        children.add(new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link));
6873        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));
6874        children.add(new Property("parentDevice", "Reference(DeviceDefinition)", "The parent device it can be part of.", 0, 1, parentDevice));
6875        children.add(new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material));
6876        children.add(new Property("productionIdentifierInUDI", "code", "Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.", 0, java.lang.Integer.MAX_VALUE, productionIdentifierInUDI));
6877        children.add(new Property("guideline", "", "Information aimed at providing directions for the usage of this model of device.", 0, 1, guideline));
6878        children.add(new Property("correctiveAction", "", "Tracking of latest field safety corrective action.", 0, 1, correctiveAction));
6879        children.add(new Property("chargeItem", "", "Billing code or reference associated with the device.", 0, java.lang.Integer.MAX_VALUE, chargeItem));
6880      }
6881
6882      @Override
6883      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6884        switch (_hash) {
6885        case -1724546052: /*description*/  return new Property("description", "markdown", "Additional information to describe the device.", 0, 1, description);
6886        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.", 0, java.lang.Integer.MAX_VALUE, identifier);
6887        case -99121287: /*udiDeviceIdentifier*/  return new Property("udiDeviceIdentifier", "", "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, udiDeviceIdentifier);
6888        case 455683425: /*regulatoryIdentifier*/  return new Property("regulatoryIdentifier", "", "Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.", 0, java.lang.Integer.MAX_VALUE, regulatoryIdentifier);
6889        case -731502308: /*partNumber*/  return new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber);
6890        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.", 0, 1, manufacturer);
6891        case 780988929: /*deviceName*/  return new Property("deviceName", "", "The name or names of the device as given by the manufacturer.", 0, java.lang.Integer.MAX_VALUE, deviceName);
6892        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "The model number for the device for example as defined by the manufacturer or labeler, or other agency.", 0, 1, modelNumber);
6893        case 382350310: /*classification*/  return new Property("classification", "", "What kind of device or device system this is.", 0, java.lang.Integer.MAX_VALUE, classification);
6894        case 682815883: /*specialization*/  return new Property("specialization", "RelatedArtifact", "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);
6895        case 696815021: /*hasPart*/  return new Property("hasPart", "", "A device that is part (for example a component) of the present device.", 0, java.lang.Integer.MAX_VALUE, hasPart);
6896        case 1802065795: /*packaging*/  return new Property("packaging", "", "Information about the packaging of the device, i.e. how the device is packaged.", 0, java.lang.Integer.MAX_VALUE, packaging);
6897        case 351608024: /*version*/  return new Property("version", "", "The version of the device or software.", 0, java.lang.Integer.MAX_VALUE, version);
6898        case -909893934: /*safety*/  return new Property("safety", "CodeableConcept", "Safety characteristics of the device.", 0, java.lang.Integer.MAX_VALUE, safety);
6899        case 172049237: /*shelfLifeStorage*/  return new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage);
6900        case -2092349083: /*languageCode*/  return new Property("languageCode", "CodeableConcept", "Language code for the human-readable text strings produced by the device (all supported).", 0, java.lang.Integer.MAX_VALUE, languageCode);
6901        case -993141291: /*property*/  return new Property("property", "", "The potential, valid configuration settings of a device, e.g., regulation status, time properties.", 0, java.lang.Integer.MAX_VALUE, property);
6902        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);
6903        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);
6904        case 3321850: /*link*/  return new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link);
6905        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);
6906        case 620260256: /*parentDevice*/  return new Property("parentDevice", "Reference(DeviceDefinition)", "The parent device it can be part of.", 0, 1, parentDevice);
6907        case 299066663: /*material*/  return new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material);
6908        case 312405811: /*productionIdentifierInUDI*/  return new Property("productionIdentifierInUDI", "code", "Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.", 0, java.lang.Integer.MAX_VALUE, productionIdentifierInUDI);
6909        case -2075718416: /*guideline*/  return new Property("guideline", "", "Information aimed at providing directions for the usage of this model of device.", 0, 1, guideline);
6910        case 1354575876: /*correctiveAction*/  return new Property("correctiveAction", "", "Tracking of latest field safety corrective action.", 0, 1, correctiveAction);
6911        case 1417779175: /*chargeItem*/  return new Property("chargeItem", "", "Billing code or reference associated with the device.", 0, java.lang.Integer.MAX_VALUE, chargeItem);
6912        default: return super.getNamedProperty(_hash, _name, _checkValid);
6913        }
6914
6915      }
6916
6917      @Override
6918      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6919        switch (hash) {
6920        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
6921        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
6922        case -99121287: /*udiDeviceIdentifier*/ return this.udiDeviceIdentifier == null ? new Base[0] : this.udiDeviceIdentifier.toArray(new Base[this.udiDeviceIdentifier.size()]); // DeviceDefinitionUdiDeviceIdentifierComponent
6923        case 455683425: /*regulatoryIdentifier*/ return this.regulatoryIdentifier == null ? new Base[0] : this.regulatoryIdentifier.toArray(new Base[this.regulatoryIdentifier.size()]); // DeviceDefinitionRegulatoryIdentifierComponent
6924        case -731502308: /*partNumber*/ return this.partNumber == null ? new Base[0] : new Base[] {this.partNumber}; // StringType
6925        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
6926        case 780988929: /*deviceName*/ return this.deviceName == null ? new Base[0] : this.deviceName.toArray(new Base[this.deviceName.size()]); // DeviceDefinitionDeviceNameComponent
6927        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
6928        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // DeviceDefinitionClassificationComponent
6929        case 682815883: /*specialization*/ return this.specialization == null ? new Base[0] : this.specialization.toArray(new Base[this.specialization.size()]); // RelatedArtifact
6930        case 696815021: /*hasPart*/ return this.hasPart == null ? new Base[0] : this.hasPart.toArray(new Base[this.hasPart.size()]); // DeviceDefinitionHasPartComponent
6931        case 1802065795: /*packaging*/ return this.packaging == null ? new Base[0] : this.packaging.toArray(new Base[this.packaging.size()]); // DeviceDefinitionPackagingComponent
6932        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // DeviceDefinitionVersionComponent
6933        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
6934        case 172049237: /*shelfLifeStorage*/ return this.shelfLifeStorage == null ? new Base[0] : this.shelfLifeStorage.toArray(new Base[this.shelfLifeStorage.size()]); // ProductShelfLife
6935        case -2092349083: /*languageCode*/ return this.languageCode == null ? new Base[0] : this.languageCode.toArray(new Base[this.languageCode.size()]); // CodeableConcept
6936        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // DeviceDefinitionPropertyComponent
6937        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
6938        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
6939        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // DeviceDefinitionLinkComponent
6940        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
6941        case 620260256: /*parentDevice*/ return this.parentDevice == null ? new Base[0] : new Base[] {this.parentDevice}; // Reference
6942        case 299066663: /*material*/ return this.material == null ? new Base[0] : this.material.toArray(new Base[this.material.size()]); // DeviceDefinitionMaterialComponent
6943        case 312405811: /*productionIdentifierInUDI*/ return this.productionIdentifierInUDI == null ? new Base[0] : this.productionIdentifierInUDI.toArray(new Base[this.productionIdentifierInUDI.size()]); // Enumeration<DeviceProductionIdentifierInUDI>
6944        case -2075718416: /*guideline*/ return this.guideline == null ? new Base[0] : new Base[] {this.guideline}; // DeviceDefinitionGuidelineComponent
6945        case 1354575876: /*correctiveAction*/ return this.correctiveAction == null ? new Base[0] : new Base[] {this.correctiveAction}; // DeviceDefinitionCorrectiveActionComponent
6946        case 1417779175: /*chargeItem*/ return this.chargeItem == null ? new Base[0] : this.chargeItem.toArray(new Base[this.chargeItem.size()]); // DeviceDefinitionChargeItemComponent
6947        default: return super.getProperty(hash, name, checkValid);
6948        }
6949
6950      }
6951
6952      @Override
6953      public Base setProperty(int hash, String name, Base value) throws FHIRException {
6954        switch (hash) {
6955        case -1724546052: // description
6956          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
6957          return value;
6958        case -1618432855: // identifier
6959          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
6960          return value;
6961        case -99121287: // udiDeviceIdentifier
6962          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value); // DeviceDefinitionUdiDeviceIdentifierComponent
6963          return value;
6964        case 455683425: // regulatoryIdentifier
6965          this.getRegulatoryIdentifier().add((DeviceDefinitionRegulatoryIdentifierComponent) value); // DeviceDefinitionRegulatoryIdentifierComponent
6966          return value;
6967        case -731502308: // partNumber
6968          this.partNumber = TypeConvertor.castToString(value); // StringType
6969          return value;
6970        case -1969347631: // manufacturer
6971          this.manufacturer = TypeConvertor.castToReference(value); // Reference
6972          return value;
6973        case 780988929: // deviceName
6974          this.getDeviceName().add((DeviceDefinitionDeviceNameComponent) value); // DeviceDefinitionDeviceNameComponent
6975          return value;
6976        case 346619858: // modelNumber
6977          this.modelNumber = TypeConvertor.castToString(value); // StringType
6978          return value;
6979        case 382350310: // classification
6980          this.getClassification().add((DeviceDefinitionClassificationComponent) value); // DeviceDefinitionClassificationComponent
6981          return value;
6982        case 682815883: // specialization
6983          this.getSpecialization().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
6984          return value;
6985        case 696815021: // hasPart
6986          this.getHasPart().add((DeviceDefinitionHasPartComponent) value); // DeviceDefinitionHasPartComponent
6987          return value;
6988        case 1802065795: // packaging
6989          this.getPackaging().add((DeviceDefinitionPackagingComponent) value); // DeviceDefinitionPackagingComponent
6990          return value;
6991        case 351608024: // version
6992          this.getVersion().add((DeviceDefinitionVersionComponent) value); // DeviceDefinitionVersionComponent
6993          return value;
6994        case -909893934: // safety
6995          this.getSafety().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
6996          return value;
6997        case 172049237: // shelfLifeStorage
6998          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value)); // ProductShelfLife
6999          return value;
7000        case -2092349083: // languageCode
7001          this.getLanguageCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7002          return value;
7003        case -993141291: // property
7004          this.getProperty().add((DeviceDefinitionPropertyComponent) value); // DeviceDefinitionPropertyComponent
7005          return value;
7006        case 106164915: // owner
7007          this.owner = TypeConvertor.castToReference(value); // Reference
7008          return value;
7009        case 951526432: // contact
7010          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
7011          return value;
7012        case 3321850: // link
7013          this.getLink().add((DeviceDefinitionLinkComponent) value); // DeviceDefinitionLinkComponent
7014          return value;
7015        case 3387378: // note
7016          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
7017          return value;
7018        case 620260256: // parentDevice
7019          this.parentDevice = TypeConvertor.castToReference(value); // Reference
7020          return value;
7021        case 299066663: // material
7022          this.getMaterial().add((DeviceDefinitionMaterialComponent) value); // DeviceDefinitionMaterialComponent
7023          return value;
7024        case 312405811: // productionIdentifierInUDI
7025          value = new DeviceProductionIdentifierInUDIEnumFactory().fromType(TypeConvertor.castToCode(value));
7026          this.getProductionIdentifierInUDI().add((Enumeration) value); // Enumeration<DeviceProductionIdentifierInUDI>
7027          return value;
7028        case -2075718416: // guideline
7029          this.guideline = (DeviceDefinitionGuidelineComponent) value; // DeviceDefinitionGuidelineComponent
7030          return value;
7031        case 1354575876: // correctiveAction
7032          this.correctiveAction = (DeviceDefinitionCorrectiveActionComponent) value; // DeviceDefinitionCorrectiveActionComponent
7033          return value;
7034        case 1417779175: // chargeItem
7035          this.getChargeItem().add((DeviceDefinitionChargeItemComponent) value); // DeviceDefinitionChargeItemComponent
7036          return value;
7037        default: return super.setProperty(hash, name, value);
7038        }
7039
7040      }
7041
7042      @Override
7043      public Base setProperty(String name, Base value) throws FHIRException {
7044        if (name.equals("description")) {
7045          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
7046        } else if (name.equals("identifier")) {
7047          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
7048        } else if (name.equals("udiDeviceIdentifier")) {
7049          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value);
7050        } else if (name.equals("regulatoryIdentifier")) {
7051          this.getRegulatoryIdentifier().add((DeviceDefinitionRegulatoryIdentifierComponent) value);
7052        } else if (name.equals("partNumber")) {
7053          this.partNumber = TypeConvertor.castToString(value); // StringType
7054        } else if (name.equals("manufacturer")) {
7055          this.manufacturer = TypeConvertor.castToReference(value); // Reference
7056        } else if (name.equals("deviceName")) {
7057          this.getDeviceName().add((DeviceDefinitionDeviceNameComponent) value);
7058        } else if (name.equals("modelNumber")) {
7059          this.modelNumber = TypeConvertor.castToString(value); // StringType
7060        } else if (name.equals("classification")) {
7061          this.getClassification().add((DeviceDefinitionClassificationComponent) value);
7062        } else if (name.equals("specialization")) {
7063          this.getSpecialization().add(TypeConvertor.castToRelatedArtifact(value));
7064        } else if (name.equals("hasPart")) {
7065          this.getHasPart().add((DeviceDefinitionHasPartComponent) value);
7066        } else if (name.equals("packaging")) {
7067          this.getPackaging().add((DeviceDefinitionPackagingComponent) value);
7068        } else if (name.equals("version")) {
7069          this.getVersion().add((DeviceDefinitionVersionComponent) value);
7070        } else if (name.equals("safety")) {
7071          this.getSafety().add(TypeConvertor.castToCodeableConcept(value));
7072        } else if (name.equals("shelfLifeStorage")) {
7073          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value));
7074        } else if (name.equals("languageCode")) {
7075          this.getLanguageCode().add(TypeConvertor.castToCodeableConcept(value));
7076        } else if (name.equals("property")) {
7077          this.getProperty().add((DeviceDefinitionPropertyComponent) value);
7078        } else if (name.equals("owner")) {
7079          this.owner = TypeConvertor.castToReference(value); // Reference
7080        } else if (name.equals("contact")) {
7081          this.getContact().add(TypeConvertor.castToContactPoint(value));
7082        } else if (name.equals("link")) {
7083          this.getLink().add((DeviceDefinitionLinkComponent) value);
7084        } else if (name.equals("note")) {
7085          this.getNote().add(TypeConvertor.castToAnnotation(value));
7086        } else if (name.equals("parentDevice")) {
7087          this.parentDevice = TypeConvertor.castToReference(value); // Reference
7088        } else if (name.equals("material")) {
7089          this.getMaterial().add((DeviceDefinitionMaterialComponent) value);
7090        } else if (name.equals("productionIdentifierInUDI")) {
7091          value = new DeviceProductionIdentifierInUDIEnumFactory().fromType(TypeConvertor.castToCode(value));
7092          this.getProductionIdentifierInUDI().add((Enumeration) value);
7093        } else if (name.equals("guideline")) {
7094          this.guideline = (DeviceDefinitionGuidelineComponent) value; // DeviceDefinitionGuidelineComponent
7095        } else if (name.equals("correctiveAction")) {
7096          this.correctiveAction = (DeviceDefinitionCorrectiveActionComponent) value; // DeviceDefinitionCorrectiveActionComponent
7097        } else if (name.equals("chargeItem")) {
7098          this.getChargeItem().add((DeviceDefinitionChargeItemComponent) value);
7099        } else
7100          return super.setProperty(name, value);
7101        return value;
7102      }
7103
7104      @Override
7105      public Base makeProperty(int hash, String name) throws FHIRException {
7106        switch (hash) {
7107        case -1724546052:  return getDescriptionElement();
7108        case -1618432855:  return addIdentifier(); 
7109        case -99121287:  return addUdiDeviceIdentifier(); 
7110        case 455683425:  return addRegulatoryIdentifier(); 
7111        case -731502308:  return getPartNumberElement();
7112        case -1969347631:  return getManufacturer();
7113        case 780988929:  return addDeviceName(); 
7114        case 346619858:  return getModelNumberElement();
7115        case 382350310:  return addClassification(); 
7116        case 682815883:  return addSpecialization(); 
7117        case 696815021:  return addHasPart(); 
7118        case 1802065795:  return addPackaging(); 
7119        case 351608024:  return addVersion(); 
7120        case -909893934:  return addSafety(); 
7121        case 172049237:  return addShelfLifeStorage(); 
7122        case -2092349083:  return addLanguageCode(); 
7123        case -993141291:  return addProperty(); 
7124        case 106164915:  return getOwner();
7125        case 951526432:  return addContact(); 
7126        case 3321850:  return addLink(); 
7127        case 3387378:  return addNote(); 
7128        case 620260256:  return getParentDevice();
7129        case 299066663:  return addMaterial(); 
7130        case 312405811:  return addProductionIdentifierInUDIElement();
7131        case -2075718416:  return getGuideline();
7132        case 1354575876:  return getCorrectiveAction();
7133        case 1417779175:  return addChargeItem(); 
7134        default: return super.makeProperty(hash, name);
7135        }
7136
7137      }
7138
7139      @Override
7140      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7141        switch (hash) {
7142        case -1724546052: /*description*/ return new String[] {"markdown"};
7143        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
7144        case -99121287: /*udiDeviceIdentifier*/ return new String[] {};
7145        case 455683425: /*regulatoryIdentifier*/ return new String[] {};
7146        case -731502308: /*partNumber*/ return new String[] {"string"};
7147        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
7148        case 780988929: /*deviceName*/ return new String[] {};
7149        case 346619858: /*modelNumber*/ return new String[] {"string"};
7150        case 382350310: /*classification*/ return new String[] {};
7151        case 682815883: /*specialization*/ return new String[] {"RelatedArtifact"};
7152        case 696815021: /*hasPart*/ return new String[] {};
7153        case 1802065795: /*packaging*/ return new String[] {};
7154        case 351608024: /*version*/ return new String[] {};
7155        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
7156        case 172049237: /*shelfLifeStorage*/ return new String[] {"ProductShelfLife"};
7157        case -2092349083: /*languageCode*/ return new String[] {"CodeableConcept"};
7158        case -993141291: /*property*/ return new String[] {};
7159        case 106164915: /*owner*/ return new String[] {"Reference"};
7160        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
7161        case 3321850: /*link*/ return new String[] {};
7162        case 3387378: /*note*/ return new String[] {"Annotation"};
7163        case 620260256: /*parentDevice*/ return new String[] {"Reference"};
7164        case 299066663: /*material*/ return new String[] {};
7165        case 312405811: /*productionIdentifierInUDI*/ return new String[] {"code"};
7166        case -2075718416: /*guideline*/ return new String[] {};
7167        case 1354575876: /*correctiveAction*/ return new String[] {};
7168        case 1417779175: /*chargeItem*/ return new String[] {};
7169        default: return super.getTypesForProperty(hash, name);
7170        }
7171
7172      }
7173
7174      @Override
7175      public Base addChild(String name) throws FHIRException {
7176        if (name.equals("description")) {
7177          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.description");
7178        }
7179        else if (name.equals("identifier")) {
7180          return addIdentifier();
7181        }
7182        else if (name.equals("udiDeviceIdentifier")) {
7183          return addUdiDeviceIdentifier();
7184        }
7185        else if (name.equals("regulatoryIdentifier")) {
7186          return addRegulatoryIdentifier();
7187        }
7188        else if (name.equals("partNumber")) {
7189          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.partNumber");
7190        }
7191        else if (name.equals("manufacturer")) {
7192          this.manufacturer = new Reference();
7193          return this.manufacturer;
7194        }
7195        else if (name.equals("deviceName")) {
7196          return addDeviceName();
7197        }
7198        else if (name.equals("modelNumber")) {
7199          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.modelNumber");
7200        }
7201        else if (name.equals("classification")) {
7202          return addClassification();
7203        }
7204        else if (name.equals("specialization")) {
7205          return addSpecialization();
7206        }
7207        else if (name.equals("hasPart")) {
7208          return addHasPart();
7209        }
7210        else if (name.equals("packaging")) {
7211          return addPackaging();
7212        }
7213        else if (name.equals("version")) {
7214          return addVersion();
7215        }
7216        else if (name.equals("safety")) {
7217          return addSafety();
7218        }
7219        else if (name.equals("shelfLifeStorage")) {
7220          return addShelfLifeStorage();
7221        }
7222        else if (name.equals("languageCode")) {
7223          return addLanguageCode();
7224        }
7225        else if (name.equals("property")) {
7226          return addProperty();
7227        }
7228        else if (name.equals("owner")) {
7229          this.owner = new Reference();
7230          return this.owner;
7231        }
7232        else if (name.equals("contact")) {
7233          return addContact();
7234        }
7235        else if (name.equals("link")) {
7236          return addLink();
7237        }
7238        else if (name.equals("note")) {
7239          return addNote();
7240        }
7241        else if (name.equals("parentDevice")) {
7242          this.parentDevice = new Reference();
7243          return this.parentDevice;
7244        }
7245        else if (name.equals("material")) {
7246          return addMaterial();
7247        }
7248        else if (name.equals("productionIdentifierInUDI")) {
7249          throw new FHIRException("Cannot call addChild on a primitive type DeviceDefinition.productionIdentifierInUDI");
7250        }
7251        else if (name.equals("guideline")) {
7252          this.guideline = new DeviceDefinitionGuidelineComponent();
7253          return this.guideline;
7254        }
7255        else if (name.equals("correctiveAction")) {
7256          this.correctiveAction = new DeviceDefinitionCorrectiveActionComponent();
7257          return this.correctiveAction;
7258        }
7259        else if (name.equals("chargeItem")) {
7260          return addChargeItem();
7261        }
7262        else
7263          return super.addChild(name);
7264      }
7265
7266  public String fhirType() {
7267    return "DeviceDefinition";
7268
7269  }
7270
7271      public DeviceDefinition copy() {
7272        DeviceDefinition dst = new DeviceDefinition();
7273        copyValues(dst);
7274        return dst;
7275      }
7276
7277      public void copyValues(DeviceDefinition dst) {
7278        super.copyValues(dst);
7279        dst.description = description == null ? null : description.copy();
7280        if (identifier != null) {
7281          dst.identifier = new ArrayList<Identifier>();
7282          for (Identifier i : identifier)
7283            dst.identifier.add(i.copy());
7284        };
7285        if (udiDeviceIdentifier != null) {
7286          dst.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
7287          for (DeviceDefinitionUdiDeviceIdentifierComponent i : udiDeviceIdentifier)
7288            dst.udiDeviceIdentifier.add(i.copy());
7289        };
7290        if (regulatoryIdentifier != null) {
7291          dst.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
7292          for (DeviceDefinitionRegulatoryIdentifierComponent i : regulatoryIdentifier)
7293            dst.regulatoryIdentifier.add(i.copy());
7294        };
7295        dst.partNumber = partNumber == null ? null : partNumber.copy();
7296        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
7297        if (deviceName != null) {
7298          dst.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
7299          for (DeviceDefinitionDeviceNameComponent i : deviceName)
7300            dst.deviceName.add(i.copy());
7301        };
7302        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
7303        if (classification != null) {
7304          dst.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
7305          for (DeviceDefinitionClassificationComponent i : classification)
7306            dst.classification.add(i.copy());
7307        };
7308        if (specialization != null) {
7309          dst.specialization = new ArrayList<RelatedArtifact>();
7310          for (RelatedArtifact i : specialization)
7311            dst.specialization.add(i.copy());
7312        };
7313        if (hasPart != null) {
7314          dst.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
7315          for (DeviceDefinitionHasPartComponent i : hasPart)
7316            dst.hasPart.add(i.copy());
7317        };
7318        if (packaging != null) {
7319          dst.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
7320          for (DeviceDefinitionPackagingComponent i : packaging)
7321            dst.packaging.add(i.copy());
7322        };
7323        if (version != null) {
7324          dst.version = new ArrayList<DeviceDefinitionVersionComponent>();
7325          for (DeviceDefinitionVersionComponent i : version)
7326            dst.version.add(i.copy());
7327        };
7328        if (safety != null) {
7329          dst.safety = new ArrayList<CodeableConcept>();
7330          for (CodeableConcept i : safety)
7331            dst.safety.add(i.copy());
7332        };
7333        if (shelfLifeStorage != null) {
7334          dst.shelfLifeStorage = new ArrayList<ProductShelfLife>();
7335          for (ProductShelfLife i : shelfLifeStorage)
7336            dst.shelfLifeStorage.add(i.copy());
7337        };
7338        if (languageCode != null) {
7339          dst.languageCode = new ArrayList<CodeableConcept>();
7340          for (CodeableConcept i : languageCode)
7341            dst.languageCode.add(i.copy());
7342        };
7343        if (property != null) {
7344          dst.property = new ArrayList<DeviceDefinitionPropertyComponent>();
7345          for (DeviceDefinitionPropertyComponent i : property)
7346            dst.property.add(i.copy());
7347        };
7348        dst.owner = owner == null ? null : owner.copy();
7349        if (contact != null) {
7350          dst.contact = new ArrayList<ContactPoint>();
7351          for (ContactPoint i : contact)
7352            dst.contact.add(i.copy());
7353        };
7354        if (link != null) {
7355          dst.link = new ArrayList<DeviceDefinitionLinkComponent>();
7356          for (DeviceDefinitionLinkComponent i : link)
7357            dst.link.add(i.copy());
7358        };
7359        if (note != null) {
7360          dst.note = new ArrayList<Annotation>();
7361          for (Annotation i : note)
7362            dst.note.add(i.copy());
7363        };
7364        dst.parentDevice = parentDevice == null ? null : parentDevice.copy();
7365        if (material != null) {
7366          dst.material = new ArrayList<DeviceDefinitionMaterialComponent>();
7367          for (DeviceDefinitionMaterialComponent i : material)
7368            dst.material.add(i.copy());
7369        };
7370        if (productionIdentifierInUDI != null) {
7371          dst.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
7372          for (Enumeration<DeviceProductionIdentifierInUDI> i : productionIdentifierInUDI)
7373            dst.productionIdentifierInUDI.add(i.copy());
7374        };
7375        dst.guideline = guideline == null ? null : guideline.copy();
7376        dst.correctiveAction = correctiveAction == null ? null : correctiveAction.copy();
7377        if (chargeItem != null) {
7378          dst.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
7379          for (DeviceDefinitionChargeItemComponent i : chargeItem)
7380            dst.chargeItem.add(i.copy());
7381        };
7382      }
7383
7384      protected DeviceDefinition typedCopy() {
7385        return copy();
7386      }
7387
7388      @Override
7389      public boolean equalsDeep(Base other_) {
7390        if (!super.equalsDeep(other_))
7391          return false;
7392        if (!(other_ instanceof DeviceDefinition))
7393          return false;
7394        DeviceDefinition o = (DeviceDefinition) other_;
7395        return compareDeep(description, o.description, true) && compareDeep(identifier, o.identifier, true)
7396           && compareDeep(udiDeviceIdentifier, o.udiDeviceIdentifier, true) && compareDeep(regulatoryIdentifier, o.regulatoryIdentifier, true)
7397           && compareDeep(partNumber, o.partNumber, true) && compareDeep(manufacturer, o.manufacturer, true)
7398           && compareDeep(deviceName, o.deviceName, true) && compareDeep(modelNumber, o.modelNumber, true)
7399           && compareDeep(classification, o.classification, true) && compareDeep(specialization, o.specialization, true)
7400           && compareDeep(hasPart, o.hasPart, true) && compareDeep(packaging, o.packaging, true) && compareDeep(version, o.version, true)
7401           && compareDeep(safety, o.safety, true) && compareDeep(shelfLifeStorage, o.shelfLifeStorage, true)
7402           && compareDeep(languageCode, o.languageCode, true) && compareDeep(property, o.property, true) && compareDeep(owner, o.owner, true)
7403           && compareDeep(contact, o.contact, true) && compareDeep(link, o.link, true) && compareDeep(note, o.note, true)
7404           && compareDeep(parentDevice, o.parentDevice, true) && compareDeep(material, o.material, true) && compareDeep(productionIdentifierInUDI, o.productionIdentifierInUDI, true)
7405           && compareDeep(guideline, o.guideline, true) && compareDeep(correctiveAction, o.correctiveAction, true)
7406           && compareDeep(chargeItem, o.chargeItem, true);
7407      }
7408
7409      @Override
7410      public boolean equalsShallow(Base other_) {
7411        if (!super.equalsShallow(other_))
7412          return false;
7413        if (!(other_ instanceof DeviceDefinition))
7414          return false;
7415        DeviceDefinition o = (DeviceDefinition) other_;
7416        return compareValues(description, o.description, true) && compareValues(partNumber, o.partNumber, true)
7417           && compareValues(modelNumber, o.modelNumber, true) && compareValues(productionIdentifierInUDI, o.productionIdentifierInUDI, true)
7418          ;
7419      }
7420
7421      public boolean isEmpty() {
7422        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, identifier, udiDeviceIdentifier
7423          , regulatoryIdentifier, partNumber, manufacturer, deviceName, modelNumber, classification
7424          , specialization, hasPart, packaging, version, safety, shelfLifeStorage, languageCode
7425          , property, owner, contact, link, note, parentDevice, material, productionIdentifierInUDI
7426          , guideline, correctiveAction, chargeItem);
7427      }
7428
7429  @Override
7430  public ResourceType getResourceType() {
7431    return ResourceType.DeviceDefinition;
7432   }
7433
7434 /**
7435   * Search parameter: <b>identifier</b>
7436   * <p>
7437   * Description: <b>The identifier of the component</b><br>
7438   * Type: <b>token</b><br>
7439   * Path: <b>DeviceDefinition.identifier</b><br>
7440   * </p>
7441   */
7442  @SearchParamDefinition(name="identifier", path="DeviceDefinition.identifier", description="The identifier of the component", type="token" )
7443  public static final String SP_IDENTIFIER = "identifier";
7444 /**
7445   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
7446   * <p>
7447   * Description: <b>The identifier of the component</b><br>
7448   * Type: <b>token</b><br>
7449   * Path: <b>DeviceDefinition.identifier</b><br>
7450   * </p>
7451   */
7452  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
7453
7454 /**
7455   * Search parameter: <b>parent</b>
7456   * <p>
7457   * Description: <b>The parent DeviceDefinition resource</b><br>
7458   * Type: <b>reference</b><br>
7459   * Path: <b>DeviceDefinition.parentDevice</b><br>
7460   * </p>
7461   */
7462  @SearchParamDefinition(name="parent", path="DeviceDefinition.parentDevice", description="The parent DeviceDefinition resource", type="reference", target={DeviceDefinition.class } )
7463  public static final String SP_PARENT = "parent";
7464 /**
7465   * <b>Fluent Client</b> search parameter constant for <b>parent</b>
7466   * <p>
7467   * Description: <b>The parent DeviceDefinition resource</b><br>
7468   * Type: <b>reference</b><br>
7469   * Path: <b>DeviceDefinition.parentDevice</b><br>
7470   * </p>
7471   */
7472  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT);
7473
7474/**
7475   * Constant for fluent queries to be used to add include statements. Specifies
7476   * the path value of "<b>DeviceDefinition:parent</b>".
7477   */
7478  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("DeviceDefinition:parent").toLocked();
7479
7480 /**
7481   * Search parameter: <b>type</b>
7482   * <p>
7483   * Description: <b>The device component type</b><br>
7484   * Type: <b>token</b><br>
7485   * Path: <b>DeviceDefinition.classification.type</b><br>
7486   * </p>
7487   */
7488  @SearchParamDefinition(name="type", path="DeviceDefinition.classification.type", description="The device component type", type="token" )
7489  public static final String SP_TYPE = "type";
7490 /**
7491   * <b>Fluent Client</b> search parameter constant for <b>type</b>
7492   * <p>
7493   * Description: <b>The device component type</b><br>
7494   * Type: <b>token</b><br>
7495   * Path: <b>DeviceDefinition.classification.type</b><br>
7496   * </p>
7497   */
7498  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
7499
7500
7501}
7502