001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * An ingredient of a manufactured item or pharmaceutical product.
052 */
053@ResourceDef(name="Ingredient", profile="http://hl7.org/fhir/StructureDefinition/Ingredient")
054public class Ingredient extends DomainResource {
055
056    public enum IngredientManufacturerRole {
057        /**
058         * 
059         */
060        ALLOWED, 
061        /**
062         * 
063         */
064        POSSIBLE, 
065        /**
066         * 
067         */
068        ACTUAL, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static IngredientManufacturerRole fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("allowed".equals(codeString))
077          return ALLOWED;
078        if ("possible".equals(codeString))
079          return POSSIBLE;
080        if ("actual".equals(codeString))
081          return ACTUAL;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown IngredientManufacturerRole code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case ALLOWED: return "allowed";
090            case POSSIBLE: return "possible";
091            case ACTUAL: return "actual";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case ALLOWED: return "http://hl7.org/fhir/ingredient-manufacturer-role";
099            case POSSIBLE: return "http://hl7.org/fhir/ingredient-manufacturer-role";
100            case ACTUAL: return "http://hl7.org/fhir/ingredient-manufacturer-role";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case ALLOWED: return "";
108            case POSSIBLE: return "";
109            case ACTUAL: return "";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case ALLOWED: return "Manufacturer is specifically allowed for this ingredient";
117            case POSSIBLE: return "Manufacturer is known to make this ingredient in general";
118            case ACTUAL: return "Manufacturer actually makes this particular ingredient";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class IngredientManufacturerRoleEnumFactory implements EnumFactory<IngredientManufacturerRole> {
126    public IngredientManufacturerRole fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("allowed".equals(codeString))
131          return IngredientManufacturerRole.ALLOWED;
132        if ("possible".equals(codeString))
133          return IngredientManufacturerRole.POSSIBLE;
134        if ("actual".equals(codeString))
135          return IngredientManufacturerRole.ACTUAL;
136        throw new IllegalArgumentException("Unknown IngredientManufacturerRole code '"+codeString+"'");
137        }
138        public Enumeration<IngredientManufacturerRole> fromType(PrimitiveType<?> code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<IngredientManufacturerRole>(this, IngredientManufacturerRole.NULL, code);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return new Enumeration<IngredientManufacturerRole>(this, IngredientManufacturerRole.NULL, code);
146        if ("allowed".equals(codeString))
147          return new Enumeration<IngredientManufacturerRole>(this, IngredientManufacturerRole.ALLOWED, code);
148        if ("possible".equals(codeString))
149          return new Enumeration<IngredientManufacturerRole>(this, IngredientManufacturerRole.POSSIBLE, code);
150        if ("actual".equals(codeString))
151          return new Enumeration<IngredientManufacturerRole>(this, IngredientManufacturerRole.ACTUAL, code);
152        throw new FHIRException("Unknown IngredientManufacturerRole code '"+codeString+"'");
153        }
154    public String toCode(IngredientManufacturerRole code) {
155      if (code == IngredientManufacturerRole.ALLOWED)
156        return "allowed";
157      if (code == IngredientManufacturerRole.POSSIBLE)
158        return "possible";
159      if (code == IngredientManufacturerRole.ACTUAL)
160        return "actual";
161      return "?";
162      }
163    public String toSystem(IngredientManufacturerRole code) {
164      return code.getSystem();
165      }
166    }
167
168    @Block()
169    public static class IngredientManufacturerComponent extends BackboneElement implements IBaseBackboneElement {
170        /**
171         * The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.
172         */
173        @Child(name = "role", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
174        @Description(shortDefinition="allowed | possible | actual", formalDefinition="The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role." )
175        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ingredient-manufacturer-role")
176        protected Enumeration<IngredientManufacturerRole> role;
177
178        /**
179         * An organization that manufactures this ingredient.
180         */
181        @Child(name = "manufacturer", type = {Organization.class}, order=2, min=1, max=1, modifier=false, summary=true)
182        @Description(shortDefinition="An organization that manufactures this ingredient", formalDefinition="An organization that manufactures this ingredient." )
183        protected Reference manufacturer;
184
185        private static final long serialVersionUID = -1226688097L;
186
187    /**
188     * Constructor
189     */
190      public IngredientManufacturerComponent() {
191        super();
192      }
193
194    /**
195     * Constructor
196     */
197      public IngredientManufacturerComponent(Reference manufacturer) {
198        super();
199        this.setManufacturer(manufacturer);
200      }
201
202        /**
203         * @return {@link #role} (The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.). This is the underlying object with id, value and extensions. The accessor "getRole" gives direct access to the value
204         */
205        public Enumeration<IngredientManufacturerRole> getRoleElement() { 
206          if (this.role == null)
207            if (Configuration.errorOnAutoCreate())
208              throw new Error("Attempt to auto-create IngredientManufacturerComponent.role");
209            else if (Configuration.doAutoCreate())
210              this.role = new Enumeration<IngredientManufacturerRole>(new IngredientManufacturerRoleEnumFactory()); // bb
211          return this.role;
212        }
213
214        public boolean hasRoleElement() { 
215          return this.role != null && !this.role.isEmpty();
216        }
217
218        public boolean hasRole() { 
219          return this.role != null && !this.role.isEmpty();
220        }
221
222        /**
223         * @param value {@link #role} (The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.). This is the underlying object with id, value and extensions. The accessor "getRole" gives direct access to the value
224         */
225        public IngredientManufacturerComponent setRoleElement(Enumeration<IngredientManufacturerRole> value) { 
226          this.role = value;
227          return this;
228        }
229
230        /**
231         * @return The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.
232         */
233        public IngredientManufacturerRole getRole() { 
234          return this.role == null ? null : this.role.getValue();
235        }
236
237        /**
238         * @param value The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.
239         */
240        public IngredientManufacturerComponent setRole(IngredientManufacturerRole value) { 
241          if (value == null)
242            this.role = null;
243          else {
244            if (this.role == null)
245              this.role = new Enumeration<IngredientManufacturerRole>(new IngredientManufacturerRoleEnumFactory());
246            this.role.setValue(value);
247          }
248          return this;
249        }
250
251        /**
252         * @return {@link #manufacturer} (An organization that manufactures this ingredient.)
253         */
254        public Reference getManufacturer() { 
255          if (this.manufacturer == null)
256            if (Configuration.errorOnAutoCreate())
257              throw new Error("Attempt to auto-create IngredientManufacturerComponent.manufacturer");
258            else if (Configuration.doAutoCreate())
259              this.manufacturer = new Reference(); // cc
260          return this.manufacturer;
261        }
262
263        public boolean hasManufacturer() { 
264          return this.manufacturer != null && !this.manufacturer.isEmpty();
265        }
266
267        /**
268         * @param value {@link #manufacturer} (An organization that manufactures this ingredient.)
269         */
270        public IngredientManufacturerComponent setManufacturer(Reference value) { 
271          this.manufacturer = value;
272          return this;
273        }
274
275        protected void listChildren(List<Property> children) {
276          super.listChildren(children);
277          children.add(new Property("role", "code", "The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.", 0, 1, role));
278          children.add(new Property("manufacturer", "Reference(Organization)", "An organization that manufactures this ingredient.", 0, 1, manufacturer));
279        }
280
281        @Override
282        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
283          switch (_hash) {
284          case 3506294: /*role*/  return new Property("role", "code", "The way in which this manufacturer is associated with the ingredient. For example whether it is a possible one (others allowed), or an exclusive authorized one for this ingredient. Note that this is not the manufacturing process role.", 0, 1, role);
285          case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "An organization that manufactures this ingredient.", 0, 1, manufacturer);
286          default: return super.getNamedProperty(_hash, _name, _checkValid);
287          }
288
289        }
290
291      @Override
292      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
293        switch (hash) {
294        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // Enumeration<IngredientManufacturerRole>
295        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
296        default: return super.getProperty(hash, name, checkValid);
297        }
298
299      }
300
301      @Override
302      public Base setProperty(int hash, String name, Base value) throws FHIRException {
303        switch (hash) {
304        case 3506294: // role
305          value = new IngredientManufacturerRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
306          this.role = (Enumeration) value; // Enumeration<IngredientManufacturerRole>
307          return value;
308        case -1969347631: // manufacturer
309          this.manufacturer = TypeConvertor.castToReference(value); // Reference
310          return value;
311        default: return super.setProperty(hash, name, value);
312        }
313
314      }
315
316      @Override
317      public Base setProperty(String name, Base value) throws FHIRException {
318        if (name.equals("role")) {
319          value = new IngredientManufacturerRoleEnumFactory().fromType(TypeConvertor.castToCode(value));
320          this.role = (Enumeration) value; // Enumeration<IngredientManufacturerRole>
321        } else if (name.equals("manufacturer")) {
322          this.manufacturer = TypeConvertor.castToReference(value); // Reference
323        } else
324          return super.setProperty(name, value);
325        return value;
326      }
327
328      @Override
329      public Base makeProperty(int hash, String name) throws FHIRException {
330        switch (hash) {
331        case 3506294:  return getRoleElement();
332        case -1969347631:  return getManufacturer();
333        default: return super.makeProperty(hash, name);
334        }
335
336      }
337
338      @Override
339      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
340        switch (hash) {
341        case 3506294: /*role*/ return new String[] {"code"};
342        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
343        default: return super.getTypesForProperty(hash, name);
344        }
345
346      }
347
348      @Override
349      public Base addChild(String name) throws FHIRException {
350        if (name.equals("role")) {
351          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.manufacturer.role");
352        }
353        else if (name.equals("manufacturer")) {
354          this.manufacturer = new Reference();
355          return this.manufacturer;
356        }
357        else
358          return super.addChild(name);
359      }
360
361      public IngredientManufacturerComponent copy() {
362        IngredientManufacturerComponent dst = new IngredientManufacturerComponent();
363        copyValues(dst);
364        return dst;
365      }
366
367      public void copyValues(IngredientManufacturerComponent dst) {
368        super.copyValues(dst);
369        dst.role = role == null ? null : role.copy();
370        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
371      }
372
373      @Override
374      public boolean equalsDeep(Base other_) {
375        if (!super.equalsDeep(other_))
376          return false;
377        if (!(other_ instanceof IngredientManufacturerComponent))
378          return false;
379        IngredientManufacturerComponent o = (IngredientManufacturerComponent) other_;
380        return compareDeep(role, o.role, true) && compareDeep(manufacturer, o.manufacturer, true);
381      }
382
383      @Override
384      public boolean equalsShallow(Base other_) {
385        if (!super.equalsShallow(other_))
386          return false;
387        if (!(other_ instanceof IngredientManufacturerComponent))
388          return false;
389        IngredientManufacturerComponent o = (IngredientManufacturerComponent) other_;
390        return compareValues(role, o.role, true);
391      }
392
393      public boolean isEmpty() {
394        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, manufacturer);
395      }
396
397  public String fhirType() {
398    return "Ingredient.manufacturer";
399
400  }
401
402  }
403
404    @Block()
405    public static class IngredientSubstanceComponent extends BackboneElement implements IBaseBackboneElement {
406        /**
407         * A code or full resource that represents the ingredient's substance.
408         */
409        @Child(name = "code", type = {CodeableReference.class}, order=1, min=1, max=1, modifier=false, summary=true)
410        @Description(shortDefinition="A code or full resource that represents the ingredient substance", formalDefinition="A code or full resource that represents the ingredient's substance." )
411        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-codes")
412        protected CodeableReference code;
413
414        /**
415         * The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength.
416         */
417        @Child(name = "strength", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
418        @Description(shortDefinition="The quantity of substance, per presentation, or per volume or mass, and type of quantity", formalDefinition="The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength." )
419        protected List<IngredientSubstanceStrengthComponent> strength;
420
421        private static final long serialVersionUID = 538347209L;
422
423    /**
424     * Constructor
425     */
426      public IngredientSubstanceComponent() {
427        super();
428      }
429
430    /**
431     * Constructor
432     */
433      public IngredientSubstanceComponent(CodeableReference code) {
434        super();
435        this.setCode(code);
436      }
437
438        /**
439         * @return {@link #code} (A code or full resource that represents the ingredient's substance.)
440         */
441        public CodeableReference getCode() { 
442          if (this.code == null)
443            if (Configuration.errorOnAutoCreate())
444              throw new Error("Attempt to auto-create IngredientSubstanceComponent.code");
445            else if (Configuration.doAutoCreate())
446              this.code = new CodeableReference(); // cc
447          return this.code;
448        }
449
450        public boolean hasCode() { 
451          return this.code != null && !this.code.isEmpty();
452        }
453
454        /**
455         * @param value {@link #code} (A code or full resource that represents the ingredient's substance.)
456         */
457        public IngredientSubstanceComponent setCode(CodeableReference value) { 
458          this.code = value;
459          return this;
460        }
461
462        /**
463         * @return {@link #strength} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength.)
464         */
465        public List<IngredientSubstanceStrengthComponent> getStrength() { 
466          if (this.strength == null)
467            this.strength = new ArrayList<IngredientSubstanceStrengthComponent>();
468          return this.strength;
469        }
470
471        /**
472         * @return Returns a reference to <code>this</code> for easy method chaining
473         */
474        public IngredientSubstanceComponent setStrength(List<IngredientSubstanceStrengthComponent> theStrength) { 
475          this.strength = theStrength;
476          return this;
477        }
478
479        public boolean hasStrength() { 
480          if (this.strength == null)
481            return false;
482          for (IngredientSubstanceStrengthComponent item : this.strength)
483            if (!item.isEmpty())
484              return true;
485          return false;
486        }
487
488        public IngredientSubstanceStrengthComponent addStrength() { //3
489          IngredientSubstanceStrengthComponent t = new IngredientSubstanceStrengthComponent();
490          if (this.strength == null)
491            this.strength = new ArrayList<IngredientSubstanceStrengthComponent>();
492          this.strength.add(t);
493          return t;
494        }
495
496        public IngredientSubstanceComponent addStrength(IngredientSubstanceStrengthComponent t) { //3
497          if (t == null)
498            return this;
499          if (this.strength == null)
500            this.strength = new ArrayList<IngredientSubstanceStrengthComponent>();
501          this.strength.add(t);
502          return this;
503        }
504
505        /**
506         * @return The first repetition of repeating field {@link #strength}, creating it if it does not already exist {3}
507         */
508        public IngredientSubstanceStrengthComponent getStrengthFirstRep() { 
509          if (getStrength().isEmpty()) {
510            addStrength();
511          }
512          return getStrength().get(0);
513        }
514
515        protected void listChildren(List<Property> children) {
516          super.listChildren(children);
517          children.add(new Property("code", "CodeableReference(SubstanceDefinition)", "A code or full resource that represents the ingredient's substance.", 0, 1, code));
518          children.add(new Property("strength", "", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength.", 0, java.lang.Integer.MAX_VALUE, strength));
519        }
520
521        @Override
522        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
523          switch (_hash) {
524          case 3059181: /*code*/  return new Property("code", "CodeableReference(SubstanceDefinition)", "A code or full resource that represents the ingredient's substance.", 0, 1, code);
525          case 1791316033: /*strength*/  return new Property("strength", "", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. The allowed repetitions do not represent different strengths, but are different representations - mathematically equivalent - of a single strength.", 0, java.lang.Integer.MAX_VALUE, strength);
526          default: return super.getNamedProperty(_hash, _name, _checkValid);
527          }
528
529        }
530
531      @Override
532      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
533        switch (hash) {
534        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableReference
535        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : this.strength.toArray(new Base[this.strength.size()]); // IngredientSubstanceStrengthComponent
536        default: return super.getProperty(hash, name, checkValid);
537        }
538
539      }
540
541      @Override
542      public Base setProperty(int hash, String name, Base value) throws FHIRException {
543        switch (hash) {
544        case 3059181: // code
545          this.code = TypeConvertor.castToCodeableReference(value); // CodeableReference
546          return value;
547        case 1791316033: // strength
548          this.getStrength().add((IngredientSubstanceStrengthComponent) value); // IngredientSubstanceStrengthComponent
549          return value;
550        default: return super.setProperty(hash, name, value);
551        }
552
553      }
554
555      @Override
556      public Base setProperty(String name, Base value) throws FHIRException {
557        if (name.equals("code")) {
558          this.code = TypeConvertor.castToCodeableReference(value); // CodeableReference
559        } else if (name.equals("strength")) {
560          this.getStrength().add((IngredientSubstanceStrengthComponent) value);
561        } else
562          return super.setProperty(name, value);
563        return value;
564      }
565
566      @Override
567      public Base makeProperty(int hash, String name) throws FHIRException {
568        switch (hash) {
569        case 3059181:  return getCode();
570        case 1791316033:  return addStrength(); 
571        default: return super.makeProperty(hash, name);
572        }
573
574      }
575
576      @Override
577      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
578        switch (hash) {
579        case 3059181: /*code*/ return new String[] {"CodeableReference"};
580        case 1791316033: /*strength*/ return new String[] {};
581        default: return super.getTypesForProperty(hash, name);
582        }
583
584      }
585
586      @Override
587      public Base addChild(String name) throws FHIRException {
588        if (name.equals("code")) {
589          this.code = new CodeableReference();
590          return this.code;
591        }
592        else if (name.equals("strength")) {
593          return addStrength();
594        }
595        else
596          return super.addChild(name);
597      }
598
599      public IngredientSubstanceComponent copy() {
600        IngredientSubstanceComponent dst = new IngredientSubstanceComponent();
601        copyValues(dst);
602        return dst;
603      }
604
605      public void copyValues(IngredientSubstanceComponent dst) {
606        super.copyValues(dst);
607        dst.code = code == null ? null : code.copy();
608        if (strength != null) {
609          dst.strength = new ArrayList<IngredientSubstanceStrengthComponent>();
610          for (IngredientSubstanceStrengthComponent i : strength)
611            dst.strength.add(i.copy());
612        };
613      }
614
615      @Override
616      public boolean equalsDeep(Base other_) {
617        if (!super.equalsDeep(other_))
618          return false;
619        if (!(other_ instanceof IngredientSubstanceComponent))
620          return false;
621        IngredientSubstanceComponent o = (IngredientSubstanceComponent) other_;
622        return compareDeep(code, o.code, true) && compareDeep(strength, o.strength, true);
623      }
624
625      @Override
626      public boolean equalsShallow(Base other_) {
627        if (!super.equalsShallow(other_))
628          return false;
629        if (!(other_ instanceof IngredientSubstanceComponent))
630          return false;
631        IngredientSubstanceComponent o = (IngredientSubstanceComponent) other_;
632        return true;
633      }
634
635      public boolean isEmpty() {
636        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, strength);
637      }
638
639  public String fhirType() {
640    return "Ingredient.substance";
641
642  }
643
644  }
645
646    @Block()
647    public static class IngredientSubstanceStrengthComponent extends BackboneElement implements IBaseBackboneElement {
648        /**
649         * The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').
650         */
651        @Child(name = "presentation", type = {Ratio.class, RatioRange.class, CodeableConcept.class, Quantity.class}, order=1, min=0, max=1, modifier=false, summary=true)
652        @Description(shortDefinition="The quantity of substance in the unit of presentation", formalDefinition="The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg')." )
653        protected DataType presentation;
654
655        /**
656         * A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.
657         */
658        @Child(name = "textPresentation", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
659        @Description(shortDefinition="Text of either the whole presentation strength or a part of it (rest being in Strength.presentation as a ratio)", formalDefinition="A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio." )
660        protected StringType textPresentation;
661
662        /**
663         * The strength per unitary volume (or mass).
664         */
665        @Child(name = "concentration", type = {Ratio.class, RatioRange.class, CodeableConcept.class, Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
666        @Description(shortDefinition="The strength per unitary volume (or mass)", formalDefinition="The strength per unitary volume (or mass)." )
667        protected DataType concentration;
668
669        /**
670         * A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.
671         */
672        @Child(name = "textConcentration", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
673        @Description(shortDefinition="Text of either the whole concentration strength or a part of it (rest being in Strength.concentration as a ratio)", formalDefinition="A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio." )
674        protected StringType textConcentration;
675
676        /**
677         * A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).
678         */
679        @Child(name = "basis", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
680        @Description(shortDefinition="A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt)", formalDefinition="A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt)." )
681        protected CodeableConcept basis;
682
683        /**
684         * For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.
685         */
686        @Child(name = "measurementPoint", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
687        @Description(shortDefinition="When strength is measured at a particular point or distance", formalDefinition="For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization." )
688        protected StringType measurementPoint;
689
690        /**
691         * The country or countries for which the strength range applies.
692         */
693        @Child(name = "country", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
694        @Description(shortDefinition="Where the strength range applies", formalDefinition="The country or countries for which the strength range applies." )
695        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/country")
696        protected List<CodeableConcept> country;
697
698        /**
699         * Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed.
700         */
701        @Child(name = "referenceStrength", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
702        @Description(shortDefinition="Strength expressed in terms of a reference substance", formalDefinition="Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed." )
703        protected List<IngredientSubstanceStrengthReferenceStrengthComponent> referenceStrength;
704
705        private static final long serialVersionUID = 1409093088L;
706
707    /**
708     * Constructor
709     */
710      public IngredientSubstanceStrengthComponent() {
711        super();
712      }
713
714        /**
715         * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
716         */
717        public DataType getPresentation() { 
718          return this.presentation;
719        }
720
721        /**
722         * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
723         */
724        public Ratio getPresentationRatio() throws FHIRException { 
725          if (this.presentation == null)
726            this.presentation = new Ratio();
727          if (!(this.presentation instanceof Ratio))
728            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.presentation.getClass().getName()+" was encountered");
729          return (Ratio) this.presentation;
730        }
731
732        public boolean hasPresentationRatio() { 
733          return this != null && this.presentation instanceof Ratio;
734        }
735
736        /**
737         * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
738         */
739        public RatioRange getPresentationRatioRange() throws FHIRException { 
740          if (this.presentation == null)
741            this.presentation = new RatioRange();
742          if (!(this.presentation instanceof RatioRange))
743            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.presentation.getClass().getName()+" was encountered");
744          return (RatioRange) this.presentation;
745        }
746
747        public boolean hasPresentationRatioRange() { 
748          return this != null && this.presentation instanceof RatioRange;
749        }
750
751        /**
752         * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
753         */
754        public CodeableConcept getPresentationCodeableConcept() throws FHIRException { 
755          if (this.presentation == null)
756            this.presentation = new CodeableConcept();
757          if (!(this.presentation instanceof CodeableConcept))
758            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.presentation.getClass().getName()+" was encountered");
759          return (CodeableConcept) this.presentation;
760        }
761
762        public boolean hasPresentationCodeableConcept() { 
763          return this != null && this.presentation instanceof CodeableConcept;
764        }
765
766        /**
767         * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
768         */
769        public Quantity getPresentationQuantity() throws FHIRException { 
770          if (this.presentation == null)
771            this.presentation = new Quantity();
772          if (!(this.presentation instanceof Quantity))
773            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.presentation.getClass().getName()+" was encountered");
774          return (Quantity) this.presentation;
775        }
776
777        public boolean hasPresentationQuantity() { 
778          return this != null && this.presentation instanceof Quantity;
779        }
780
781        public boolean hasPresentation() { 
782          return this.presentation != null && !this.presentation.isEmpty();
783        }
784
785        /**
786         * @param value {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').)
787         */
788        public IngredientSubstanceStrengthComponent setPresentation(DataType value) { 
789          if (value != null && !(value instanceof Ratio || value instanceof RatioRange || value instanceof CodeableConcept || value instanceof Quantity))
790            throw new Error("Not the right type for Ingredient.substance.strength.presentation[x]: "+value.fhirType());
791          this.presentation = value;
792          return this;
793        }
794
795        /**
796         * @return {@link #textPresentation} (A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.). This is the underlying object with id, value and extensions. The accessor "getTextPresentation" gives direct access to the value
797         */
798        public StringType getTextPresentationElement() { 
799          if (this.textPresentation == null)
800            if (Configuration.errorOnAutoCreate())
801              throw new Error("Attempt to auto-create IngredientSubstanceStrengthComponent.textPresentation");
802            else if (Configuration.doAutoCreate())
803              this.textPresentation = new StringType(); // bb
804          return this.textPresentation;
805        }
806
807        public boolean hasTextPresentationElement() { 
808          return this.textPresentation != null && !this.textPresentation.isEmpty();
809        }
810
811        public boolean hasTextPresentation() { 
812          return this.textPresentation != null && !this.textPresentation.isEmpty();
813        }
814
815        /**
816         * @param value {@link #textPresentation} (A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.). This is the underlying object with id, value and extensions. The accessor "getTextPresentation" gives direct access to the value
817         */
818        public IngredientSubstanceStrengthComponent setTextPresentationElement(StringType value) { 
819          this.textPresentation = value;
820          return this;
821        }
822
823        /**
824         * @return A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.
825         */
826        public String getTextPresentation() { 
827          return this.textPresentation == null ? null : this.textPresentation.getValue();
828        }
829
830        /**
831         * @param value A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.
832         */
833        public IngredientSubstanceStrengthComponent setTextPresentation(String value) { 
834          if (Utilities.noString(value))
835            this.textPresentation = null;
836          else {
837            if (this.textPresentation == null)
838              this.textPresentation = new StringType();
839            this.textPresentation.setValue(value);
840          }
841          return this;
842        }
843
844        /**
845         * @return {@link #concentration} (The strength per unitary volume (or mass).)
846         */
847        public DataType getConcentration() { 
848          return this.concentration;
849        }
850
851        /**
852         * @return {@link #concentration} (The strength per unitary volume (or mass).)
853         */
854        public Ratio getConcentrationRatio() throws FHIRException { 
855          if (this.concentration == null)
856            this.concentration = new Ratio();
857          if (!(this.concentration instanceof Ratio))
858            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.concentration.getClass().getName()+" was encountered");
859          return (Ratio) this.concentration;
860        }
861
862        public boolean hasConcentrationRatio() { 
863          return this != null && this.concentration instanceof Ratio;
864        }
865
866        /**
867         * @return {@link #concentration} (The strength per unitary volume (or mass).)
868         */
869        public RatioRange getConcentrationRatioRange() throws FHIRException { 
870          if (this.concentration == null)
871            this.concentration = new RatioRange();
872          if (!(this.concentration instanceof RatioRange))
873            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.concentration.getClass().getName()+" was encountered");
874          return (RatioRange) this.concentration;
875        }
876
877        public boolean hasConcentrationRatioRange() { 
878          return this != null && this.concentration instanceof RatioRange;
879        }
880
881        /**
882         * @return {@link #concentration} (The strength per unitary volume (or mass).)
883         */
884        public CodeableConcept getConcentrationCodeableConcept() throws FHIRException { 
885          if (this.concentration == null)
886            this.concentration = new CodeableConcept();
887          if (!(this.concentration instanceof CodeableConcept))
888            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.concentration.getClass().getName()+" was encountered");
889          return (CodeableConcept) this.concentration;
890        }
891
892        public boolean hasConcentrationCodeableConcept() { 
893          return this != null && this.concentration instanceof CodeableConcept;
894        }
895
896        /**
897         * @return {@link #concentration} (The strength per unitary volume (or mass).)
898         */
899        public Quantity getConcentrationQuantity() throws FHIRException { 
900          if (this.concentration == null)
901            this.concentration = new Quantity();
902          if (!(this.concentration instanceof Quantity))
903            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.concentration.getClass().getName()+" was encountered");
904          return (Quantity) this.concentration;
905        }
906
907        public boolean hasConcentrationQuantity() { 
908          return this != null && this.concentration instanceof Quantity;
909        }
910
911        public boolean hasConcentration() { 
912          return this.concentration != null && !this.concentration.isEmpty();
913        }
914
915        /**
916         * @param value {@link #concentration} (The strength per unitary volume (or mass).)
917         */
918        public IngredientSubstanceStrengthComponent setConcentration(DataType value) { 
919          if (value != null && !(value instanceof Ratio || value instanceof RatioRange || value instanceof CodeableConcept || value instanceof Quantity))
920            throw new Error("Not the right type for Ingredient.substance.strength.concentration[x]: "+value.fhirType());
921          this.concentration = value;
922          return this;
923        }
924
925        /**
926         * @return {@link #textConcentration} (A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.). This is the underlying object with id, value and extensions. The accessor "getTextConcentration" gives direct access to the value
927         */
928        public StringType getTextConcentrationElement() { 
929          if (this.textConcentration == null)
930            if (Configuration.errorOnAutoCreate())
931              throw new Error("Attempt to auto-create IngredientSubstanceStrengthComponent.textConcentration");
932            else if (Configuration.doAutoCreate())
933              this.textConcentration = new StringType(); // bb
934          return this.textConcentration;
935        }
936
937        public boolean hasTextConcentrationElement() { 
938          return this.textConcentration != null && !this.textConcentration.isEmpty();
939        }
940
941        public boolean hasTextConcentration() { 
942          return this.textConcentration != null && !this.textConcentration.isEmpty();
943        }
944
945        /**
946         * @param value {@link #textConcentration} (A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.). This is the underlying object with id, value and extensions. The accessor "getTextConcentration" gives direct access to the value
947         */
948        public IngredientSubstanceStrengthComponent setTextConcentrationElement(StringType value) { 
949          this.textConcentration = value;
950          return this;
951        }
952
953        /**
954         * @return A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.
955         */
956        public String getTextConcentration() { 
957          return this.textConcentration == null ? null : this.textConcentration.getValue();
958        }
959
960        /**
961         * @param value A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.
962         */
963        public IngredientSubstanceStrengthComponent setTextConcentration(String value) { 
964          if (Utilities.noString(value))
965            this.textConcentration = null;
966          else {
967            if (this.textConcentration == null)
968              this.textConcentration = new StringType();
969            this.textConcentration.setValue(value);
970          }
971          return this;
972        }
973
974        /**
975         * @return {@link #basis} (A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).)
976         */
977        public CodeableConcept getBasis() { 
978          if (this.basis == null)
979            if (Configuration.errorOnAutoCreate())
980              throw new Error("Attempt to auto-create IngredientSubstanceStrengthComponent.basis");
981            else if (Configuration.doAutoCreate())
982              this.basis = new CodeableConcept(); // cc
983          return this.basis;
984        }
985
986        public boolean hasBasis() { 
987          return this.basis != null && !this.basis.isEmpty();
988        }
989
990        /**
991         * @param value {@link #basis} (A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).)
992         */
993        public IngredientSubstanceStrengthComponent setBasis(CodeableConcept value) { 
994          this.basis = value;
995          return this;
996        }
997
998        /**
999         * @return {@link #measurementPoint} (For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value
1000         */
1001        public StringType getMeasurementPointElement() { 
1002          if (this.measurementPoint == null)
1003            if (Configuration.errorOnAutoCreate())
1004              throw new Error("Attempt to auto-create IngredientSubstanceStrengthComponent.measurementPoint");
1005            else if (Configuration.doAutoCreate())
1006              this.measurementPoint = new StringType(); // bb
1007          return this.measurementPoint;
1008        }
1009
1010        public boolean hasMeasurementPointElement() { 
1011          return this.measurementPoint != null && !this.measurementPoint.isEmpty();
1012        }
1013
1014        public boolean hasMeasurementPoint() { 
1015          return this.measurementPoint != null && !this.measurementPoint.isEmpty();
1016        }
1017
1018        /**
1019         * @param value {@link #measurementPoint} (For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value
1020         */
1021        public IngredientSubstanceStrengthComponent setMeasurementPointElement(StringType value) { 
1022          this.measurementPoint = value;
1023          return this;
1024        }
1025
1026        /**
1027         * @return For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.
1028         */
1029        public String getMeasurementPoint() { 
1030          return this.measurementPoint == null ? null : this.measurementPoint.getValue();
1031        }
1032
1033        /**
1034         * @param value For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.
1035         */
1036        public IngredientSubstanceStrengthComponent setMeasurementPoint(String value) { 
1037          if (Utilities.noString(value))
1038            this.measurementPoint = null;
1039          else {
1040            if (this.measurementPoint == null)
1041              this.measurementPoint = new StringType();
1042            this.measurementPoint.setValue(value);
1043          }
1044          return this;
1045        }
1046
1047        /**
1048         * @return {@link #country} (The country or countries for which the strength range applies.)
1049         */
1050        public List<CodeableConcept> getCountry() { 
1051          if (this.country == null)
1052            this.country = new ArrayList<CodeableConcept>();
1053          return this.country;
1054        }
1055
1056        /**
1057         * @return Returns a reference to <code>this</code> for easy method chaining
1058         */
1059        public IngredientSubstanceStrengthComponent setCountry(List<CodeableConcept> theCountry) { 
1060          this.country = theCountry;
1061          return this;
1062        }
1063
1064        public boolean hasCountry() { 
1065          if (this.country == null)
1066            return false;
1067          for (CodeableConcept item : this.country)
1068            if (!item.isEmpty())
1069              return true;
1070          return false;
1071        }
1072
1073        public CodeableConcept addCountry() { //3
1074          CodeableConcept t = new CodeableConcept();
1075          if (this.country == null)
1076            this.country = new ArrayList<CodeableConcept>();
1077          this.country.add(t);
1078          return t;
1079        }
1080
1081        public IngredientSubstanceStrengthComponent addCountry(CodeableConcept t) { //3
1082          if (t == null)
1083            return this;
1084          if (this.country == null)
1085            this.country = new ArrayList<CodeableConcept>();
1086          this.country.add(t);
1087          return this;
1088        }
1089
1090        /**
1091         * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist {3}
1092         */
1093        public CodeableConcept getCountryFirstRep() { 
1094          if (getCountry().isEmpty()) {
1095            addCountry();
1096          }
1097          return getCountry().get(0);
1098        }
1099
1100        /**
1101         * @return {@link #referenceStrength} (Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed.)
1102         */
1103        public List<IngredientSubstanceStrengthReferenceStrengthComponent> getReferenceStrength() { 
1104          if (this.referenceStrength == null)
1105            this.referenceStrength = new ArrayList<IngredientSubstanceStrengthReferenceStrengthComponent>();
1106          return this.referenceStrength;
1107        }
1108
1109        /**
1110         * @return Returns a reference to <code>this</code> for easy method chaining
1111         */
1112        public IngredientSubstanceStrengthComponent setReferenceStrength(List<IngredientSubstanceStrengthReferenceStrengthComponent> theReferenceStrength) { 
1113          this.referenceStrength = theReferenceStrength;
1114          return this;
1115        }
1116
1117        public boolean hasReferenceStrength() { 
1118          if (this.referenceStrength == null)
1119            return false;
1120          for (IngredientSubstanceStrengthReferenceStrengthComponent item : this.referenceStrength)
1121            if (!item.isEmpty())
1122              return true;
1123          return false;
1124        }
1125
1126        public IngredientSubstanceStrengthReferenceStrengthComponent addReferenceStrength() { //3
1127          IngredientSubstanceStrengthReferenceStrengthComponent t = new IngredientSubstanceStrengthReferenceStrengthComponent();
1128          if (this.referenceStrength == null)
1129            this.referenceStrength = new ArrayList<IngredientSubstanceStrengthReferenceStrengthComponent>();
1130          this.referenceStrength.add(t);
1131          return t;
1132        }
1133
1134        public IngredientSubstanceStrengthComponent addReferenceStrength(IngredientSubstanceStrengthReferenceStrengthComponent t) { //3
1135          if (t == null)
1136            return this;
1137          if (this.referenceStrength == null)
1138            this.referenceStrength = new ArrayList<IngredientSubstanceStrengthReferenceStrengthComponent>();
1139          this.referenceStrength.add(t);
1140          return this;
1141        }
1142
1143        /**
1144         * @return The first repetition of repeating field {@link #referenceStrength}, creating it if it does not already exist {3}
1145         */
1146        public IngredientSubstanceStrengthReferenceStrengthComponent getReferenceStrengthFirstRep() { 
1147          if (getReferenceStrength().isEmpty()) {
1148            addReferenceStrength();
1149          }
1150          return getReferenceStrength().get(0);
1151        }
1152
1153        protected void listChildren(List<Property> children) {
1154          super.listChildren(children);
1155          children.add(new Property("presentation[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation));
1156          children.add(new Property("textPresentation", "string", "A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.", 0, 1, textPresentation));
1157          children.add(new Property("concentration[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The strength per unitary volume (or mass).", 0, 1, concentration));
1158          children.add(new Property("textConcentration", "string", "A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.", 0, 1, textConcentration));
1159          children.add(new Property("basis", "CodeableConcept", "A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).", 0, 1, basis));
1160          children.add(new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.", 0, 1, measurementPoint));
1161          children.add(new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country));
1162          children.add(new Property("referenceStrength", "", "Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed.", 0, java.lang.Integer.MAX_VALUE, referenceStrength));
1163        }
1164
1165        @Override
1166        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1167          switch (_hash) {
1168          case 1714280230: /*presentation[x]*/  return new Property("presentation[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1169          case 696975130: /*presentation*/  return new Property("presentation[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1170          case -1853112047: /*presentationRatio*/  return new Property("presentation[x]", "Ratio", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1171          case 643336876: /*presentationRatioRange*/  return new Property("presentation[x]", "RatioRange", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1172          case 1095127335: /*presentationCodeableConcept*/  return new Property("presentation[x]", "CodeableConcept", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1173          case -263057979: /*presentationQuantity*/  return new Property("presentation[x]", "Quantity", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. Unit of presentation refers to the quantity that the item occurs in e.g. a strength per tablet size, perhaps 'per 20mg' (the size of the tablet). It is not generally normalized as a unitary unit, which would be 'per mg').", 0, 1, presentation);
1174          case -799720217: /*textPresentation*/  return new Property("textPresentation", "string", "A textual represention of either the whole of the presentation strength or a part of it - with the rest being in Strength.presentation as a ratio.", 0, 1, textPresentation);
1175          case 1153502451: /*concentration[x]*/  return new Property("concentration[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The strength per unitary volume (or mass).", 0, 1, concentration);
1176          case -410557331: /*concentration*/  return new Property("concentration[x]", "Ratio|RatioRange|CodeableConcept|Quantity", "The strength per unitary volume (or mass).", 0, 1, concentration);
1177          case 405321630: /*concentrationRatio*/  return new Property("concentration[x]", "Ratio", "The strength per unitary volume (or mass).", 0, 1, concentration);
1178          case 436249663: /*concentrationRatioRange*/  return new Property("concentration[x]", "RatioRange", "The strength per unitary volume (or mass).", 0, 1, concentration);
1179          case -90293388: /*concentrationCodeableConcept*/  return new Property("concentration[x]", "CodeableConcept", "The strength per unitary volume (or mass).", 0, 1, concentration);
1180          case 71921688: /*concentrationQuantity*/  return new Property("concentration[x]", "Quantity", "The strength per unitary volume (or mass).", 0, 1, concentration);
1181          case 436527168: /*textConcentration*/  return new Property("textConcentration", "string", "A textual represention of either the whole of the concentration strength or a part of it - with the rest being in Strength.concentration as a ratio.", 0, 1, textConcentration);
1182          case 93508670: /*basis*/  return new Property("basis", "CodeableConcept", "A code that indicates if the strength is, for example, based on the ingredient substance as stated or on the substance base (when the ingredient is a salt).", 0, 1, basis);
1183          case 235437876: /*measurementPoint*/  return new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance. There are products where strength is measured at a particular point. For example, the strength of the ingredient in some inhalers is measured at a particular position relative to the point of aerosolization.", 0, 1, measurementPoint);
1184          case 957831062: /*country*/  return new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country);
1185          case 1943566508: /*referenceStrength*/  return new Property("referenceStrength", "", "Strength expressed in terms of a reference substance. For when the ingredient strength is additionally expressed as equivalent to the strength of some other closely related substance (e.g. salt vs. base). Reference strength represents the strength (quantitative composition) of the active moiety of the active substance. There are situations when the active substance and active moiety are different, therefore both a strength and a reference strength are needed.", 0, java.lang.Integer.MAX_VALUE, referenceStrength);
1186          default: return super.getNamedProperty(_hash, _name, _checkValid);
1187          }
1188
1189        }
1190
1191      @Override
1192      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1193        switch (hash) {
1194        case 696975130: /*presentation*/ return this.presentation == null ? new Base[0] : new Base[] {this.presentation}; // DataType
1195        case -799720217: /*textPresentation*/ return this.textPresentation == null ? new Base[0] : new Base[] {this.textPresentation}; // StringType
1196        case -410557331: /*concentration*/ return this.concentration == null ? new Base[0] : new Base[] {this.concentration}; // DataType
1197        case 436527168: /*textConcentration*/ return this.textConcentration == null ? new Base[0] : new Base[] {this.textConcentration}; // StringType
1198        case 93508670: /*basis*/ return this.basis == null ? new Base[0] : new Base[] {this.basis}; // CodeableConcept
1199        case 235437876: /*measurementPoint*/ return this.measurementPoint == null ? new Base[0] : new Base[] {this.measurementPoint}; // StringType
1200        case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept
1201        case 1943566508: /*referenceStrength*/ return this.referenceStrength == null ? new Base[0] : this.referenceStrength.toArray(new Base[this.referenceStrength.size()]); // IngredientSubstanceStrengthReferenceStrengthComponent
1202        default: return super.getProperty(hash, name, checkValid);
1203        }
1204
1205      }
1206
1207      @Override
1208      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1209        switch (hash) {
1210        case 696975130: // presentation
1211          this.presentation = TypeConvertor.castToType(value); // DataType
1212          return value;
1213        case -799720217: // textPresentation
1214          this.textPresentation = TypeConvertor.castToString(value); // StringType
1215          return value;
1216        case -410557331: // concentration
1217          this.concentration = TypeConvertor.castToType(value); // DataType
1218          return value;
1219        case 436527168: // textConcentration
1220          this.textConcentration = TypeConvertor.castToString(value); // StringType
1221          return value;
1222        case 93508670: // basis
1223          this.basis = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1224          return value;
1225        case 235437876: // measurementPoint
1226          this.measurementPoint = TypeConvertor.castToString(value); // StringType
1227          return value;
1228        case 957831062: // country
1229          this.getCountry().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1230          return value;
1231        case 1943566508: // referenceStrength
1232          this.getReferenceStrength().add((IngredientSubstanceStrengthReferenceStrengthComponent) value); // IngredientSubstanceStrengthReferenceStrengthComponent
1233          return value;
1234        default: return super.setProperty(hash, name, value);
1235        }
1236
1237      }
1238
1239      @Override
1240      public Base setProperty(String name, Base value) throws FHIRException {
1241        if (name.equals("presentation[x]")) {
1242          this.presentation = TypeConvertor.castToType(value); // DataType
1243        } else if (name.equals("textPresentation")) {
1244          this.textPresentation = TypeConvertor.castToString(value); // StringType
1245        } else if (name.equals("concentration[x]")) {
1246          this.concentration = TypeConvertor.castToType(value); // DataType
1247        } else if (name.equals("textConcentration")) {
1248          this.textConcentration = TypeConvertor.castToString(value); // StringType
1249        } else if (name.equals("basis")) {
1250          this.basis = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1251        } else if (name.equals("measurementPoint")) {
1252          this.measurementPoint = TypeConvertor.castToString(value); // StringType
1253        } else if (name.equals("country")) {
1254          this.getCountry().add(TypeConvertor.castToCodeableConcept(value));
1255        } else if (name.equals("referenceStrength")) {
1256          this.getReferenceStrength().add((IngredientSubstanceStrengthReferenceStrengthComponent) value);
1257        } else
1258          return super.setProperty(name, value);
1259        return value;
1260      }
1261
1262      @Override
1263      public Base makeProperty(int hash, String name) throws FHIRException {
1264        switch (hash) {
1265        case 1714280230:  return getPresentation();
1266        case 696975130:  return getPresentation();
1267        case -799720217:  return getTextPresentationElement();
1268        case 1153502451:  return getConcentration();
1269        case -410557331:  return getConcentration();
1270        case 436527168:  return getTextConcentrationElement();
1271        case 93508670:  return getBasis();
1272        case 235437876:  return getMeasurementPointElement();
1273        case 957831062:  return addCountry(); 
1274        case 1943566508:  return addReferenceStrength(); 
1275        default: return super.makeProperty(hash, name);
1276        }
1277
1278      }
1279
1280      @Override
1281      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1282        switch (hash) {
1283        case 696975130: /*presentation*/ return new String[] {"Ratio", "RatioRange", "CodeableConcept", "Quantity"};
1284        case -799720217: /*textPresentation*/ return new String[] {"string"};
1285        case -410557331: /*concentration*/ return new String[] {"Ratio", "RatioRange", "CodeableConcept", "Quantity"};
1286        case 436527168: /*textConcentration*/ return new String[] {"string"};
1287        case 93508670: /*basis*/ return new String[] {"CodeableConcept"};
1288        case 235437876: /*measurementPoint*/ return new String[] {"string"};
1289        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
1290        case 1943566508: /*referenceStrength*/ return new String[] {};
1291        default: return super.getTypesForProperty(hash, name);
1292        }
1293
1294      }
1295
1296      @Override
1297      public Base addChild(String name) throws FHIRException {
1298        if (name.equals("presentationRatio")) {
1299          this.presentation = new Ratio();
1300          return this.presentation;
1301        }
1302        else if (name.equals("presentationRatioRange")) {
1303          this.presentation = new RatioRange();
1304          return this.presentation;
1305        }
1306        else if (name.equals("presentationCodeableConcept")) {
1307          this.presentation = new CodeableConcept();
1308          return this.presentation;
1309        }
1310        else if (name.equals("presentationQuantity")) {
1311          this.presentation = new Quantity();
1312          return this.presentation;
1313        }
1314        else if (name.equals("textPresentation")) {
1315          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.substance.strength.textPresentation");
1316        }
1317        else if (name.equals("concentrationRatio")) {
1318          this.concentration = new Ratio();
1319          return this.concentration;
1320        }
1321        else if (name.equals("concentrationRatioRange")) {
1322          this.concentration = new RatioRange();
1323          return this.concentration;
1324        }
1325        else if (name.equals("concentrationCodeableConcept")) {
1326          this.concentration = new CodeableConcept();
1327          return this.concentration;
1328        }
1329        else if (name.equals("concentrationQuantity")) {
1330          this.concentration = new Quantity();
1331          return this.concentration;
1332        }
1333        else if (name.equals("textConcentration")) {
1334          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.substance.strength.textConcentration");
1335        }
1336        else if (name.equals("basis")) {
1337          this.basis = new CodeableConcept();
1338          return this.basis;
1339        }
1340        else if (name.equals("measurementPoint")) {
1341          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.substance.strength.measurementPoint");
1342        }
1343        else if (name.equals("country")) {
1344          return addCountry();
1345        }
1346        else if (name.equals("referenceStrength")) {
1347          return addReferenceStrength();
1348        }
1349        else
1350          return super.addChild(name);
1351      }
1352
1353      public IngredientSubstanceStrengthComponent copy() {
1354        IngredientSubstanceStrengthComponent dst = new IngredientSubstanceStrengthComponent();
1355        copyValues(dst);
1356        return dst;
1357      }
1358
1359      public void copyValues(IngredientSubstanceStrengthComponent dst) {
1360        super.copyValues(dst);
1361        dst.presentation = presentation == null ? null : presentation.copy();
1362        dst.textPresentation = textPresentation == null ? null : textPresentation.copy();
1363        dst.concentration = concentration == null ? null : concentration.copy();
1364        dst.textConcentration = textConcentration == null ? null : textConcentration.copy();
1365        dst.basis = basis == null ? null : basis.copy();
1366        dst.measurementPoint = measurementPoint == null ? null : measurementPoint.copy();
1367        if (country != null) {
1368          dst.country = new ArrayList<CodeableConcept>();
1369          for (CodeableConcept i : country)
1370            dst.country.add(i.copy());
1371        };
1372        if (referenceStrength != null) {
1373          dst.referenceStrength = new ArrayList<IngredientSubstanceStrengthReferenceStrengthComponent>();
1374          for (IngredientSubstanceStrengthReferenceStrengthComponent i : referenceStrength)
1375            dst.referenceStrength.add(i.copy());
1376        };
1377      }
1378
1379      @Override
1380      public boolean equalsDeep(Base other_) {
1381        if (!super.equalsDeep(other_))
1382          return false;
1383        if (!(other_ instanceof IngredientSubstanceStrengthComponent))
1384          return false;
1385        IngredientSubstanceStrengthComponent o = (IngredientSubstanceStrengthComponent) other_;
1386        return compareDeep(presentation, o.presentation, true) && compareDeep(textPresentation, o.textPresentation, true)
1387           && compareDeep(concentration, o.concentration, true) && compareDeep(textConcentration, o.textConcentration, true)
1388           && compareDeep(basis, o.basis, true) && compareDeep(measurementPoint, o.measurementPoint, true)
1389           && compareDeep(country, o.country, true) && compareDeep(referenceStrength, o.referenceStrength, true)
1390          ;
1391      }
1392
1393      @Override
1394      public boolean equalsShallow(Base other_) {
1395        if (!super.equalsShallow(other_))
1396          return false;
1397        if (!(other_ instanceof IngredientSubstanceStrengthComponent))
1398          return false;
1399        IngredientSubstanceStrengthComponent o = (IngredientSubstanceStrengthComponent) other_;
1400        return compareValues(textPresentation, o.textPresentation, true) && compareValues(textConcentration, o.textConcentration, true)
1401           && compareValues(measurementPoint, o.measurementPoint, true);
1402      }
1403
1404      public boolean isEmpty() {
1405        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(presentation, textPresentation
1406          , concentration, textConcentration, basis, measurementPoint, country, referenceStrength
1407          );
1408      }
1409
1410  public String fhirType() {
1411    return "Ingredient.substance.strength";
1412
1413  }
1414
1415  }
1416
1417    @Block()
1418    public static class IngredientSubstanceStrengthReferenceStrengthComponent extends BackboneElement implements IBaseBackboneElement {
1419        /**
1420         * Relevant reference substance.
1421         */
1422        @Child(name = "substance", type = {CodeableReference.class}, order=1, min=0, max=1, modifier=false, summary=true)
1423        @Description(shortDefinition="Relevant reference substance", formalDefinition="Relevant reference substance." )
1424        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-codes")
1425        protected CodeableReference substance;
1426
1427        /**
1428         * Strength expressed in terms of a reference substance.
1429         */
1430        @Child(name = "strength", type = {Ratio.class, RatioRange.class, Quantity.class}, order=2, min=1, max=1, modifier=false, summary=true)
1431        @Description(shortDefinition="Strength expressed in terms of a reference substance", formalDefinition="Strength expressed in terms of a reference substance." )
1432        protected DataType strength;
1433
1434        /**
1435         * For when strength is measured at a particular point or distance.
1436         */
1437        @Child(name = "measurementPoint", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1438        @Description(shortDefinition="When strength is measured at a particular point or distance", formalDefinition="For when strength is measured at a particular point or distance." )
1439        protected StringType measurementPoint;
1440
1441        /**
1442         * The country or countries for which the strength range applies.
1443         */
1444        @Child(name = "country", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1445        @Description(shortDefinition="Where the strength range applies", formalDefinition="The country or countries for which the strength range applies." )
1446        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/country")
1447        protected List<CodeableConcept> country;
1448
1449        private static final long serialVersionUID = 1700529245L;
1450
1451    /**
1452     * Constructor
1453     */
1454      public IngredientSubstanceStrengthReferenceStrengthComponent() {
1455        super();
1456      }
1457
1458    /**
1459     * Constructor
1460     */
1461      public IngredientSubstanceStrengthReferenceStrengthComponent(DataType strength) {
1462        super();
1463        this.setStrength(strength);
1464      }
1465
1466        /**
1467         * @return {@link #substance} (Relevant reference substance.)
1468         */
1469        public CodeableReference getSubstance() { 
1470          if (this.substance == null)
1471            if (Configuration.errorOnAutoCreate())
1472              throw new Error("Attempt to auto-create IngredientSubstanceStrengthReferenceStrengthComponent.substance");
1473            else if (Configuration.doAutoCreate())
1474              this.substance = new CodeableReference(); // cc
1475          return this.substance;
1476        }
1477
1478        public boolean hasSubstance() { 
1479          return this.substance != null && !this.substance.isEmpty();
1480        }
1481
1482        /**
1483         * @param value {@link #substance} (Relevant reference substance.)
1484         */
1485        public IngredientSubstanceStrengthReferenceStrengthComponent setSubstance(CodeableReference value) { 
1486          this.substance = value;
1487          return this;
1488        }
1489
1490        /**
1491         * @return {@link #strength} (Strength expressed in terms of a reference substance.)
1492         */
1493        public DataType getStrength() { 
1494          return this.strength;
1495        }
1496
1497        /**
1498         * @return {@link #strength} (Strength expressed in terms of a reference substance.)
1499         */
1500        public Ratio getStrengthRatio() throws FHIRException { 
1501          if (this.strength == null)
1502            this.strength = new Ratio();
1503          if (!(this.strength instanceof Ratio))
1504            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.strength.getClass().getName()+" was encountered");
1505          return (Ratio) this.strength;
1506        }
1507
1508        public boolean hasStrengthRatio() { 
1509          return this != null && this.strength instanceof Ratio;
1510        }
1511
1512        /**
1513         * @return {@link #strength} (Strength expressed in terms of a reference substance.)
1514         */
1515        public RatioRange getStrengthRatioRange() throws FHIRException { 
1516          if (this.strength == null)
1517            this.strength = new RatioRange();
1518          if (!(this.strength instanceof RatioRange))
1519            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.strength.getClass().getName()+" was encountered");
1520          return (RatioRange) this.strength;
1521        }
1522
1523        public boolean hasStrengthRatioRange() { 
1524          return this != null && this.strength instanceof RatioRange;
1525        }
1526
1527        /**
1528         * @return {@link #strength} (Strength expressed in terms of a reference substance.)
1529         */
1530        public Quantity getStrengthQuantity() throws FHIRException { 
1531          if (this.strength == null)
1532            this.strength = new Quantity();
1533          if (!(this.strength instanceof Quantity))
1534            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.strength.getClass().getName()+" was encountered");
1535          return (Quantity) this.strength;
1536        }
1537
1538        public boolean hasStrengthQuantity() { 
1539          return this != null && this.strength instanceof Quantity;
1540        }
1541
1542        public boolean hasStrength() { 
1543          return this.strength != null && !this.strength.isEmpty();
1544        }
1545
1546        /**
1547         * @param value {@link #strength} (Strength expressed in terms of a reference substance.)
1548         */
1549        public IngredientSubstanceStrengthReferenceStrengthComponent setStrength(DataType value) { 
1550          if (value != null && !(value instanceof Ratio || value instanceof RatioRange || value instanceof Quantity))
1551            throw new Error("Not the right type for Ingredient.substance.strength.referenceStrength.strength[x]: "+value.fhirType());
1552          this.strength = value;
1553          return this;
1554        }
1555
1556        /**
1557         * @return {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value
1558         */
1559        public StringType getMeasurementPointElement() { 
1560          if (this.measurementPoint == null)
1561            if (Configuration.errorOnAutoCreate())
1562              throw new Error("Attempt to auto-create IngredientSubstanceStrengthReferenceStrengthComponent.measurementPoint");
1563            else if (Configuration.doAutoCreate())
1564              this.measurementPoint = new StringType(); // bb
1565          return this.measurementPoint;
1566        }
1567
1568        public boolean hasMeasurementPointElement() { 
1569          return this.measurementPoint != null && !this.measurementPoint.isEmpty();
1570        }
1571
1572        public boolean hasMeasurementPoint() { 
1573          return this.measurementPoint != null && !this.measurementPoint.isEmpty();
1574        }
1575
1576        /**
1577         * @param value {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value
1578         */
1579        public IngredientSubstanceStrengthReferenceStrengthComponent setMeasurementPointElement(StringType value) { 
1580          this.measurementPoint = value;
1581          return this;
1582        }
1583
1584        /**
1585         * @return For when strength is measured at a particular point or distance.
1586         */
1587        public String getMeasurementPoint() { 
1588          return this.measurementPoint == null ? null : this.measurementPoint.getValue();
1589        }
1590
1591        /**
1592         * @param value For when strength is measured at a particular point or distance.
1593         */
1594        public IngredientSubstanceStrengthReferenceStrengthComponent setMeasurementPoint(String value) { 
1595          if (Utilities.noString(value))
1596            this.measurementPoint = null;
1597          else {
1598            if (this.measurementPoint == null)
1599              this.measurementPoint = new StringType();
1600            this.measurementPoint.setValue(value);
1601          }
1602          return this;
1603        }
1604
1605        /**
1606         * @return {@link #country} (The country or countries for which the strength range applies.)
1607         */
1608        public List<CodeableConcept> getCountry() { 
1609          if (this.country == null)
1610            this.country = new ArrayList<CodeableConcept>();
1611          return this.country;
1612        }
1613
1614        /**
1615         * @return Returns a reference to <code>this</code> for easy method chaining
1616         */
1617        public IngredientSubstanceStrengthReferenceStrengthComponent setCountry(List<CodeableConcept> theCountry) { 
1618          this.country = theCountry;
1619          return this;
1620        }
1621
1622        public boolean hasCountry() { 
1623          if (this.country == null)
1624            return false;
1625          for (CodeableConcept item : this.country)
1626            if (!item.isEmpty())
1627              return true;
1628          return false;
1629        }
1630
1631        public CodeableConcept addCountry() { //3
1632          CodeableConcept t = new CodeableConcept();
1633          if (this.country == null)
1634            this.country = new ArrayList<CodeableConcept>();
1635          this.country.add(t);
1636          return t;
1637        }
1638
1639        public IngredientSubstanceStrengthReferenceStrengthComponent addCountry(CodeableConcept t) { //3
1640          if (t == null)
1641            return this;
1642          if (this.country == null)
1643            this.country = new ArrayList<CodeableConcept>();
1644          this.country.add(t);
1645          return this;
1646        }
1647
1648        /**
1649         * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist {3}
1650         */
1651        public CodeableConcept getCountryFirstRep() { 
1652          if (getCountry().isEmpty()) {
1653            addCountry();
1654          }
1655          return getCountry().get(0);
1656        }
1657
1658        protected void listChildren(List<Property> children) {
1659          super.listChildren(children);
1660          children.add(new Property("substance", "CodeableReference(SubstanceDefinition)", "Relevant reference substance.", 0, 1, substance));
1661          children.add(new Property("strength[x]", "Ratio|RatioRange|Quantity", "Strength expressed in terms of a reference substance.", 0, 1, strength));
1662          children.add(new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint));
1663          children.add(new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country));
1664        }
1665
1666        @Override
1667        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1668          switch (_hash) {
1669          case 530040176: /*substance*/  return new Property("substance", "CodeableReference(SubstanceDefinition)", "Relevant reference substance.", 0, 1, substance);
1670          case 127377567: /*strength[x]*/  return new Property("strength[x]", "Ratio|RatioRange|Quantity", "Strength expressed in terms of a reference substance.", 0, 1, strength);
1671          case 1791316033: /*strength*/  return new Property("strength[x]", "Ratio|RatioRange|Quantity", "Strength expressed in terms of a reference substance.", 0, 1, strength);
1672          case 2141786186: /*strengthRatio*/  return new Property("strength[x]", "Ratio", "Strength expressed in terms of a reference substance.", 0, 1, strength);
1673          case -1300703469: /*strengthRatioRange*/  return new Property("strength[x]", "RatioRange", "Strength expressed in terms of a reference substance.", 0, 1, strength);
1674          case -1793570836: /*strengthQuantity*/  return new Property("strength[x]", "Quantity", "Strength expressed in terms of a reference substance.", 0, 1, strength);
1675          case 235437876: /*measurementPoint*/  return new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint);
1676          case 957831062: /*country*/  return new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country);
1677          default: return super.getNamedProperty(_hash, _name, _checkValid);
1678          }
1679
1680        }
1681
1682      @Override
1683      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1684        switch (hash) {
1685        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableReference
1686        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // DataType
1687        case 235437876: /*measurementPoint*/ return this.measurementPoint == null ? new Base[0] : new Base[] {this.measurementPoint}; // StringType
1688        case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept
1689        default: return super.getProperty(hash, name, checkValid);
1690        }
1691
1692      }
1693
1694      @Override
1695      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1696        switch (hash) {
1697        case 530040176: // substance
1698          this.substance = TypeConvertor.castToCodeableReference(value); // CodeableReference
1699          return value;
1700        case 1791316033: // strength
1701          this.strength = TypeConvertor.castToType(value); // DataType
1702          return value;
1703        case 235437876: // measurementPoint
1704          this.measurementPoint = TypeConvertor.castToString(value); // StringType
1705          return value;
1706        case 957831062: // country
1707          this.getCountry().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1708          return value;
1709        default: return super.setProperty(hash, name, value);
1710        }
1711
1712      }
1713
1714      @Override
1715      public Base setProperty(String name, Base value) throws FHIRException {
1716        if (name.equals("substance")) {
1717          this.substance = TypeConvertor.castToCodeableReference(value); // CodeableReference
1718        } else if (name.equals("strength[x]")) {
1719          this.strength = TypeConvertor.castToType(value); // DataType
1720        } else if (name.equals("measurementPoint")) {
1721          this.measurementPoint = TypeConvertor.castToString(value); // StringType
1722        } else if (name.equals("country")) {
1723          this.getCountry().add(TypeConvertor.castToCodeableConcept(value));
1724        } else
1725          return super.setProperty(name, value);
1726        return value;
1727      }
1728
1729      @Override
1730      public Base makeProperty(int hash, String name) throws FHIRException {
1731        switch (hash) {
1732        case 530040176:  return getSubstance();
1733        case 127377567:  return getStrength();
1734        case 1791316033:  return getStrength();
1735        case 235437876:  return getMeasurementPointElement();
1736        case 957831062:  return addCountry(); 
1737        default: return super.makeProperty(hash, name);
1738        }
1739
1740      }
1741
1742      @Override
1743      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1744        switch (hash) {
1745        case 530040176: /*substance*/ return new String[] {"CodeableReference"};
1746        case 1791316033: /*strength*/ return new String[] {"Ratio", "RatioRange", "Quantity"};
1747        case 235437876: /*measurementPoint*/ return new String[] {"string"};
1748        case 957831062: /*country*/ return new String[] {"CodeableConcept"};
1749        default: return super.getTypesForProperty(hash, name);
1750        }
1751
1752      }
1753
1754      @Override
1755      public Base addChild(String name) throws FHIRException {
1756        if (name.equals("substance")) {
1757          this.substance = new CodeableReference();
1758          return this.substance;
1759        }
1760        else if (name.equals("strengthRatio")) {
1761          this.strength = new Ratio();
1762          return this.strength;
1763        }
1764        else if (name.equals("strengthRatioRange")) {
1765          this.strength = new RatioRange();
1766          return this.strength;
1767        }
1768        else if (name.equals("strengthQuantity")) {
1769          this.strength = new Quantity();
1770          return this.strength;
1771        }
1772        else if (name.equals("measurementPoint")) {
1773          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.substance.strength.referenceStrength.measurementPoint");
1774        }
1775        else if (name.equals("country")) {
1776          return addCountry();
1777        }
1778        else
1779          return super.addChild(name);
1780      }
1781
1782      public IngredientSubstanceStrengthReferenceStrengthComponent copy() {
1783        IngredientSubstanceStrengthReferenceStrengthComponent dst = new IngredientSubstanceStrengthReferenceStrengthComponent();
1784        copyValues(dst);
1785        return dst;
1786      }
1787
1788      public void copyValues(IngredientSubstanceStrengthReferenceStrengthComponent dst) {
1789        super.copyValues(dst);
1790        dst.substance = substance == null ? null : substance.copy();
1791        dst.strength = strength == null ? null : strength.copy();
1792        dst.measurementPoint = measurementPoint == null ? null : measurementPoint.copy();
1793        if (country != null) {
1794          dst.country = new ArrayList<CodeableConcept>();
1795          for (CodeableConcept i : country)
1796            dst.country.add(i.copy());
1797        };
1798      }
1799
1800      @Override
1801      public boolean equalsDeep(Base other_) {
1802        if (!super.equalsDeep(other_))
1803          return false;
1804        if (!(other_ instanceof IngredientSubstanceStrengthReferenceStrengthComponent))
1805          return false;
1806        IngredientSubstanceStrengthReferenceStrengthComponent o = (IngredientSubstanceStrengthReferenceStrengthComponent) other_;
1807        return compareDeep(substance, o.substance, true) && compareDeep(strength, o.strength, true) && compareDeep(measurementPoint, o.measurementPoint, true)
1808           && compareDeep(country, o.country, true);
1809      }
1810
1811      @Override
1812      public boolean equalsShallow(Base other_) {
1813        if (!super.equalsShallow(other_))
1814          return false;
1815        if (!(other_ instanceof IngredientSubstanceStrengthReferenceStrengthComponent))
1816          return false;
1817        IngredientSubstanceStrengthReferenceStrengthComponent o = (IngredientSubstanceStrengthReferenceStrengthComponent) other_;
1818        return compareValues(measurementPoint, o.measurementPoint, true);
1819      }
1820
1821      public boolean isEmpty() {
1822        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, strength, measurementPoint
1823          , country);
1824      }
1825
1826  public String fhirType() {
1827    return "Ingredient.substance.strength.referenceStrength";
1828
1829  }
1830
1831  }
1832
1833    /**
1834     * The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.
1835     */
1836    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1837    @Description(shortDefinition="An identifier or code by which the ingredient can be referenced", formalDefinition="The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate." )
1838    protected Identifier identifier;
1839
1840    /**
1841     * The status of this ingredient. Enables tracking the life-cycle of the content.
1842     */
1843    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1844    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The status of this ingredient. Enables tracking the life-cycle of the content." )
1845    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
1846    protected Enumeration<PublicationStatus> status;
1847
1848    /**
1849     * The product which this ingredient is a constituent part of.
1850     */
1851    @Child(name = "for", type = {MedicinalProductDefinition.class, AdministrableProductDefinition.class, ManufacturedItemDefinition.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1852    @Description(shortDefinition="The product which this ingredient is a constituent part of", formalDefinition="The product which this ingredient is a constituent part of." )
1853    protected List<Reference> for_;
1854
1855    /**
1856     * A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.
1857     */
1858    @Child(name = "role", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true)
1859    @Description(shortDefinition="Purpose of the ingredient within the product, e.g. active, inactive", formalDefinition="A classification of the ingredient identifying its purpose within the product, e.g. active, inactive." )
1860    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ingredient-role")
1861    protected CodeableConcept role;
1862
1863    /**
1864     * A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent.
1865     */
1866    @Child(name = "function", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1867    @Description(shortDefinition="Precise action within the drug product, e.g. antioxidant, alkalizing agent", formalDefinition="A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent." )
1868    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ingredient-function")
1869    protected List<CodeableConcept> function;
1870
1871    /**
1872     * A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.
1873     */
1874    @Child(name = "group", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1875    @Description(shortDefinition="A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink", formalDefinition="A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink." )
1876    protected CodeableConcept group;
1877
1878    /**
1879     * If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.
1880     */
1881    @Child(name = "allergenicIndicator", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1882    @Description(shortDefinition="If the ingredient is a known or suspected allergen", formalDefinition="If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here." )
1883    protected BooleanType allergenicIndicator;
1884
1885    /**
1886     * The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case.
1887     */
1888    @Child(name = "manufacturer", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1889    @Description(shortDefinition="An organization that manufactures this ingredient", formalDefinition="The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case." )
1890    protected List<IngredientManufacturerComponent> manufacturer;
1891
1892    /**
1893     * The substance that comprises this ingredient.
1894     */
1895    @Child(name = "substance", type = {}, order=8, min=1, max=1, modifier=false, summary=true)
1896    @Description(shortDefinition="The substance that comprises this ingredient", formalDefinition="The substance that comprises this ingredient." )
1897    protected IngredientSubstanceComponent substance;
1898
1899    private static final long serialVersionUID = -1522820829L;
1900
1901  /**
1902   * Constructor
1903   */
1904    public Ingredient() {
1905      super();
1906    }
1907
1908  /**
1909   * Constructor
1910   */
1911    public Ingredient(PublicationStatus status, CodeableConcept role, IngredientSubstanceComponent substance) {
1912      super();
1913      this.setStatus(status);
1914      this.setRole(role);
1915      this.setSubstance(substance);
1916    }
1917
1918    /**
1919     * @return {@link #identifier} (The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
1920     */
1921    public Identifier getIdentifier() { 
1922      if (this.identifier == null)
1923        if (Configuration.errorOnAutoCreate())
1924          throw new Error("Attempt to auto-create Ingredient.identifier");
1925        else if (Configuration.doAutoCreate())
1926          this.identifier = new Identifier(); // cc
1927      return this.identifier;
1928    }
1929
1930    public boolean hasIdentifier() { 
1931      return this.identifier != null && !this.identifier.isEmpty();
1932    }
1933
1934    /**
1935     * @param value {@link #identifier} (The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
1936     */
1937    public Ingredient setIdentifier(Identifier value) { 
1938      this.identifier = value;
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #status} (The status of this ingredient. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1944     */
1945    public Enumeration<PublicationStatus> getStatusElement() { 
1946      if (this.status == null)
1947        if (Configuration.errorOnAutoCreate())
1948          throw new Error("Attempt to auto-create Ingredient.status");
1949        else if (Configuration.doAutoCreate())
1950          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
1951      return this.status;
1952    }
1953
1954    public boolean hasStatusElement() { 
1955      return this.status != null && !this.status.isEmpty();
1956    }
1957
1958    public boolean hasStatus() { 
1959      return this.status != null && !this.status.isEmpty();
1960    }
1961
1962    /**
1963     * @param value {@link #status} (The status of this ingredient. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1964     */
1965    public Ingredient setStatusElement(Enumeration<PublicationStatus> value) { 
1966      this.status = value;
1967      return this;
1968    }
1969
1970    /**
1971     * @return The status of this ingredient. Enables tracking the life-cycle of the content.
1972     */
1973    public PublicationStatus getStatus() { 
1974      return this.status == null ? null : this.status.getValue();
1975    }
1976
1977    /**
1978     * @param value The status of this ingredient. Enables tracking the life-cycle of the content.
1979     */
1980    public Ingredient setStatus(PublicationStatus value) { 
1981        if (this.status == null)
1982          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
1983        this.status.setValue(value);
1984      return this;
1985    }
1986
1987    /**
1988     * @return {@link #for_} (The product which this ingredient is a constituent part of.)
1989     */
1990    public List<Reference> getFor() { 
1991      if (this.for_ == null)
1992        this.for_ = new ArrayList<Reference>();
1993      return this.for_;
1994    }
1995
1996    /**
1997     * @return Returns a reference to <code>this</code> for easy method chaining
1998     */
1999    public Ingredient setFor(List<Reference> theFor) { 
2000      this.for_ = theFor;
2001      return this;
2002    }
2003
2004    public boolean hasFor() { 
2005      if (this.for_ == null)
2006        return false;
2007      for (Reference item : this.for_)
2008        if (!item.isEmpty())
2009          return true;
2010      return false;
2011    }
2012
2013    public Reference addFor() { //3
2014      Reference t = new Reference();
2015      if (this.for_ == null)
2016        this.for_ = new ArrayList<Reference>();
2017      this.for_.add(t);
2018      return t;
2019    }
2020
2021    public Ingredient addFor(Reference t) { //3
2022      if (t == null)
2023        return this;
2024      if (this.for_ == null)
2025        this.for_ = new ArrayList<Reference>();
2026      this.for_.add(t);
2027      return this;
2028    }
2029
2030    /**
2031     * @return The first repetition of repeating field {@link #for_}, creating it if it does not already exist {3}
2032     */
2033    public Reference getForFirstRep() { 
2034      if (getFor().isEmpty()) {
2035        addFor();
2036      }
2037      return getFor().get(0);
2038    }
2039
2040    /**
2041     * @return {@link #role} (A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.)
2042     */
2043    public CodeableConcept getRole() { 
2044      if (this.role == null)
2045        if (Configuration.errorOnAutoCreate())
2046          throw new Error("Attempt to auto-create Ingredient.role");
2047        else if (Configuration.doAutoCreate())
2048          this.role = new CodeableConcept(); // cc
2049      return this.role;
2050    }
2051
2052    public boolean hasRole() { 
2053      return this.role != null && !this.role.isEmpty();
2054    }
2055
2056    /**
2057     * @param value {@link #role} (A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.)
2058     */
2059    public Ingredient setRole(CodeableConcept value) { 
2060      this.role = value;
2061      return this;
2062    }
2063
2064    /**
2065     * @return {@link #function} (A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent.)
2066     */
2067    public List<CodeableConcept> getFunction() { 
2068      if (this.function == null)
2069        this.function = new ArrayList<CodeableConcept>();
2070      return this.function;
2071    }
2072
2073    /**
2074     * @return Returns a reference to <code>this</code> for easy method chaining
2075     */
2076    public Ingredient setFunction(List<CodeableConcept> theFunction) { 
2077      this.function = theFunction;
2078      return this;
2079    }
2080
2081    public boolean hasFunction() { 
2082      if (this.function == null)
2083        return false;
2084      for (CodeableConcept item : this.function)
2085        if (!item.isEmpty())
2086          return true;
2087      return false;
2088    }
2089
2090    public CodeableConcept addFunction() { //3
2091      CodeableConcept t = new CodeableConcept();
2092      if (this.function == null)
2093        this.function = new ArrayList<CodeableConcept>();
2094      this.function.add(t);
2095      return t;
2096    }
2097
2098    public Ingredient addFunction(CodeableConcept t) { //3
2099      if (t == null)
2100        return this;
2101      if (this.function == null)
2102        this.function = new ArrayList<CodeableConcept>();
2103      this.function.add(t);
2104      return this;
2105    }
2106
2107    /**
2108     * @return The first repetition of repeating field {@link #function}, creating it if it does not already exist {3}
2109     */
2110    public CodeableConcept getFunctionFirstRep() { 
2111      if (getFunction().isEmpty()) {
2112        addFunction();
2113      }
2114      return getFunction().get(0);
2115    }
2116
2117    /**
2118     * @return {@link #group} (A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.)
2119     */
2120    public CodeableConcept getGroup() { 
2121      if (this.group == null)
2122        if (Configuration.errorOnAutoCreate())
2123          throw new Error("Attempt to auto-create Ingredient.group");
2124        else if (Configuration.doAutoCreate())
2125          this.group = new CodeableConcept(); // cc
2126      return this.group;
2127    }
2128
2129    public boolean hasGroup() { 
2130      return this.group != null && !this.group.isEmpty();
2131    }
2132
2133    /**
2134     * @param value {@link #group} (A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.)
2135     */
2136    public Ingredient setGroup(CodeableConcept value) { 
2137      this.group = value;
2138      return this;
2139    }
2140
2141    /**
2142     * @return {@link #allergenicIndicator} (If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
2143     */
2144    public BooleanType getAllergenicIndicatorElement() { 
2145      if (this.allergenicIndicator == null)
2146        if (Configuration.errorOnAutoCreate())
2147          throw new Error("Attempt to auto-create Ingredient.allergenicIndicator");
2148        else if (Configuration.doAutoCreate())
2149          this.allergenicIndicator = new BooleanType(); // bb
2150      return this.allergenicIndicator;
2151    }
2152
2153    public boolean hasAllergenicIndicatorElement() { 
2154      return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
2155    }
2156
2157    public boolean hasAllergenicIndicator() { 
2158      return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
2159    }
2160
2161    /**
2162     * @param value {@link #allergenicIndicator} (If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
2163     */
2164    public Ingredient setAllergenicIndicatorElement(BooleanType value) { 
2165      this.allergenicIndicator = value;
2166      return this;
2167    }
2168
2169    /**
2170     * @return If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.
2171     */
2172    public boolean getAllergenicIndicator() { 
2173      return this.allergenicIndicator == null || this.allergenicIndicator.isEmpty() ? false : this.allergenicIndicator.getValue();
2174    }
2175
2176    /**
2177     * @param value If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.
2178     */
2179    public Ingredient setAllergenicIndicator(boolean value) { 
2180        if (this.allergenicIndicator == null)
2181          this.allergenicIndicator = new BooleanType();
2182        this.allergenicIndicator.setValue(value);
2183      return this;
2184    }
2185
2186    /**
2187     * @return {@link #manufacturer} (The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case.)
2188     */
2189    public List<IngredientManufacturerComponent> getManufacturer() { 
2190      if (this.manufacturer == null)
2191        this.manufacturer = new ArrayList<IngredientManufacturerComponent>();
2192      return this.manufacturer;
2193    }
2194
2195    /**
2196     * @return Returns a reference to <code>this</code> for easy method chaining
2197     */
2198    public Ingredient setManufacturer(List<IngredientManufacturerComponent> theManufacturer) { 
2199      this.manufacturer = theManufacturer;
2200      return this;
2201    }
2202
2203    public boolean hasManufacturer() { 
2204      if (this.manufacturer == null)
2205        return false;
2206      for (IngredientManufacturerComponent item : this.manufacturer)
2207        if (!item.isEmpty())
2208          return true;
2209      return false;
2210    }
2211
2212    public IngredientManufacturerComponent addManufacturer() { //3
2213      IngredientManufacturerComponent t = new IngredientManufacturerComponent();
2214      if (this.manufacturer == null)
2215        this.manufacturer = new ArrayList<IngredientManufacturerComponent>();
2216      this.manufacturer.add(t);
2217      return t;
2218    }
2219
2220    public Ingredient addManufacturer(IngredientManufacturerComponent t) { //3
2221      if (t == null)
2222        return this;
2223      if (this.manufacturer == null)
2224        this.manufacturer = new ArrayList<IngredientManufacturerComponent>();
2225      this.manufacturer.add(t);
2226      return this;
2227    }
2228
2229    /**
2230     * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3}
2231     */
2232    public IngredientManufacturerComponent getManufacturerFirstRep() { 
2233      if (getManufacturer().isEmpty()) {
2234        addManufacturer();
2235      }
2236      return getManufacturer().get(0);
2237    }
2238
2239    /**
2240     * @return {@link #substance} (The substance that comprises this ingredient.)
2241     */
2242    public IngredientSubstanceComponent getSubstance() { 
2243      if (this.substance == null)
2244        if (Configuration.errorOnAutoCreate())
2245          throw new Error("Attempt to auto-create Ingredient.substance");
2246        else if (Configuration.doAutoCreate())
2247          this.substance = new IngredientSubstanceComponent(); // cc
2248      return this.substance;
2249    }
2250
2251    public boolean hasSubstance() { 
2252      return this.substance != null && !this.substance.isEmpty();
2253    }
2254
2255    /**
2256     * @param value {@link #substance} (The substance that comprises this ingredient.)
2257     */
2258    public Ingredient setSubstance(IngredientSubstanceComponent value) { 
2259      this.substance = value;
2260      return this;
2261    }
2262
2263      protected void listChildren(List<Property> children) {
2264        super.listChildren(children);
2265        children.add(new Property("identifier", "Identifier", "The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, 1, identifier));
2266        children.add(new Property("status", "code", "The status of this ingredient. Enables tracking the life-cycle of the content.", 0, 1, status));
2267        children.add(new Property("for", "Reference(MedicinalProductDefinition|AdministrableProductDefinition|ManufacturedItemDefinition)", "The product which this ingredient is a constituent part of.", 0, java.lang.Integer.MAX_VALUE, for_));
2268        children.add(new Property("role", "CodeableConcept", "A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.", 0, 1, role));
2269        children.add(new Property("function", "CodeableConcept", "A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent.", 0, java.lang.Integer.MAX_VALUE, function));
2270        children.add(new Property("group", "CodeableConcept", "A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.", 0, 1, group));
2271        children.add(new Property("allergenicIndicator", "boolean", "If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.", 0, 1, allergenicIndicator));
2272        children.add(new Property("manufacturer", "", "The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
2273        children.add(new Property("substance", "", "The substance that comprises this ingredient.", 0, 1, substance));
2274      }
2275
2276      @Override
2277      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2278        switch (_hash) {
2279        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, 1, identifier);
2280        case -892481550: /*status*/  return new Property("status", "code", "The status of this ingredient. Enables tracking the life-cycle of the content.", 0, 1, status);
2281        case 101577: /*for*/  return new Property("for", "Reference(MedicinalProductDefinition|AdministrableProductDefinition|ManufacturedItemDefinition)", "The product which this ingredient is a constituent part of.", 0, java.lang.Integer.MAX_VALUE, for_);
2282        case 3506294: /*role*/  return new Property("role", "CodeableConcept", "A classification of the ingredient identifying its purpose within the product, e.g. active, inactive.", 0, 1, role);
2283        case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: antioxidant, alkalizing agent.", 0, java.lang.Integer.MAX_VALUE, function);
2284        case 98629247: /*group*/  return new Property("group", "CodeableConcept", "A classification of the ingredient according to where in the physical item it tends to be used, such the outer shell of a tablet, inner body or ink.", 0, 1, group);
2285        case 75406931: /*allergenicIndicator*/  return new Property("allergenicIndicator", "boolean", "If the ingredient is a known or suspected allergen. Note that this is a property of the substance, so if a reference to a SubstanceDefinition is used to decribe that (rather than just a code), the allergen information should go there, not here.", 0, 1, allergenicIndicator);
2286        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "", "The organization(s) that manufacture this ingredient. Can be used to indicate:         1) Organizations we are aware of that manufacture this ingredient         2) Specific Manufacturer(s) currently being used         3) Set of organisations allowed to manufacture this ingredient for this product         Users must be clear on the application of context relevant to their use case.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
2287        case 530040176: /*substance*/  return new Property("substance", "", "The substance that comprises this ingredient.", 0, 1, substance);
2288        default: return super.getNamedProperty(_hash, _name, _checkValid);
2289        }
2290
2291      }
2292
2293      @Override
2294      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2295        switch (hash) {
2296        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2297        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
2298        case 101577: /*for*/ return this.for_ == null ? new Base[0] : this.for_.toArray(new Base[this.for_.size()]); // Reference
2299        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
2300        case 1380938712: /*function*/ return this.function == null ? new Base[0] : this.function.toArray(new Base[this.function.size()]); // CodeableConcept
2301        case 98629247: /*group*/ return this.group == null ? new Base[0] : new Base[] {this.group}; // CodeableConcept
2302        case 75406931: /*allergenicIndicator*/ return this.allergenicIndicator == null ? new Base[0] : new Base[] {this.allergenicIndicator}; // BooleanType
2303        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // IngredientManufacturerComponent
2304        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // IngredientSubstanceComponent
2305        default: return super.getProperty(hash, name, checkValid);
2306        }
2307
2308      }
2309
2310      @Override
2311      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2312        switch (hash) {
2313        case -1618432855: // identifier
2314          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
2315          return value;
2316        case -892481550: // status
2317          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2318          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2319          return value;
2320        case 101577: // for
2321          this.getFor().add(TypeConvertor.castToReference(value)); // Reference
2322          return value;
2323        case 3506294: // role
2324          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2325          return value;
2326        case 1380938712: // function
2327          this.getFunction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2328          return value;
2329        case 98629247: // group
2330          this.group = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2331          return value;
2332        case 75406931: // allergenicIndicator
2333          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
2334          return value;
2335        case -1969347631: // manufacturer
2336          this.getManufacturer().add((IngredientManufacturerComponent) value); // IngredientManufacturerComponent
2337          return value;
2338        case 530040176: // substance
2339          this.substance = (IngredientSubstanceComponent) value; // IngredientSubstanceComponent
2340          return value;
2341        default: return super.setProperty(hash, name, value);
2342        }
2343
2344      }
2345
2346      @Override
2347      public Base setProperty(String name, Base value) throws FHIRException {
2348        if (name.equals("identifier")) {
2349          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
2350        } else if (name.equals("status")) {
2351          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2352          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2353        } else if (name.equals("for")) {
2354          this.getFor().add(TypeConvertor.castToReference(value));
2355        } else if (name.equals("role")) {
2356          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2357        } else if (name.equals("function")) {
2358          this.getFunction().add(TypeConvertor.castToCodeableConcept(value));
2359        } else if (name.equals("group")) {
2360          this.group = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2361        } else if (name.equals("allergenicIndicator")) {
2362          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
2363        } else if (name.equals("manufacturer")) {
2364          this.getManufacturer().add((IngredientManufacturerComponent) value);
2365        } else if (name.equals("substance")) {
2366          this.substance = (IngredientSubstanceComponent) value; // IngredientSubstanceComponent
2367        } else
2368          return super.setProperty(name, value);
2369        return value;
2370      }
2371
2372      @Override
2373      public Base makeProperty(int hash, String name) throws FHIRException {
2374        switch (hash) {
2375        case -1618432855:  return getIdentifier();
2376        case -892481550:  return getStatusElement();
2377        case 101577:  return addFor(); 
2378        case 3506294:  return getRole();
2379        case 1380938712:  return addFunction(); 
2380        case 98629247:  return getGroup();
2381        case 75406931:  return getAllergenicIndicatorElement();
2382        case -1969347631:  return addManufacturer(); 
2383        case 530040176:  return getSubstance();
2384        default: return super.makeProperty(hash, name);
2385        }
2386
2387      }
2388
2389      @Override
2390      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2391        switch (hash) {
2392        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2393        case -892481550: /*status*/ return new String[] {"code"};
2394        case 101577: /*for*/ return new String[] {"Reference"};
2395        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
2396        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
2397        case 98629247: /*group*/ return new String[] {"CodeableConcept"};
2398        case 75406931: /*allergenicIndicator*/ return new String[] {"boolean"};
2399        case -1969347631: /*manufacturer*/ return new String[] {};
2400        case 530040176: /*substance*/ return new String[] {};
2401        default: return super.getTypesForProperty(hash, name);
2402        }
2403
2404      }
2405
2406      @Override
2407      public Base addChild(String name) throws FHIRException {
2408        if (name.equals("identifier")) {
2409          this.identifier = new Identifier();
2410          return this.identifier;
2411        }
2412        else if (name.equals("status")) {
2413          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.status");
2414        }
2415        else if (name.equals("for")) {
2416          return addFor();
2417        }
2418        else if (name.equals("role")) {
2419          this.role = new CodeableConcept();
2420          return this.role;
2421        }
2422        else if (name.equals("function")) {
2423          return addFunction();
2424        }
2425        else if (name.equals("group")) {
2426          this.group = new CodeableConcept();
2427          return this.group;
2428        }
2429        else if (name.equals("allergenicIndicator")) {
2430          throw new FHIRException("Cannot call addChild on a primitive type Ingredient.allergenicIndicator");
2431        }
2432        else if (name.equals("manufacturer")) {
2433          return addManufacturer();
2434        }
2435        else if (name.equals("substance")) {
2436          this.substance = new IngredientSubstanceComponent();
2437          return this.substance;
2438        }
2439        else
2440          return super.addChild(name);
2441      }
2442
2443  public String fhirType() {
2444    return "Ingredient";
2445
2446  }
2447
2448      public Ingredient copy() {
2449        Ingredient dst = new Ingredient();
2450        copyValues(dst);
2451        return dst;
2452      }
2453
2454      public void copyValues(Ingredient dst) {
2455        super.copyValues(dst);
2456        dst.identifier = identifier == null ? null : identifier.copy();
2457        dst.status = status == null ? null : status.copy();
2458        if (for_ != null) {
2459          dst.for_ = new ArrayList<Reference>();
2460          for (Reference i : for_)
2461            dst.for_.add(i.copy());
2462        };
2463        dst.role = role == null ? null : role.copy();
2464        if (function != null) {
2465          dst.function = new ArrayList<CodeableConcept>();
2466          for (CodeableConcept i : function)
2467            dst.function.add(i.copy());
2468        };
2469        dst.group = group == null ? null : group.copy();
2470        dst.allergenicIndicator = allergenicIndicator == null ? null : allergenicIndicator.copy();
2471        if (manufacturer != null) {
2472          dst.manufacturer = new ArrayList<IngredientManufacturerComponent>();
2473          for (IngredientManufacturerComponent i : manufacturer)
2474            dst.manufacturer.add(i.copy());
2475        };
2476        dst.substance = substance == null ? null : substance.copy();
2477      }
2478
2479      protected Ingredient typedCopy() {
2480        return copy();
2481      }
2482
2483      @Override
2484      public boolean equalsDeep(Base other_) {
2485        if (!super.equalsDeep(other_))
2486          return false;
2487        if (!(other_ instanceof Ingredient))
2488          return false;
2489        Ingredient o = (Ingredient) other_;
2490        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(for_, o.for_, true)
2491           && compareDeep(role, o.role, true) && compareDeep(function, o.function, true) && compareDeep(group, o.group, true)
2492           && compareDeep(allergenicIndicator, o.allergenicIndicator, true) && compareDeep(manufacturer, o.manufacturer, true)
2493           && compareDeep(substance, o.substance, true);
2494      }
2495
2496      @Override
2497      public boolean equalsShallow(Base other_) {
2498        if (!super.equalsShallow(other_))
2499          return false;
2500        if (!(other_ instanceof Ingredient))
2501          return false;
2502        Ingredient o = (Ingredient) other_;
2503        return compareValues(status, o.status, true) && compareValues(allergenicIndicator, o.allergenicIndicator, true)
2504          ;
2505      }
2506
2507      public boolean isEmpty() {
2508        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, for_
2509          , role, function, group, allergenicIndicator, manufacturer, substance);
2510      }
2511
2512  @Override
2513  public ResourceType getResourceType() {
2514    return ResourceType.Ingredient;
2515   }
2516
2517 /**
2518   * Search parameter: <b>for</b>
2519   * <p>
2520   * Description: <b>The product which this ingredient is a constituent part of</b><br>
2521   * Type: <b>reference</b><br>
2522   * Path: <b>Ingredient.for</b><br>
2523   * </p>
2524   */
2525  @SearchParamDefinition(name="for", path="Ingredient.for", description="The product which this ingredient is a constituent part of", type="reference", target={AdministrableProductDefinition.class, ManufacturedItemDefinition.class, MedicinalProductDefinition.class } )
2526  public static final String SP_FOR = "for";
2527 /**
2528   * <b>Fluent Client</b> search parameter constant for <b>for</b>
2529   * <p>
2530   * Description: <b>The product which this ingredient is a constituent part of</b><br>
2531   * Type: <b>reference</b><br>
2532   * Path: <b>Ingredient.for</b><br>
2533   * </p>
2534   */
2535  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FOR);
2536
2537/**
2538   * Constant for fluent queries to be used to add include statements. Specifies
2539   * the path value of "<b>Ingredient:for</b>".
2540   */
2541  public static final ca.uhn.fhir.model.api.Include INCLUDE_FOR = new ca.uhn.fhir.model.api.Include("Ingredient:for").toLocked();
2542
2543 /**
2544   * Search parameter: <b>function</b>
2545   * <p>
2546   * Description: <b>A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: Antioxidant, Alkalizing Agent</b><br>
2547   * Type: <b>token</b><br>
2548   * Path: <b>Ingredient.function</b><br>
2549   * </p>
2550   */
2551  @SearchParamDefinition(name="function", path="Ingredient.function", description="A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: Antioxidant, Alkalizing Agent", type="token" )
2552  public static final String SP_FUNCTION = "function";
2553 /**
2554   * <b>Fluent Client</b> search parameter constant for <b>function</b>
2555   * <p>
2556   * Description: <b>A classification of the ingredient identifying its precise purpose(s) in the drug product. This extends the Ingredient.role to add more detail. Example: Antioxidant, Alkalizing Agent</b><br>
2557   * Type: <b>token</b><br>
2558   * Path: <b>Ingredient.function</b><br>
2559   * </p>
2560   */
2561  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FUNCTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FUNCTION);
2562
2563 /**
2564   * Search parameter: <b>identifier</b>
2565   * <p>
2566   * Description: <b>An identifier or code by which the ingredient can be referenced</b><br>
2567   * Type: <b>token</b><br>
2568   * Path: <b>Ingredient.identifier</b><br>
2569   * </p>
2570   */
2571  @SearchParamDefinition(name="identifier", path="Ingredient.identifier", description="An identifier or code by which the ingredient can be referenced", type="token" )
2572  public static final String SP_IDENTIFIER = "identifier";
2573 /**
2574   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2575   * <p>
2576   * Description: <b>An identifier or code by which the ingredient can be referenced</b><br>
2577   * Type: <b>token</b><br>
2578   * Path: <b>Ingredient.identifier</b><br>
2579   * </p>
2580   */
2581  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2582
2583 /**
2584   * Search parameter: <b>manufacturer</b>
2585   * <p>
2586   * Description: <b>The organization that manufactures this ingredient</b><br>
2587   * Type: <b>reference</b><br>
2588   * Path: <b>Ingredient.manufacturer</b><br>
2589   * </p>
2590   */
2591  @SearchParamDefinition(name="manufacturer", path="Ingredient.manufacturer", description="The organization that manufactures this ingredient", type="reference" )
2592  public static final String SP_MANUFACTURER = "manufacturer";
2593 /**
2594   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
2595   * <p>
2596   * Description: <b>The organization that manufactures this ingredient</b><br>
2597   * Type: <b>reference</b><br>
2598   * Path: <b>Ingredient.manufacturer</b><br>
2599   * </p>
2600   */
2601  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
2602
2603/**
2604   * Constant for fluent queries to be used to add include statements. Specifies
2605   * the path value of "<b>Ingredient:manufacturer</b>".
2606   */
2607  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("Ingredient:manufacturer").toLocked();
2608
2609 /**
2610   * Search parameter: <b>role</b>
2611   * <p>
2612   * Description: <b>A classification of the ingredient identifying its purpose within the product, e.g. active, inactive</b><br>
2613   * Type: <b>token</b><br>
2614   * Path: <b>Ingredient.role</b><br>
2615   * </p>
2616   */
2617  @SearchParamDefinition(name="role", path="Ingredient.role", description="A classification of the ingredient identifying its purpose within the product, e.g. active, inactive", type="token" )
2618  public static final String SP_ROLE = "role";
2619 /**
2620   * <b>Fluent Client</b> search parameter constant for <b>role</b>
2621   * <p>
2622   * Description: <b>A classification of the ingredient identifying its purpose within the product, e.g. active, inactive</b><br>
2623   * Type: <b>token</b><br>
2624   * Path: <b>Ingredient.role</b><br>
2625   * </p>
2626   */
2627  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROLE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROLE);
2628
2629 /**
2630   * Search parameter: <b>status</b>
2631   * <p>
2632   * Description: <b>The status of this ingredient. Enables tracking the life-cycle of the content</b><br>
2633   * Type: <b>token</b><br>
2634   * Path: <b>Ingredient.status</b><br>
2635   * </p>
2636   */
2637  @SearchParamDefinition(name="status", path="Ingredient.status", description="The status of this ingredient. Enables tracking the life-cycle of the content", type="token" )
2638  public static final String SP_STATUS = "status";
2639 /**
2640   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2641   * <p>
2642   * Description: <b>The status of this ingredient. Enables tracking the life-cycle of the content</b><br>
2643   * Type: <b>token</b><br>
2644   * Path: <b>Ingredient.status</b><br>
2645   * </p>
2646   */
2647  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2648
2649 /**
2650   * Search parameter: <b>substance-code</b>
2651   * <p>
2652   * Description: <b>Reference to a concept (by class)</b><br>
2653   * Type: <b>token</b><br>
2654   * Path: <b>Ingredient.substance.code.concept</b><br>
2655   * </p>
2656   */
2657  @SearchParamDefinition(name="substance-code", path="Ingredient.substance.code.concept", description="Reference to a concept (by class)", type="token" )
2658  public static final String SP_SUBSTANCE_CODE = "substance-code";
2659 /**
2660   * <b>Fluent Client</b> search parameter constant for <b>substance-code</b>
2661   * <p>
2662   * Description: <b>Reference to a concept (by class)</b><br>
2663   * Type: <b>token</b><br>
2664   * Path: <b>Ingredient.substance.code.concept</b><br>
2665   * </p>
2666   */
2667  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBSTANCE_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBSTANCE_CODE);
2668
2669 /**
2670   * Search parameter: <b>substance-definition</b>
2671   * <p>
2672   * Description: <b>Reference to a resource (by instance)</b><br>
2673   * Type: <b>reference</b><br>
2674   * Path: <b>Ingredient.substance.code.reference</b><br>
2675   * </p>
2676   */
2677  @SearchParamDefinition(name="substance-definition", path="Ingredient.substance.code.reference", description="Reference to a resource (by instance)", type="reference" )
2678  public static final String SP_SUBSTANCE_DEFINITION = "substance-definition";
2679 /**
2680   * <b>Fluent Client</b> search parameter constant for <b>substance-definition</b>
2681   * <p>
2682   * Description: <b>Reference to a resource (by instance)</b><br>
2683   * Type: <b>reference</b><br>
2684   * Path: <b>Ingredient.substance.code.reference</b><br>
2685   * </p>
2686   */
2687  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE_DEFINITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE_DEFINITION);
2688
2689/**
2690   * Constant for fluent queries to be used to add include statements. Specifies
2691   * the path value of "<b>Ingredient:substance-definition</b>".
2692   */
2693  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE_DEFINITION = new ca.uhn.fhir.model.api.Include("Ingredient:substance-definition").toLocked();
2694
2695 /**
2696   * Search parameter: <b>substance</b>
2697   * <p>
2698   * Description: <b>Reference to a resource (by instance)</b><br>
2699   * Type: <b>reference</b><br>
2700   * Path: <b>Ingredient.substance.code.reference</b><br>
2701   * </p>
2702   */
2703  @SearchParamDefinition(name="substance", path="Ingredient.substance.code.reference", description="Reference to a resource (by instance)", type="reference" )
2704  public static final String SP_SUBSTANCE = "substance";
2705 /**
2706   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
2707   * <p>
2708   * Description: <b>Reference to a resource (by instance)</b><br>
2709   * Type: <b>reference</b><br>
2710   * Path: <b>Ingredient.substance.code.reference</b><br>
2711   * </p>
2712   */
2713  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE);
2714
2715/**
2716   * Constant for fluent queries to be used to add include statements. Specifies
2717   * the path value of "<b>Ingredient:substance</b>".
2718   */
2719  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE = new ca.uhn.fhir.model.api.Include("Ingredient:substance").toLocked();
2720
2721
2722}