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