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