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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A detailed description of a device, typically as part of a regulated medicinal product. It is not intended to relace the Device resource, which covers use of device instances.
047 */
048@ResourceDef(name="MedicinalProductDeviceSpec", profile="http://hl7.org/fhir/Profile/MedicinalProductDeviceSpec")
049public class MedicinalProductDeviceSpec extends DomainResource {
050
051    @Block()
052    public static class MedicinalProductDeviceSpecMaterialComponent extends BackboneElement implements IBaseBackboneElement {
053        /**
054         * The substance.
055         */
056        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
057        @Description(shortDefinition="The substance", formalDefinition="The substance." )
058        protected CodeableConcept substance;
059
060        /**
061         * Indicates an alternative material of the device.
062         */
063        @Child(name = "alternate", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=true)
064        @Description(shortDefinition="Indicates an alternative material of the device", formalDefinition="Indicates an alternative material of the device." )
065        protected BooleanType alternate;
066
067        /**
068         * Whether the substance is a known or suspected allergen.
069         */
070        @Child(name = "allergenicIndicator", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
071        @Description(shortDefinition="Whether the substance is a known or suspected allergen", formalDefinition="Whether the substance is a known or suspected allergen." )
072        protected BooleanType allergenicIndicator;
073
074        private static final long serialVersionUID = 1232736508L;
075
076    /**
077     * Constructor
078     */
079      public MedicinalProductDeviceSpecMaterialComponent() {
080        super();
081      }
082
083    /**
084     * Constructor
085     */
086      public MedicinalProductDeviceSpecMaterialComponent(CodeableConcept substance) {
087        super();
088        this.substance = substance;
089      }
090
091        /**
092         * @return {@link #substance} (The substance.)
093         */
094        public CodeableConcept getSubstance() { 
095          if (this.substance == null)
096            if (Configuration.errorOnAutoCreate())
097              throw new Error("Attempt to auto-create MedicinalProductDeviceSpecMaterialComponent.substance");
098            else if (Configuration.doAutoCreate())
099              this.substance = new CodeableConcept(); // cc
100          return this.substance;
101        }
102
103        public boolean hasSubstance() { 
104          return this.substance != null && !this.substance.isEmpty();
105        }
106
107        /**
108         * @param value {@link #substance} (The substance.)
109         */
110        public MedicinalProductDeviceSpecMaterialComponent setSubstance(CodeableConcept value) { 
111          this.substance = value;
112          return this;
113        }
114
115        /**
116         * @return {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
117         */
118        public BooleanType getAlternateElement() { 
119          if (this.alternate == null)
120            if (Configuration.errorOnAutoCreate())
121              throw new Error("Attempt to auto-create MedicinalProductDeviceSpecMaterialComponent.alternate");
122            else if (Configuration.doAutoCreate())
123              this.alternate = new BooleanType(); // bb
124          return this.alternate;
125        }
126
127        public boolean hasAlternateElement() { 
128          return this.alternate != null && !this.alternate.isEmpty();
129        }
130
131        public boolean hasAlternate() { 
132          return this.alternate != null && !this.alternate.isEmpty();
133        }
134
135        /**
136         * @param value {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
137         */
138        public MedicinalProductDeviceSpecMaterialComponent setAlternateElement(BooleanType value) { 
139          this.alternate = value;
140          return this;
141        }
142
143        /**
144         * @return Indicates an alternative material of the device.
145         */
146        public boolean getAlternate() { 
147          return this.alternate == null || this.alternate.isEmpty() ? false : this.alternate.getValue();
148        }
149
150        /**
151         * @param value Indicates an alternative material of the device.
152         */
153        public MedicinalProductDeviceSpecMaterialComponent setAlternate(boolean value) { 
154            if (this.alternate == null)
155              this.alternate = new BooleanType();
156            this.alternate.setValue(value);
157          return this;
158        }
159
160        /**
161         * @return {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
162         */
163        public BooleanType getAllergenicIndicatorElement() { 
164          if (this.allergenicIndicator == null)
165            if (Configuration.errorOnAutoCreate())
166              throw new Error("Attempt to auto-create MedicinalProductDeviceSpecMaterialComponent.allergenicIndicator");
167            else if (Configuration.doAutoCreate())
168              this.allergenicIndicator = new BooleanType(); // bb
169          return this.allergenicIndicator;
170        }
171
172        public boolean hasAllergenicIndicatorElement() { 
173          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
174        }
175
176        public boolean hasAllergenicIndicator() { 
177          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
178        }
179
180        /**
181         * @param value {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
182         */
183        public MedicinalProductDeviceSpecMaterialComponent setAllergenicIndicatorElement(BooleanType value) { 
184          this.allergenicIndicator = value;
185          return this;
186        }
187
188        /**
189         * @return Whether the substance is a known or suspected allergen.
190         */
191        public boolean getAllergenicIndicator() { 
192          return this.allergenicIndicator == null || this.allergenicIndicator.isEmpty() ? false : this.allergenicIndicator.getValue();
193        }
194
195        /**
196         * @param value Whether the substance is a known or suspected allergen.
197         */
198        public MedicinalProductDeviceSpecMaterialComponent setAllergenicIndicator(boolean value) { 
199            if (this.allergenicIndicator == null)
200              this.allergenicIndicator = new BooleanType();
201            this.allergenicIndicator.setValue(value);
202          return this;
203        }
204
205        protected void listChildren(List<Property> children) {
206          super.listChildren(children);
207          children.add(new Property("substance", "CodeableConcept", "The substance.", 0, 1, substance));
208          children.add(new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate));
209          children.add(new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator));
210        }
211
212        @Override
213        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
214          switch (_hash) {
215          case 530040176: /*substance*/  return new Property("substance", "CodeableConcept", "The substance.", 0, 1, substance);
216          case -1408024454: /*alternate*/  return new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate);
217          case 75406931: /*allergenicIndicator*/  return new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator);
218          default: return super.getNamedProperty(_hash, _name, _checkValid);
219          }
220
221        }
222
223      @Override
224      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
225        switch (hash) {
226        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
227        case -1408024454: /*alternate*/ return this.alternate == null ? new Base[0] : new Base[] {this.alternate}; // BooleanType
228        case 75406931: /*allergenicIndicator*/ return this.allergenicIndicator == null ? new Base[0] : new Base[] {this.allergenicIndicator}; // BooleanType
229        default: return super.getProperty(hash, name, checkValid);
230        }
231
232      }
233
234      @Override
235      public Base setProperty(int hash, String name, Base value) throws FHIRException {
236        switch (hash) {
237        case 530040176: // substance
238          this.substance = castToCodeableConcept(value); // CodeableConcept
239          return value;
240        case -1408024454: // alternate
241          this.alternate = castToBoolean(value); // BooleanType
242          return value;
243        case 75406931: // allergenicIndicator
244          this.allergenicIndicator = castToBoolean(value); // BooleanType
245          return value;
246        default: return super.setProperty(hash, name, value);
247        }
248
249      }
250
251      @Override
252      public Base setProperty(String name, Base value) throws FHIRException {
253        if (name.equals("substance")) {
254          this.substance = castToCodeableConcept(value); // CodeableConcept
255        } else if (name.equals("alternate")) {
256          this.alternate = castToBoolean(value); // BooleanType
257        } else if (name.equals("allergenicIndicator")) {
258          this.allergenicIndicator = castToBoolean(value); // BooleanType
259        } else
260          return super.setProperty(name, value);
261        return value;
262      }
263
264      @Override
265      public Base makeProperty(int hash, String name) throws FHIRException {
266        switch (hash) {
267        case 530040176:  return getSubstance(); 
268        case -1408024454:  return getAlternateElement();
269        case 75406931:  return getAllergenicIndicatorElement();
270        default: return super.makeProperty(hash, name);
271        }
272
273      }
274
275      @Override
276      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
277        switch (hash) {
278        case 530040176: /*substance*/ return new String[] {"CodeableConcept"};
279        case -1408024454: /*alternate*/ return new String[] {"boolean"};
280        case 75406931: /*allergenicIndicator*/ return new String[] {"boolean"};
281        default: return super.getTypesForProperty(hash, name);
282        }
283
284      }
285
286      @Override
287      public Base addChild(String name) throws FHIRException {
288        if (name.equals("substance")) {
289          this.substance = new CodeableConcept();
290          return this.substance;
291        }
292        else if (name.equals("alternate")) {
293          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductDeviceSpec.alternate");
294        }
295        else if (name.equals("allergenicIndicator")) {
296          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductDeviceSpec.allergenicIndicator");
297        }
298        else
299          return super.addChild(name);
300      }
301
302      public MedicinalProductDeviceSpecMaterialComponent copy() {
303        MedicinalProductDeviceSpecMaterialComponent dst = new MedicinalProductDeviceSpecMaterialComponent();
304        copyValues(dst);
305        dst.substance = substance == null ? null : substance.copy();
306        dst.alternate = alternate == null ? null : alternate.copy();
307        dst.allergenicIndicator = allergenicIndicator == null ? null : allergenicIndicator.copy();
308        return dst;
309      }
310
311      @Override
312      public boolean equalsDeep(Base other_) {
313        if (!super.equalsDeep(other_))
314          return false;
315        if (!(other_ instanceof MedicinalProductDeviceSpecMaterialComponent))
316          return false;
317        MedicinalProductDeviceSpecMaterialComponent o = (MedicinalProductDeviceSpecMaterialComponent) other_;
318        return compareDeep(substance, o.substance, true) && compareDeep(alternate, o.alternate, true) && compareDeep(allergenicIndicator, o.allergenicIndicator, true)
319          ;
320      }
321
322      @Override
323      public boolean equalsShallow(Base other_) {
324        if (!super.equalsShallow(other_))
325          return false;
326        if (!(other_ instanceof MedicinalProductDeviceSpecMaterialComponent))
327          return false;
328        MedicinalProductDeviceSpecMaterialComponent o = (MedicinalProductDeviceSpecMaterialComponent) other_;
329        return compareValues(alternate, o.alternate, true) && compareValues(allergenicIndicator, o.allergenicIndicator, true)
330          ;
331      }
332
333      public boolean isEmpty() {
334        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, alternate, allergenicIndicator
335          );
336      }
337
338  public String fhirType() {
339    return "MedicinalProductDeviceSpec.material";
340
341  }
342
343  }
344
345    /**
346     * Business identifier.
347     */
348    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
349    @Description(shortDefinition="Business identifier", formalDefinition="Business identifier." )
350    protected Identifier identifier;
351
352    /**
353     * The type of device.
354     */
355    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
356    @Description(shortDefinition="The type of device", formalDefinition="The type of device." )
357    protected CodeableConcept type;
358
359    /**
360     * Trade name of the device, where applicable.
361     */
362    @Child(name = "tradeName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
363    @Description(shortDefinition="Trade name of the device, where applicable", formalDefinition="Trade name of the device, where applicable." )
364    protected StringType tradeName;
365
366    /**
367     * The quantity of the device present in the packaging of a medicinal product.
368     */
369    @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
370    @Description(shortDefinition="The quantity of the device present in the packaging of a medicinal product", formalDefinition="The quantity of the device present in the packaging of a medicinal product." )
371    protected Quantity quantity;
372
373    /**
374     * Device listing number.
375     */
376    @Child(name = "listingNumber", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
377    @Description(shortDefinition="Device listing number", formalDefinition="Device listing number." )
378    protected StringType listingNumber;
379
380    /**
381     * Device model or reference number.
382     */
383    @Child(name = "modelNumber", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
384    @Description(shortDefinition="Device model or reference number", formalDefinition="Device model or reference number." )
385    protected StringType modelNumber;
386
387    /**
388     * Whether the device is supplied as sterile.
389     */
390    @Child(name = "sterilityIndicator", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
391    @Description(shortDefinition="Whether the device is supplied as sterile", formalDefinition="Whether the device is supplied as sterile." )
392    protected CodeableConcept sterilityIndicator;
393
394    /**
395     * Whether the device must be sterilised before use.
396     */
397    @Child(name = "sterilisationRequirement", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
398    @Description(shortDefinition="Whether the device must be sterilised before use", formalDefinition="Whether the device must be sterilised before use." )
399    protected CodeableConcept sterilisationRequirement;
400
401    /**
402     * Usage pattern including the number of times that the device may be used.
403     */
404    @Child(name = "usage", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
405    @Description(shortDefinition="Usage pattern including the number of times that the device may be used", formalDefinition="Usage pattern including the number of times that the device may be used." )
406    protected CodeableConcept usage;
407
408    /**
409     * A nomenclature term for the device.
410     */
411    @Child(name = "nomenclature", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
412    @Description(shortDefinition="A nomenclature term for the device", formalDefinition="A nomenclature term for the device." )
413    protected List<CodeableConcept> nomenclature;
414
415    /**
416     * Shelf Life and storage information.
417     */
418    @Child(name = "shelfLife", type = {ProductShelfLife.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
419    @Description(shortDefinition="Shelf Life and storage information", formalDefinition="Shelf Life and storage information." )
420    protected List<ProductShelfLife> shelfLife;
421
422    /**
423     * Dimensions, color etc.
424     */
425    @Child(name = "physicalCharacteristics", type = {ProdCharacteristic.class}, order=11, min=0, max=1, modifier=false, summary=true)
426    @Description(shortDefinition="Dimensions, color etc.", formalDefinition="Dimensions, color etc." )
427    protected ProdCharacteristic physicalCharacteristics;
428
429    /**
430     * Other codeable characteristics.
431     */
432    @Child(name = "otherCharacteristics", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
433    @Description(shortDefinition="Other codeable characteristics", formalDefinition="Other codeable characteristics." )
434    protected List<CodeableConcept> otherCharacteristics;
435
436    /**
437     * Batch number or expiry date of a device.
438     */
439    @Child(name = "batchIdentifier", type = {Identifier.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
440    @Description(shortDefinition="Batch number or expiry date of a device", formalDefinition="Batch number or expiry date of a device." )
441    protected List<Identifier> batchIdentifier;
442
443    /**
444     * Manufacturer of this Device.
445     */
446    @Child(name = "manufacturer", type = {Organization.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
447    @Description(shortDefinition="Manufacturer of this Device", formalDefinition="Manufacturer of this Device." )
448    protected List<Reference> manufacturer;
449    /**
450     * The actual objects that are the target of the reference (Manufacturer of this Device.)
451     */
452    protected List<Organization> manufacturerTarget;
453
454
455    /**
456     * A substance used to create the material(s) of which the device is made.
457     */
458    @Child(name = "material", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
459    @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." )
460    protected List<MedicinalProductDeviceSpecMaterialComponent> material;
461
462    private static final long serialVersionUID = 839400430L;
463
464  /**
465   * Constructor
466   */
467    public MedicinalProductDeviceSpec() {
468      super();
469    }
470
471  /**
472   * Constructor
473   */
474    public MedicinalProductDeviceSpec(CodeableConcept type) {
475      super();
476      this.type = type;
477    }
478
479    /**
480     * @return {@link #identifier} (Business identifier.)
481     */
482    public Identifier getIdentifier() { 
483      if (this.identifier == null)
484        if (Configuration.errorOnAutoCreate())
485          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.identifier");
486        else if (Configuration.doAutoCreate())
487          this.identifier = new Identifier(); // cc
488      return this.identifier;
489    }
490
491    public boolean hasIdentifier() { 
492      return this.identifier != null && !this.identifier.isEmpty();
493    }
494
495    /**
496     * @param value {@link #identifier} (Business identifier.)
497     */
498    public MedicinalProductDeviceSpec setIdentifier(Identifier value) { 
499      this.identifier = value;
500      return this;
501    }
502
503    /**
504     * @return {@link #type} (The type of device.)
505     */
506    public CodeableConcept getType() { 
507      if (this.type == null)
508        if (Configuration.errorOnAutoCreate())
509          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.type");
510        else if (Configuration.doAutoCreate())
511          this.type = new CodeableConcept(); // cc
512      return this.type;
513    }
514
515    public boolean hasType() { 
516      return this.type != null && !this.type.isEmpty();
517    }
518
519    /**
520     * @param value {@link #type} (The type of device.)
521     */
522    public MedicinalProductDeviceSpec setType(CodeableConcept value) { 
523      this.type = value;
524      return this;
525    }
526
527    /**
528     * @return {@link #tradeName} (Trade name of the device, where applicable.). This is the underlying object with id, value and extensions. The accessor "getTradeName" gives direct access to the value
529     */
530    public StringType getTradeNameElement() { 
531      if (this.tradeName == null)
532        if (Configuration.errorOnAutoCreate())
533          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.tradeName");
534        else if (Configuration.doAutoCreate())
535          this.tradeName = new StringType(); // bb
536      return this.tradeName;
537    }
538
539    public boolean hasTradeNameElement() { 
540      return this.tradeName != null && !this.tradeName.isEmpty();
541    }
542
543    public boolean hasTradeName() { 
544      return this.tradeName != null && !this.tradeName.isEmpty();
545    }
546
547    /**
548     * @param value {@link #tradeName} (Trade name of the device, where applicable.). This is the underlying object with id, value and extensions. The accessor "getTradeName" gives direct access to the value
549     */
550    public MedicinalProductDeviceSpec setTradeNameElement(StringType value) { 
551      this.tradeName = value;
552      return this;
553    }
554
555    /**
556     * @return Trade name of the device, where applicable.
557     */
558    public String getTradeName() { 
559      return this.tradeName == null ? null : this.tradeName.getValue();
560    }
561
562    /**
563     * @param value Trade name of the device, where applicable.
564     */
565    public MedicinalProductDeviceSpec setTradeName(String value) { 
566      if (Utilities.noString(value))
567        this.tradeName = null;
568      else {
569        if (this.tradeName == null)
570          this.tradeName = new StringType();
571        this.tradeName.setValue(value);
572      }
573      return this;
574    }
575
576    /**
577     * @return {@link #quantity} (The quantity of the device present in the packaging of a medicinal product.)
578     */
579    public Quantity getQuantity() { 
580      if (this.quantity == null)
581        if (Configuration.errorOnAutoCreate())
582          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.quantity");
583        else if (Configuration.doAutoCreate())
584          this.quantity = new Quantity(); // cc
585      return this.quantity;
586    }
587
588    public boolean hasQuantity() { 
589      return this.quantity != null && !this.quantity.isEmpty();
590    }
591
592    /**
593     * @param value {@link #quantity} (The quantity of the device present in the packaging of a medicinal product.)
594     */
595    public MedicinalProductDeviceSpec setQuantity(Quantity value) { 
596      this.quantity = value;
597      return this;
598    }
599
600    /**
601     * @return {@link #listingNumber} (Device listing number.). This is the underlying object with id, value and extensions. The accessor "getListingNumber" gives direct access to the value
602     */
603    public StringType getListingNumberElement() { 
604      if (this.listingNumber == null)
605        if (Configuration.errorOnAutoCreate())
606          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.listingNumber");
607        else if (Configuration.doAutoCreate())
608          this.listingNumber = new StringType(); // bb
609      return this.listingNumber;
610    }
611
612    public boolean hasListingNumberElement() { 
613      return this.listingNumber != null && !this.listingNumber.isEmpty();
614    }
615
616    public boolean hasListingNumber() { 
617      return this.listingNumber != null && !this.listingNumber.isEmpty();
618    }
619
620    /**
621     * @param value {@link #listingNumber} (Device listing number.). This is the underlying object with id, value and extensions. The accessor "getListingNumber" gives direct access to the value
622     */
623    public MedicinalProductDeviceSpec setListingNumberElement(StringType value) { 
624      this.listingNumber = value;
625      return this;
626    }
627
628    /**
629     * @return Device listing number.
630     */
631    public String getListingNumber() { 
632      return this.listingNumber == null ? null : this.listingNumber.getValue();
633    }
634
635    /**
636     * @param value Device listing number.
637     */
638    public MedicinalProductDeviceSpec setListingNumber(String value) { 
639      if (Utilities.noString(value))
640        this.listingNumber = null;
641      else {
642        if (this.listingNumber == null)
643          this.listingNumber = new StringType();
644        this.listingNumber.setValue(value);
645      }
646      return this;
647    }
648
649    /**
650     * @return {@link #modelNumber} (Device model or reference number.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
651     */
652    public StringType getModelNumberElement() { 
653      if (this.modelNumber == null)
654        if (Configuration.errorOnAutoCreate())
655          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.modelNumber");
656        else if (Configuration.doAutoCreate())
657          this.modelNumber = new StringType(); // bb
658      return this.modelNumber;
659    }
660
661    public boolean hasModelNumberElement() { 
662      return this.modelNumber != null && !this.modelNumber.isEmpty();
663    }
664
665    public boolean hasModelNumber() { 
666      return this.modelNumber != null && !this.modelNumber.isEmpty();
667    }
668
669    /**
670     * @param value {@link #modelNumber} (Device model or reference number.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
671     */
672    public MedicinalProductDeviceSpec setModelNumberElement(StringType value) { 
673      this.modelNumber = value;
674      return this;
675    }
676
677    /**
678     * @return Device model or reference number.
679     */
680    public String getModelNumber() { 
681      return this.modelNumber == null ? null : this.modelNumber.getValue();
682    }
683
684    /**
685     * @param value Device model or reference number.
686     */
687    public MedicinalProductDeviceSpec setModelNumber(String value) { 
688      if (Utilities.noString(value))
689        this.modelNumber = null;
690      else {
691        if (this.modelNumber == null)
692          this.modelNumber = new StringType();
693        this.modelNumber.setValue(value);
694      }
695      return this;
696    }
697
698    /**
699     * @return {@link #sterilityIndicator} (Whether the device is supplied as sterile.)
700     */
701    public CodeableConcept getSterilityIndicator() { 
702      if (this.sterilityIndicator == null)
703        if (Configuration.errorOnAutoCreate())
704          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.sterilityIndicator");
705        else if (Configuration.doAutoCreate())
706          this.sterilityIndicator = new CodeableConcept(); // cc
707      return this.sterilityIndicator;
708    }
709
710    public boolean hasSterilityIndicator() { 
711      return this.sterilityIndicator != null && !this.sterilityIndicator.isEmpty();
712    }
713
714    /**
715     * @param value {@link #sterilityIndicator} (Whether the device is supplied as sterile.)
716     */
717    public MedicinalProductDeviceSpec setSterilityIndicator(CodeableConcept value) { 
718      this.sterilityIndicator = value;
719      return this;
720    }
721
722    /**
723     * @return {@link #sterilisationRequirement} (Whether the device must be sterilised before use.)
724     */
725    public CodeableConcept getSterilisationRequirement() { 
726      if (this.sterilisationRequirement == null)
727        if (Configuration.errorOnAutoCreate())
728          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.sterilisationRequirement");
729        else if (Configuration.doAutoCreate())
730          this.sterilisationRequirement = new CodeableConcept(); // cc
731      return this.sterilisationRequirement;
732    }
733
734    public boolean hasSterilisationRequirement() { 
735      return this.sterilisationRequirement != null && !this.sterilisationRequirement.isEmpty();
736    }
737
738    /**
739     * @param value {@link #sterilisationRequirement} (Whether the device must be sterilised before use.)
740     */
741    public MedicinalProductDeviceSpec setSterilisationRequirement(CodeableConcept value) { 
742      this.sterilisationRequirement = value;
743      return this;
744    }
745
746    /**
747     * @return {@link #usage} (Usage pattern including the number of times that the device may be used.)
748     */
749    public CodeableConcept getUsage() { 
750      if (this.usage == null)
751        if (Configuration.errorOnAutoCreate())
752          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.usage");
753        else if (Configuration.doAutoCreate())
754          this.usage = new CodeableConcept(); // cc
755      return this.usage;
756    }
757
758    public boolean hasUsage() { 
759      return this.usage != null && !this.usage.isEmpty();
760    }
761
762    /**
763     * @param value {@link #usage} (Usage pattern including the number of times that the device may be used.)
764     */
765    public MedicinalProductDeviceSpec setUsage(CodeableConcept value) { 
766      this.usage = value;
767      return this;
768    }
769
770    /**
771     * @return {@link #nomenclature} (A nomenclature term for the device.)
772     */
773    public List<CodeableConcept> getNomenclature() { 
774      if (this.nomenclature == null)
775        this.nomenclature = new ArrayList<CodeableConcept>();
776      return this.nomenclature;
777    }
778
779    /**
780     * @return Returns a reference to <code>this</code> for easy method chaining
781     */
782    public MedicinalProductDeviceSpec setNomenclature(List<CodeableConcept> theNomenclature) { 
783      this.nomenclature = theNomenclature;
784      return this;
785    }
786
787    public boolean hasNomenclature() { 
788      if (this.nomenclature == null)
789        return false;
790      for (CodeableConcept item : this.nomenclature)
791        if (!item.isEmpty())
792          return true;
793      return false;
794    }
795
796    public CodeableConcept addNomenclature() { //3
797      CodeableConcept t = new CodeableConcept();
798      if (this.nomenclature == null)
799        this.nomenclature = new ArrayList<CodeableConcept>();
800      this.nomenclature.add(t);
801      return t;
802    }
803
804    public MedicinalProductDeviceSpec addNomenclature(CodeableConcept t) { //3
805      if (t == null)
806        return this;
807      if (this.nomenclature == null)
808        this.nomenclature = new ArrayList<CodeableConcept>();
809      this.nomenclature.add(t);
810      return this;
811    }
812
813    /**
814     * @return The first repetition of repeating field {@link #nomenclature}, creating it if it does not already exist
815     */
816    public CodeableConcept getNomenclatureFirstRep() { 
817      if (getNomenclature().isEmpty()) {
818        addNomenclature();
819      }
820      return getNomenclature().get(0);
821    }
822
823    /**
824     * @return {@link #shelfLife} (Shelf Life and storage information.)
825     */
826    public List<ProductShelfLife> getShelfLife() { 
827      if (this.shelfLife == null)
828        this.shelfLife = new ArrayList<ProductShelfLife>();
829      return this.shelfLife;
830    }
831
832    /**
833     * @return Returns a reference to <code>this</code> for easy method chaining
834     */
835    public MedicinalProductDeviceSpec setShelfLife(List<ProductShelfLife> theShelfLife) { 
836      this.shelfLife = theShelfLife;
837      return this;
838    }
839
840    public boolean hasShelfLife() { 
841      if (this.shelfLife == null)
842        return false;
843      for (ProductShelfLife item : this.shelfLife)
844        if (!item.isEmpty())
845          return true;
846      return false;
847    }
848
849    public ProductShelfLife addShelfLife() { //3
850      ProductShelfLife t = new ProductShelfLife();
851      if (this.shelfLife == null)
852        this.shelfLife = new ArrayList<ProductShelfLife>();
853      this.shelfLife.add(t);
854      return t;
855    }
856
857    public MedicinalProductDeviceSpec addShelfLife(ProductShelfLife t) { //3
858      if (t == null)
859        return this;
860      if (this.shelfLife == null)
861        this.shelfLife = new ArrayList<ProductShelfLife>();
862      this.shelfLife.add(t);
863      return this;
864    }
865
866    /**
867     * @return The first repetition of repeating field {@link #shelfLife}, creating it if it does not already exist
868     */
869    public ProductShelfLife getShelfLifeFirstRep() { 
870      if (getShelfLife().isEmpty()) {
871        addShelfLife();
872      }
873      return getShelfLife().get(0);
874    }
875
876    /**
877     * @return {@link #physicalCharacteristics} (Dimensions, color etc.)
878     */
879    public ProdCharacteristic getPhysicalCharacteristics() { 
880      if (this.physicalCharacteristics == null)
881        if (Configuration.errorOnAutoCreate())
882          throw new Error("Attempt to auto-create MedicinalProductDeviceSpec.physicalCharacteristics");
883        else if (Configuration.doAutoCreate())
884          this.physicalCharacteristics = new ProdCharacteristic(); // cc
885      return this.physicalCharacteristics;
886    }
887
888    public boolean hasPhysicalCharacteristics() { 
889      return this.physicalCharacteristics != null && !this.physicalCharacteristics.isEmpty();
890    }
891
892    /**
893     * @param value {@link #physicalCharacteristics} (Dimensions, color etc.)
894     */
895    public MedicinalProductDeviceSpec setPhysicalCharacteristics(ProdCharacteristic value) { 
896      this.physicalCharacteristics = value;
897      return this;
898    }
899
900    /**
901     * @return {@link #otherCharacteristics} (Other codeable characteristics.)
902     */
903    public List<CodeableConcept> getOtherCharacteristics() { 
904      if (this.otherCharacteristics == null)
905        this.otherCharacteristics = new ArrayList<CodeableConcept>();
906      return this.otherCharacteristics;
907    }
908
909    /**
910     * @return Returns a reference to <code>this</code> for easy method chaining
911     */
912    public MedicinalProductDeviceSpec setOtherCharacteristics(List<CodeableConcept> theOtherCharacteristics) { 
913      this.otherCharacteristics = theOtherCharacteristics;
914      return this;
915    }
916
917    public boolean hasOtherCharacteristics() { 
918      if (this.otherCharacteristics == null)
919        return false;
920      for (CodeableConcept item : this.otherCharacteristics)
921        if (!item.isEmpty())
922          return true;
923      return false;
924    }
925
926    public CodeableConcept addOtherCharacteristics() { //3
927      CodeableConcept t = new CodeableConcept();
928      if (this.otherCharacteristics == null)
929        this.otherCharacteristics = new ArrayList<CodeableConcept>();
930      this.otherCharacteristics.add(t);
931      return t;
932    }
933
934    public MedicinalProductDeviceSpec addOtherCharacteristics(CodeableConcept t) { //3
935      if (t == null)
936        return this;
937      if (this.otherCharacteristics == null)
938        this.otherCharacteristics = new ArrayList<CodeableConcept>();
939      this.otherCharacteristics.add(t);
940      return this;
941    }
942
943    /**
944     * @return The first repetition of repeating field {@link #otherCharacteristics}, creating it if it does not already exist
945     */
946    public CodeableConcept getOtherCharacteristicsFirstRep() { 
947      if (getOtherCharacteristics().isEmpty()) {
948        addOtherCharacteristics();
949      }
950      return getOtherCharacteristics().get(0);
951    }
952
953    /**
954     * @return {@link #batchIdentifier} (Batch number or expiry date of a device.)
955     */
956    public List<Identifier> getBatchIdentifier() { 
957      if (this.batchIdentifier == null)
958        this.batchIdentifier = new ArrayList<Identifier>();
959      return this.batchIdentifier;
960    }
961
962    /**
963     * @return Returns a reference to <code>this</code> for easy method chaining
964     */
965    public MedicinalProductDeviceSpec setBatchIdentifier(List<Identifier> theBatchIdentifier) { 
966      this.batchIdentifier = theBatchIdentifier;
967      return this;
968    }
969
970    public boolean hasBatchIdentifier() { 
971      if (this.batchIdentifier == null)
972        return false;
973      for (Identifier item : this.batchIdentifier)
974        if (!item.isEmpty())
975          return true;
976      return false;
977    }
978
979    public Identifier addBatchIdentifier() { //3
980      Identifier t = new Identifier();
981      if (this.batchIdentifier == null)
982        this.batchIdentifier = new ArrayList<Identifier>();
983      this.batchIdentifier.add(t);
984      return t;
985    }
986
987    public MedicinalProductDeviceSpec addBatchIdentifier(Identifier t) { //3
988      if (t == null)
989        return this;
990      if (this.batchIdentifier == null)
991        this.batchIdentifier = new ArrayList<Identifier>();
992      this.batchIdentifier.add(t);
993      return this;
994    }
995
996    /**
997     * @return The first repetition of repeating field {@link #batchIdentifier}, creating it if it does not already exist
998     */
999    public Identifier getBatchIdentifierFirstRep() { 
1000      if (getBatchIdentifier().isEmpty()) {
1001        addBatchIdentifier();
1002      }
1003      return getBatchIdentifier().get(0);
1004    }
1005
1006    /**
1007     * @return {@link #manufacturer} (Manufacturer of this Device.)
1008     */
1009    public List<Reference> getManufacturer() { 
1010      if (this.manufacturer == null)
1011        this.manufacturer = new ArrayList<Reference>();
1012      return this.manufacturer;
1013    }
1014
1015    /**
1016     * @return Returns a reference to <code>this</code> for easy method chaining
1017     */
1018    public MedicinalProductDeviceSpec setManufacturer(List<Reference> theManufacturer) { 
1019      this.manufacturer = theManufacturer;
1020      return this;
1021    }
1022
1023    public boolean hasManufacturer() { 
1024      if (this.manufacturer == null)
1025        return false;
1026      for (Reference item : this.manufacturer)
1027        if (!item.isEmpty())
1028          return true;
1029      return false;
1030    }
1031
1032    public Reference addManufacturer() { //3
1033      Reference t = new Reference();
1034      if (this.manufacturer == null)
1035        this.manufacturer = new ArrayList<Reference>();
1036      this.manufacturer.add(t);
1037      return t;
1038    }
1039
1040    public MedicinalProductDeviceSpec addManufacturer(Reference t) { //3
1041      if (t == null)
1042        return this;
1043      if (this.manufacturer == null)
1044        this.manufacturer = new ArrayList<Reference>();
1045      this.manufacturer.add(t);
1046      return this;
1047    }
1048
1049    /**
1050     * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist
1051     */
1052    public Reference getManufacturerFirstRep() { 
1053      if (getManufacturer().isEmpty()) {
1054        addManufacturer();
1055      }
1056      return getManufacturer().get(0);
1057    }
1058
1059    /**
1060     * @deprecated Use Reference#setResource(IBaseResource) instead
1061     */
1062    @Deprecated
1063    public List<Organization> getManufacturerTarget() { 
1064      if (this.manufacturerTarget == null)
1065        this.manufacturerTarget = new ArrayList<Organization>();
1066      return this.manufacturerTarget;
1067    }
1068
1069    /**
1070     * @deprecated Use Reference#setResource(IBaseResource) instead
1071     */
1072    @Deprecated
1073    public Organization addManufacturerTarget() { 
1074      Organization r = new Organization();
1075      if (this.manufacturerTarget == null)
1076        this.manufacturerTarget = new ArrayList<Organization>();
1077      this.manufacturerTarget.add(r);
1078      return r;
1079    }
1080
1081    /**
1082     * @return {@link #material} (A substance used to create the material(s) of which the device is made.)
1083     */
1084    public List<MedicinalProductDeviceSpecMaterialComponent> getMaterial() { 
1085      if (this.material == null)
1086        this.material = new ArrayList<MedicinalProductDeviceSpecMaterialComponent>();
1087      return this.material;
1088    }
1089
1090    /**
1091     * @return Returns a reference to <code>this</code> for easy method chaining
1092     */
1093    public MedicinalProductDeviceSpec setMaterial(List<MedicinalProductDeviceSpecMaterialComponent> theMaterial) { 
1094      this.material = theMaterial;
1095      return this;
1096    }
1097
1098    public boolean hasMaterial() { 
1099      if (this.material == null)
1100        return false;
1101      for (MedicinalProductDeviceSpecMaterialComponent item : this.material)
1102        if (!item.isEmpty())
1103          return true;
1104      return false;
1105    }
1106
1107    public MedicinalProductDeviceSpecMaterialComponent addMaterial() { //3
1108      MedicinalProductDeviceSpecMaterialComponent t = new MedicinalProductDeviceSpecMaterialComponent();
1109      if (this.material == null)
1110        this.material = new ArrayList<MedicinalProductDeviceSpecMaterialComponent>();
1111      this.material.add(t);
1112      return t;
1113    }
1114
1115    public MedicinalProductDeviceSpec addMaterial(MedicinalProductDeviceSpecMaterialComponent t) { //3
1116      if (t == null)
1117        return this;
1118      if (this.material == null)
1119        this.material = new ArrayList<MedicinalProductDeviceSpecMaterialComponent>();
1120      this.material.add(t);
1121      return this;
1122    }
1123
1124    /**
1125     * @return The first repetition of repeating field {@link #material}, creating it if it does not already exist
1126     */
1127    public MedicinalProductDeviceSpecMaterialComponent getMaterialFirstRep() { 
1128      if (getMaterial().isEmpty()) {
1129        addMaterial();
1130      }
1131      return getMaterial().get(0);
1132    }
1133
1134      protected void listChildren(List<Property> children) {
1135        super.listChildren(children);
1136        children.add(new Property("identifier", "Identifier", "Business identifier.", 0, 1, identifier));
1137        children.add(new Property("type", "CodeableConcept", "The type of device.", 0, 1, type));
1138        children.add(new Property("tradeName", "string", "Trade name of the device, where applicable.", 0, 1, tradeName));
1139        children.add(new Property("quantity", "Quantity", "The quantity of the device present in the packaging of a medicinal product.", 0, 1, quantity));
1140        children.add(new Property("listingNumber", "string", "Device listing number.", 0, 1, listingNumber));
1141        children.add(new Property("modelNumber", "string", "Device model or reference number.", 0, 1, modelNumber));
1142        children.add(new Property("sterilityIndicator", "CodeableConcept", "Whether the device is supplied as sterile.", 0, 1, sterilityIndicator));
1143        children.add(new Property("sterilisationRequirement", "CodeableConcept", "Whether the device must be sterilised before use.", 0, 1, sterilisationRequirement));
1144        children.add(new Property("usage", "CodeableConcept", "Usage pattern including the number of times that the device may be used.", 0, 1, usage));
1145        children.add(new Property("nomenclature", "CodeableConcept", "A nomenclature term for the device.", 0, java.lang.Integer.MAX_VALUE, nomenclature));
1146        children.add(new Property("shelfLife", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLife));
1147        children.add(new Property("physicalCharacteristics", "ProdCharacteristic", "Dimensions, color etc.", 0, 1, physicalCharacteristics));
1148        children.add(new Property("otherCharacteristics", "CodeableConcept", "Other codeable characteristics.", 0, java.lang.Integer.MAX_VALUE, otherCharacteristics));
1149        children.add(new Property("batchIdentifier", "Identifier", "Batch number or expiry date of a device.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier));
1150        children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Device.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
1151        children.add(new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material));
1152      }
1153
1154      @Override
1155      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1156        switch (_hash) {
1157        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier.", 0, 1, identifier);
1158        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of device.", 0, 1, type);
1159        case 752717327: /*tradeName*/  return new Property("tradeName", "string", "Trade name of the device, where applicable.", 0, 1, tradeName);
1160        case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The quantity of the device present in the packaging of a medicinal product.", 0, 1, quantity);
1161        case -1571189011: /*listingNumber*/  return new Property("listingNumber", "string", "Device listing number.", 0, 1, listingNumber);
1162        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "Device model or reference number.", 0, 1, modelNumber);
1163        case -2093506574: /*sterilityIndicator*/  return new Property("sterilityIndicator", "CodeableConcept", "Whether the device is supplied as sterile.", 0, 1, sterilityIndicator);
1164        case 693339497: /*sterilisationRequirement*/  return new Property("sterilisationRequirement", "CodeableConcept", "Whether the device must be sterilised before use.", 0, 1, sterilisationRequirement);
1165        case 111574433: /*usage*/  return new Property("usage", "CodeableConcept", "Usage pattern including the number of times that the device may be used.", 0, 1, usage);
1166        case 895910775: /*nomenclature*/  return new Property("nomenclature", "CodeableConcept", "A nomenclature term for the device.", 0, java.lang.Integer.MAX_VALUE, nomenclature);
1167        case 1796889670: /*shelfLife*/  return new Property("shelfLife", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLife);
1168        case -1599676319: /*physicalCharacteristics*/  return new Property("physicalCharacteristics", "ProdCharacteristic", "Dimensions, color etc.", 0, 1, physicalCharacteristics);
1169        case 722135304: /*otherCharacteristics*/  return new Property("otherCharacteristics", "CodeableConcept", "Other codeable characteristics.", 0, java.lang.Integer.MAX_VALUE, otherCharacteristics);
1170        case -1688395901: /*batchIdentifier*/  return new Property("batchIdentifier", "Identifier", "Batch number or expiry date of a device.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier);
1171        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Device.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
1172        case 299066663: /*material*/  return new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material);
1173        default: return super.getNamedProperty(_hash, _name, _checkValid);
1174        }
1175
1176      }
1177
1178      @Override
1179      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1180        switch (hash) {
1181        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1182        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1183        case 752717327: /*tradeName*/ return this.tradeName == null ? new Base[0] : new Base[] {this.tradeName}; // StringType
1184        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1185        case -1571189011: /*listingNumber*/ return this.listingNumber == null ? new Base[0] : new Base[] {this.listingNumber}; // StringType
1186        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
1187        case -2093506574: /*sterilityIndicator*/ return this.sterilityIndicator == null ? new Base[0] : new Base[] {this.sterilityIndicator}; // CodeableConcept
1188        case 693339497: /*sterilisationRequirement*/ return this.sterilisationRequirement == null ? new Base[0] : new Base[] {this.sterilisationRequirement}; // CodeableConcept
1189        case 111574433: /*usage*/ return this.usage == null ? new Base[0] : new Base[] {this.usage}; // CodeableConcept
1190        case 895910775: /*nomenclature*/ return this.nomenclature == null ? new Base[0] : this.nomenclature.toArray(new Base[this.nomenclature.size()]); // CodeableConcept
1191        case 1796889670: /*shelfLife*/ return this.shelfLife == null ? new Base[0] : this.shelfLife.toArray(new Base[this.shelfLife.size()]); // ProductShelfLife
1192        case -1599676319: /*physicalCharacteristics*/ return this.physicalCharacteristics == null ? new Base[0] : new Base[] {this.physicalCharacteristics}; // ProdCharacteristic
1193        case 722135304: /*otherCharacteristics*/ return this.otherCharacteristics == null ? new Base[0] : this.otherCharacteristics.toArray(new Base[this.otherCharacteristics.size()]); // CodeableConcept
1194        case -1688395901: /*batchIdentifier*/ return this.batchIdentifier == null ? new Base[0] : this.batchIdentifier.toArray(new Base[this.batchIdentifier.size()]); // Identifier
1195        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
1196        case 299066663: /*material*/ return this.material == null ? new Base[0] : this.material.toArray(new Base[this.material.size()]); // MedicinalProductDeviceSpecMaterialComponent
1197        default: return super.getProperty(hash, name, checkValid);
1198        }
1199
1200      }
1201
1202      @Override
1203      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1204        switch (hash) {
1205        case -1618432855: // identifier
1206          this.identifier = castToIdentifier(value); // Identifier
1207          return value;
1208        case 3575610: // type
1209          this.type = castToCodeableConcept(value); // CodeableConcept
1210          return value;
1211        case 752717327: // tradeName
1212          this.tradeName = castToString(value); // StringType
1213          return value;
1214        case -1285004149: // quantity
1215          this.quantity = castToQuantity(value); // Quantity
1216          return value;
1217        case -1571189011: // listingNumber
1218          this.listingNumber = castToString(value); // StringType
1219          return value;
1220        case 346619858: // modelNumber
1221          this.modelNumber = castToString(value); // StringType
1222          return value;
1223        case -2093506574: // sterilityIndicator
1224          this.sterilityIndicator = castToCodeableConcept(value); // CodeableConcept
1225          return value;
1226        case 693339497: // sterilisationRequirement
1227          this.sterilisationRequirement = castToCodeableConcept(value); // CodeableConcept
1228          return value;
1229        case 111574433: // usage
1230          this.usage = castToCodeableConcept(value); // CodeableConcept
1231          return value;
1232        case 895910775: // nomenclature
1233          this.getNomenclature().add(castToCodeableConcept(value)); // CodeableConcept
1234          return value;
1235        case 1796889670: // shelfLife
1236          this.getShelfLife().add(castToProductShelfLife(value)); // ProductShelfLife
1237          return value;
1238        case -1599676319: // physicalCharacteristics
1239          this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
1240          return value;
1241        case 722135304: // otherCharacteristics
1242          this.getOtherCharacteristics().add(castToCodeableConcept(value)); // CodeableConcept
1243          return value;
1244        case -1688395901: // batchIdentifier
1245          this.getBatchIdentifier().add(castToIdentifier(value)); // Identifier
1246          return value;
1247        case -1969347631: // manufacturer
1248          this.getManufacturer().add(castToReference(value)); // Reference
1249          return value;
1250        case 299066663: // material
1251          this.getMaterial().add((MedicinalProductDeviceSpecMaterialComponent) value); // MedicinalProductDeviceSpecMaterialComponent
1252          return value;
1253        default: return super.setProperty(hash, name, value);
1254        }
1255
1256      }
1257
1258      @Override
1259      public Base setProperty(String name, Base value) throws FHIRException {
1260        if (name.equals("identifier")) {
1261          this.identifier = castToIdentifier(value); // Identifier
1262        } else if (name.equals("type")) {
1263          this.type = castToCodeableConcept(value); // CodeableConcept
1264        } else if (name.equals("tradeName")) {
1265          this.tradeName = castToString(value); // StringType
1266        } else if (name.equals("quantity")) {
1267          this.quantity = castToQuantity(value); // Quantity
1268        } else if (name.equals("listingNumber")) {
1269          this.listingNumber = castToString(value); // StringType
1270        } else if (name.equals("modelNumber")) {
1271          this.modelNumber = castToString(value); // StringType
1272        } else if (name.equals("sterilityIndicator")) {
1273          this.sterilityIndicator = castToCodeableConcept(value); // CodeableConcept
1274        } else if (name.equals("sterilisationRequirement")) {
1275          this.sterilisationRequirement = castToCodeableConcept(value); // CodeableConcept
1276        } else if (name.equals("usage")) {
1277          this.usage = castToCodeableConcept(value); // CodeableConcept
1278        } else if (name.equals("nomenclature")) {
1279          this.getNomenclature().add(castToCodeableConcept(value));
1280        } else if (name.equals("shelfLife")) {
1281          this.getShelfLife().add(castToProductShelfLife(value));
1282        } else if (name.equals("physicalCharacteristics")) {
1283          this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
1284        } else if (name.equals("otherCharacteristics")) {
1285          this.getOtherCharacteristics().add(castToCodeableConcept(value));
1286        } else if (name.equals("batchIdentifier")) {
1287          this.getBatchIdentifier().add(castToIdentifier(value));
1288        } else if (name.equals("manufacturer")) {
1289          this.getManufacturer().add(castToReference(value));
1290        } else if (name.equals("material")) {
1291          this.getMaterial().add((MedicinalProductDeviceSpecMaterialComponent) value);
1292        } else
1293          return super.setProperty(name, value);
1294        return value;
1295      }
1296
1297      @Override
1298      public Base makeProperty(int hash, String name) throws FHIRException {
1299        switch (hash) {
1300        case -1618432855:  return getIdentifier(); 
1301        case 3575610:  return getType(); 
1302        case 752717327:  return getTradeNameElement();
1303        case -1285004149:  return getQuantity(); 
1304        case -1571189011:  return getListingNumberElement();
1305        case 346619858:  return getModelNumberElement();
1306        case -2093506574:  return getSterilityIndicator(); 
1307        case 693339497:  return getSterilisationRequirement(); 
1308        case 111574433:  return getUsage(); 
1309        case 895910775:  return addNomenclature(); 
1310        case 1796889670:  return addShelfLife(); 
1311        case -1599676319:  return getPhysicalCharacteristics(); 
1312        case 722135304:  return addOtherCharacteristics(); 
1313        case -1688395901:  return addBatchIdentifier(); 
1314        case -1969347631:  return addManufacturer(); 
1315        case 299066663:  return addMaterial(); 
1316        default: return super.makeProperty(hash, name);
1317        }
1318
1319      }
1320
1321      @Override
1322      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1323        switch (hash) {
1324        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1325        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1326        case 752717327: /*tradeName*/ return new String[] {"string"};
1327        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1328        case -1571189011: /*listingNumber*/ return new String[] {"string"};
1329        case 346619858: /*modelNumber*/ return new String[] {"string"};
1330        case -2093506574: /*sterilityIndicator*/ return new String[] {"CodeableConcept"};
1331        case 693339497: /*sterilisationRequirement*/ return new String[] {"CodeableConcept"};
1332        case 111574433: /*usage*/ return new String[] {"CodeableConcept"};
1333        case 895910775: /*nomenclature*/ return new String[] {"CodeableConcept"};
1334        case 1796889670: /*shelfLife*/ return new String[] {"ProductShelfLife"};
1335        case -1599676319: /*physicalCharacteristics*/ return new String[] {"ProdCharacteristic"};
1336        case 722135304: /*otherCharacteristics*/ return new String[] {"CodeableConcept"};
1337        case -1688395901: /*batchIdentifier*/ return new String[] {"Identifier"};
1338        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
1339        case 299066663: /*material*/ return new String[] {};
1340        default: return super.getTypesForProperty(hash, name);
1341        }
1342
1343      }
1344
1345      @Override
1346      public Base addChild(String name) throws FHIRException {
1347        if (name.equals("identifier")) {
1348          this.identifier = new Identifier();
1349          return this.identifier;
1350        }
1351        else if (name.equals("type")) {
1352          this.type = new CodeableConcept();
1353          return this.type;
1354        }
1355        else if (name.equals("tradeName")) {
1356          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductDeviceSpec.tradeName");
1357        }
1358        else if (name.equals("quantity")) {
1359          this.quantity = new Quantity();
1360          return this.quantity;
1361        }
1362        else if (name.equals("listingNumber")) {
1363          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductDeviceSpec.listingNumber");
1364        }
1365        else if (name.equals("modelNumber")) {
1366          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductDeviceSpec.modelNumber");
1367        }
1368        else if (name.equals("sterilityIndicator")) {
1369          this.sterilityIndicator = new CodeableConcept();
1370          return this.sterilityIndicator;
1371        }
1372        else if (name.equals("sterilisationRequirement")) {
1373          this.sterilisationRequirement = new CodeableConcept();
1374          return this.sterilisationRequirement;
1375        }
1376        else if (name.equals("usage")) {
1377          this.usage = new CodeableConcept();
1378          return this.usage;
1379        }
1380        else if (name.equals("nomenclature")) {
1381          return addNomenclature();
1382        }
1383        else if (name.equals("shelfLife")) {
1384          return addShelfLife();
1385        }
1386        else if (name.equals("physicalCharacteristics")) {
1387          this.physicalCharacteristics = new ProdCharacteristic();
1388          return this.physicalCharacteristics;
1389        }
1390        else if (name.equals("otherCharacteristics")) {
1391          return addOtherCharacteristics();
1392        }
1393        else if (name.equals("batchIdentifier")) {
1394          return addBatchIdentifier();
1395        }
1396        else if (name.equals("manufacturer")) {
1397          return addManufacturer();
1398        }
1399        else if (name.equals("material")) {
1400          return addMaterial();
1401        }
1402        else
1403          return super.addChild(name);
1404      }
1405
1406  public String fhirType() {
1407    return "MedicinalProductDeviceSpec";
1408
1409  }
1410
1411      public MedicinalProductDeviceSpec copy() {
1412        MedicinalProductDeviceSpec dst = new MedicinalProductDeviceSpec();
1413        copyValues(dst);
1414        dst.identifier = identifier == null ? null : identifier.copy();
1415        dst.type = type == null ? null : type.copy();
1416        dst.tradeName = tradeName == null ? null : tradeName.copy();
1417        dst.quantity = quantity == null ? null : quantity.copy();
1418        dst.listingNumber = listingNumber == null ? null : listingNumber.copy();
1419        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
1420        dst.sterilityIndicator = sterilityIndicator == null ? null : sterilityIndicator.copy();
1421        dst.sterilisationRequirement = sterilisationRequirement == null ? null : sterilisationRequirement.copy();
1422        dst.usage = usage == null ? null : usage.copy();
1423        if (nomenclature != null) {
1424          dst.nomenclature = new ArrayList<CodeableConcept>();
1425          for (CodeableConcept i : nomenclature)
1426            dst.nomenclature.add(i.copy());
1427        };
1428        if (shelfLife != null) {
1429          dst.shelfLife = new ArrayList<ProductShelfLife>();
1430          for (ProductShelfLife i : shelfLife)
1431            dst.shelfLife.add(i.copy());
1432        };
1433        dst.physicalCharacteristics = physicalCharacteristics == null ? null : physicalCharacteristics.copy();
1434        if (otherCharacteristics != null) {
1435          dst.otherCharacteristics = new ArrayList<CodeableConcept>();
1436          for (CodeableConcept i : otherCharacteristics)
1437            dst.otherCharacteristics.add(i.copy());
1438        };
1439        if (batchIdentifier != null) {
1440          dst.batchIdentifier = new ArrayList<Identifier>();
1441          for (Identifier i : batchIdentifier)
1442            dst.batchIdentifier.add(i.copy());
1443        };
1444        if (manufacturer != null) {
1445          dst.manufacturer = new ArrayList<Reference>();
1446          for (Reference i : manufacturer)
1447            dst.manufacturer.add(i.copy());
1448        };
1449        if (material != null) {
1450          dst.material = new ArrayList<MedicinalProductDeviceSpecMaterialComponent>();
1451          for (MedicinalProductDeviceSpecMaterialComponent i : material)
1452            dst.material.add(i.copy());
1453        };
1454        return dst;
1455      }
1456
1457      protected MedicinalProductDeviceSpec typedCopy() {
1458        return copy();
1459      }
1460
1461      @Override
1462      public boolean equalsDeep(Base other_) {
1463        if (!super.equalsDeep(other_))
1464          return false;
1465        if (!(other_ instanceof MedicinalProductDeviceSpec))
1466          return false;
1467        MedicinalProductDeviceSpec o = (MedicinalProductDeviceSpec) other_;
1468        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(tradeName, o.tradeName, true)
1469           && compareDeep(quantity, o.quantity, true) && compareDeep(listingNumber, o.listingNumber, true)
1470           && compareDeep(modelNumber, o.modelNumber, true) && compareDeep(sterilityIndicator, o.sterilityIndicator, true)
1471           && compareDeep(sterilisationRequirement, o.sterilisationRequirement, true) && compareDeep(usage, o.usage, true)
1472           && compareDeep(nomenclature, o.nomenclature, true) && compareDeep(shelfLife, o.shelfLife, true)
1473           && compareDeep(physicalCharacteristics, o.physicalCharacteristics, true) && compareDeep(otherCharacteristics, o.otherCharacteristics, true)
1474           && compareDeep(batchIdentifier, o.batchIdentifier, true) && compareDeep(manufacturer, o.manufacturer, true)
1475           && compareDeep(material, o.material, true);
1476      }
1477
1478      @Override
1479      public boolean equalsShallow(Base other_) {
1480        if (!super.equalsShallow(other_))
1481          return false;
1482        if (!(other_ instanceof MedicinalProductDeviceSpec))
1483          return false;
1484        MedicinalProductDeviceSpec o = (MedicinalProductDeviceSpec) other_;
1485        return compareValues(tradeName, o.tradeName, true) && compareValues(listingNumber, o.listingNumber, true)
1486           && compareValues(modelNumber, o.modelNumber, true);
1487      }
1488
1489      public boolean isEmpty() {
1490        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, tradeName
1491          , quantity, listingNumber, modelNumber, sterilityIndicator, sterilisationRequirement
1492          , usage, nomenclature, shelfLife, physicalCharacteristics, otherCharacteristics, batchIdentifier
1493          , manufacturer, material);
1494      }
1495
1496  @Override
1497  public ResourceType getResourceType() {
1498    return ResourceType.MedicinalProductDeviceSpec;
1499   }
1500
1501
1502}
1503