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