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