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 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import java.math.*;
038import org.hl7.fhir.utilities.Utilities;
039import org.hl7.fhir.r5.model.Enumerations.*;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.ICompositeType;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.Block;
050
051/**
052 * Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.
053 */
054@ResourceDef(name="ObservationDefinition", profile="http://hl7.org/fhir/StructureDefinition/ObservationDefinition")
055public class ObservationDefinition extends DomainResource {
056
057    public enum ObservationDataType {
058        /**
059         * A measured amount.
060         */
061        QUANTITY, 
062        /**
063         * A coded concept from a reference terminology and/or text.
064         */
065        CODEABLECONCEPT, 
066        /**
067         * A sequence of Unicode characters.
068         */
069        STRING, 
070        /**
071         * true or false.
072         */
073        BOOLEAN, 
074        /**
075         * A signed integer.
076         */
077        INTEGER, 
078        /**
079         * A set of values bounded by low and high.
080         */
081        RANGE, 
082        /**
083         * A ratio of two Quantity values - a numerator and a denominator.
084         */
085        RATIO, 
086        /**
087         * A series of measurements taken by a device.
088         */
089        SAMPLEDDATA, 
090        /**
091         * A time during the day, in the format hh:mm:ss.
092         */
093        TIME, 
094        /**
095         * A date, date-time or partial date (e.g. just year or year + month) as used in human communication.
096         */
097        DATETIME, 
098        /**
099         * A time range defined by start and end date/time.
100         */
101        PERIOD, 
102        /**
103         * added to help the parsers with the generic types
104         */
105        NULL;
106        public static ObservationDataType fromCode(String codeString) throws FHIRException {
107            if (codeString == null || "".equals(codeString))
108                return null;
109        if ("Quantity".equals(codeString))
110          return QUANTITY;
111        if ("CodeableConcept".equals(codeString))
112          return CODEABLECONCEPT;
113        if ("string".equals(codeString))
114          return STRING;
115        if ("boolean".equals(codeString))
116          return BOOLEAN;
117        if ("integer".equals(codeString))
118          return INTEGER;
119        if ("Range".equals(codeString))
120          return RANGE;
121        if ("Ratio".equals(codeString))
122          return RATIO;
123        if ("SampledData".equals(codeString))
124          return SAMPLEDDATA;
125        if ("time".equals(codeString))
126          return TIME;
127        if ("dateTime".equals(codeString))
128          return DATETIME;
129        if ("Period".equals(codeString))
130          return PERIOD;
131        if (Configuration.isAcceptInvalidEnums())
132          return null;
133        else
134          throw new FHIRException("Unknown ObservationDataType code '"+codeString+"'");
135        }
136        public String toCode() {
137          switch (this) {
138            case QUANTITY: return "Quantity";
139            case CODEABLECONCEPT: return "CodeableConcept";
140            case STRING: return "string";
141            case BOOLEAN: return "boolean";
142            case INTEGER: return "integer";
143            case RANGE: return "Range";
144            case RATIO: return "Ratio";
145            case SAMPLEDDATA: return "SampledData";
146            case TIME: return "time";
147            case DATETIME: return "dateTime";
148            case PERIOD: return "Period";
149            default: return "?";
150          }
151        }
152        public String getSystem() {
153          switch (this) {
154            case QUANTITY: return "http://hl7.org/fhir/permitted-data-type";
155            case CODEABLECONCEPT: return "http://hl7.org/fhir/permitted-data-type";
156            case STRING: return "http://hl7.org/fhir/permitted-data-type";
157            case BOOLEAN: return "http://hl7.org/fhir/permitted-data-type";
158            case INTEGER: return "http://hl7.org/fhir/permitted-data-type";
159            case RANGE: return "http://hl7.org/fhir/permitted-data-type";
160            case RATIO: return "http://hl7.org/fhir/permitted-data-type";
161            case SAMPLEDDATA: return "http://hl7.org/fhir/permitted-data-type";
162            case TIME: return "http://hl7.org/fhir/permitted-data-type";
163            case DATETIME: return "http://hl7.org/fhir/permitted-data-type";
164            case PERIOD: return "http://hl7.org/fhir/permitted-data-type";
165            default: return "?";
166          }
167        }
168        public String getDefinition() {
169          switch (this) {
170            case QUANTITY: return "A measured amount.";
171            case CODEABLECONCEPT: return "A coded concept from a reference terminology and/or text.";
172            case STRING: return "A sequence of Unicode characters.";
173            case BOOLEAN: return "true or false.";
174            case INTEGER: return "A signed integer.";
175            case RANGE: return "A set of values bounded by low and high.";
176            case RATIO: return "A ratio of two Quantity values - a numerator and a denominator.";
177            case SAMPLEDDATA: return "A series of measurements taken by a device.";
178            case TIME: return "A time during the day, in the format hh:mm:ss.";
179            case DATETIME: return "A date, date-time or partial date (e.g. just year or year + month) as used in human communication.";
180            case PERIOD: return "A time range defined by start and end date/time.";
181            default: return "?";
182          }
183        }
184        public String getDisplay() {
185          switch (this) {
186            case QUANTITY: return "Quantity";
187            case CODEABLECONCEPT: return "CodeableConcept";
188            case STRING: return "string";
189            case BOOLEAN: return "boolean";
190            case INTEGER: return "integer";
191            case RANGE: return "Range";
192            case RATIO: return "Ratio";
193            case SAMPLEDDATA: return "SampledData";
194            case TIME: return "time";
195            case DATETIME: return "dateTime";
196            case PERIOD: return "Period";
197            default: return "?";
198          }
199        }
200    }
201
202  public static class ObservationDataTypeEnumFactory implements EnumFactory<ObservationDataType> {
203    public ObservationDataType fromCode(String codeString) throws IllegalArgumentException {
204      if (codeString == null || "".equals(codeString))
205            if (codeString == null || "".equals(codeString))
206                return null;
207        if ("Quantity".equals(codeString))
208          return ObservationDataType.QUANTITY;
209        if ("CodeableConcept".equals(codeString))
210          return ObservationDataType.CODEABLECONCEPT;
211        if ("string".equals(codeString))
212          return ObservationDataType.STRING;
213        if ("boolean".equals(codeString))
214          return ObservationDataType.BOOLEAN;
215        if ("integer".equals(codeString))
216          return ObservationDataType.INTEGER;
217        if ("Range".equals(codeString))
218          return ObservationDataType.RANGE;
219        if ("Ratio".equals(codeString))
220          return ObservationDataType.RATIO;
221        if ("SampledData".equals(codeString))
222          return ObservationDataType.SAMPLEDDATA;
223        if ("time".equals(codeString))
224          return ObservationDataType.TIME;
225        if ("dateTime".equals(codeString))
226          return ObservationDataType.DATETIME;
227        if ("Period".equals(codeString))
228          return ObservationDataType.PERIOD;
229        throw new IllegalArgumentException("Unknown ObservationDataType code '"+codeString+"'");
230        }
231        public Enumeration<ObservationDataType> fromType(Base code) throws FHIRException {
232          if (code == null)
233            return null;
234          if (code.isEmpty())
235            return new Enumeration<ObservationDataType>(this);
236          String codeString = ((PrimitiveType) code).asStringValue();
237          if (codeString == null || "".equals(codeString))
238            return null;
239        if ("Quantity".equals(codeString))
240          return new Enumeration<ObservationDataType>(this, ObservationDataType.QUANTITY);
241        if ("CodeableConcept".equals(codeString))
242          return new Enumeration<ObservationDataType>(this, ObservationDataType.CODEABLECONCEPT);
243        if ("string".equals(codeString))
244          return new Enumeration<ObservationDataType>(this, ObservationDataType.STRING);
245        if ("boolean".equals(codeString))
246          return new Enumeration<ObservationDataType>(this, ObservationDataType.BOOLEAN);
247        if ("integer".equals(codeString))
248          return new Enumeration<ObservationDataType>(this, ObservationDataType.INTEGER);
249        if ("Range".equals(codeString))
250          return new Enumeration<ObservationDataType>(this, ObservationDataType.RANGE);
251        if ("Ratio".equals(codeString))
252          return new Enumeration<ObservationDataType>(this, ObservationDataType.RATIO);
253        if ("SampledData".equals(codeString))
254          return new Enumeration<ObservationDataType>(this, ObservationDataType.SAMPLEDDATA);
255        if ("time".equals(codeString))
256          return new Enumeration<ObservationDataType>(this, ObservationDataType.TIME);
257        if ("dateTime".equals(codeString))
258          return new Enumeration<ObservationDataType>(this, ObservationDataType.DATETIME);
259        if ("Period".equals(codeString))
260          return new Enumeration<ObservationDataType>(this, ObservationDataType.PERIOD);
261        throw new FHIRException("Unknown ObservationDataType code '"+codeString+"'");
262        }
263    public String toCode(ObservationDataType code) {
264      if (code == ObservationDataType.QUANTITY)
265        return "Quantity";
266      if (code == ObservationDataType.CODEABLECONCEPT)
267        return "CodeableConcept";
268      if (code == ObservationDataType.STRING)
269        return "string";
270      if (code == ObservationDataType.BOOLEAN)
271        return "boolean";
272      if (code == ObservationDataType.INTEGER)
273        return "integer";
274      if (code == ObservationDataType.RANGE)
275        return "Range";
276      if (code == ObservationDataType.RATIO)
277        return "Ratio";
278      if (code == ObservationDataType.SAMPLEDDATA)
279        return "SampledData";
280      if (code == ObservationDataType.TIME)
281        return "time";
282      if (code == ObservationDataType.DATETIME)
283        return "dateTime";
284      if (code == ObservationDataType.PERIOD)
285        return "Period";
286      return "?";
287      }
288    public String toSystem(ObservationDataType code) {
289      return code.getSystem();
290      }
291    }
292
293    public enum ObservationRangeCategory {
294        /**
295         * Reference (Normal) Range for Ordinal and Continuous Observations.
296         */
297        REFERENCE, 
298        /**
299         * Critical Range for Ordinal and Continuous Observations. Results outside this range are critical.
300         */
301        CRITICAL, 
302        /**
303         * Absolute Range for Ordinal and Continuous Observations. Results outside this range are not possible.
304         */
305        ABSOLUTE, 
306        /**
307         * added to help the parsers with the generic types
308         */
309        NULL;
310        public static ObservationRangeCategory fromCode(String codeString) throws FHIRException {
311            if (codeString == null || "".equals(codeString))
312                return null;
313        if ("reference".equals(codeString))
314          return REFERENCE;
315        if ("critical".equals(codeString))
316          return CRITICAL;
317        if ("absolute".equals(codeString))
318          return ABSOLUTE;
319        if (Configuration.isAcceptInvalidEnums())
320          return null;
321        else
322          throw new FHIRException("Unknown ObservationRangeCategory code '"+codeString+"'");
323        }
324        public String toCode() {
325          switch (this) {
326            case REFERENCE: return "reference";
327            case CRITICAL: return "critical";
328            case ABSOLUTE: return "absolute";
329            default: return "?";
330          }
331        }
332        public String getSystem() {
333          switch (this) {
334            case REFERENCE: return "http://hl7.org/fhir/observation-range-category";
335            case CRITICAL: return "http://hl7.org/fhir/observation-range-category";
336            case ABSOLUTE: return "http://hl7.org/fhir/observation-range-category";
337            default: return "?";
338          }
339        }
340        public String getDefinition() {
341          switch (this) {
342            case REFERENCE: return "Reference (Normal) Range for Ordinal and Continuous Observations.";
343            case CRITICAL: return "Critical Range for Ordinal and Continuous Observations. Results outside this range are critical.";
344            case ABSOLUTE: return "Absolute Range for Ordinal and Continuous Observations. Results outside this range are not possible.";
345            default: return "?";
346          }
347        }
348        public String getDisplay() {
349          switch (this) {
350            case REFERENCE: return "reference range";
351            case CRITICAL: return "critical range";
352            case ABSOLUTE: return "absolute range";
353            default: return "?";
354          }
355        }
356    }
357
358  public static class ObservationRangeCategoryEnumFactory implements EnumFactory<ObservationRangeCategory> {
359    public ObservationRangeCategory fromCode(String codeString) throws IllegalArgumentException {
360      if (codeString == null || "".equals(codeString))
361            if (codeString == null || "".equals(codeString))
362                return null;
363        if ("reference".equals(codeString))
364          return ObservationRangeCategory.REFERENCE;
365        if ("critical".equals(codeString))
366          return ObservationRangeCategory.CRITICAL;
367        if ("absolute".equals(codeString))
368          return ObservationRangeCategory.ABSOLUTE;
369        throw new IllegalArgumentException("Unknown ObservationRangeCategory code '"+codeString+"'");
370        }
371        public Enumeration<ObservationRangeCategory> fromType(Base code) throws FHIRException {
372          if (code == null)
373            return null;
374          if (code.isEmpty())
375            return new Enumeration<ObservationRangeCategory>(this);
376          String codeString = ((PrimitiveType) code).asStringValue();
377          if (codeString == null || "".equals(codeString))
378            return null;
379        if ("reference".equals(codeString))
380          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.REFERENCE);
381        if ("critical".equals(codeString))
382          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.CRITICAL);
383        if ("absolute".equals(codeString))
384          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.ABSOLUTE);
385        throw new FHIRException("Unknown ObservationRangeCategory code '"+codeString+"'");
386        }
387    public String toCode(ObservationRangeCategory code) {
388      if (code == ObservationRangeCategory.REFERENCE)
389        return "reference";
390      if (code == ObservationRangeCategory.CRITICAL)
391        return "critical";
392      if (code == ObservationRangeCategory.ABSOLUTE)
393        return "absolute";
394      return "?";
395      }
396    public String toSystem(ObservationRangeCategory code) {
397      return code.getSystem();
398      }
399    }
400
401    @Block()
402    public static class ObservationDefinitionQuantitativeDetailsComponent extends BackboneElement implements IBaseBackboneElement {
403        /**
404         * Primary unit used to report quantitative results of observations conforming to this ObservationDefinition.
405         */
406        @Child(name = "unit", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
407        @Description(shortDefinition="Primary unit for quantitative results", formalDefinition="Primary unit used to report quantitative results of observations conforming to this ObservationDefinition." )
408        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ucum-units")
409        protected CodeableConcept unit;
410
411        /**
412         * Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition.
413         */
414        @Child(name = "customaryUnit", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
415        @Description(shortDefinition="Customary (secondary) unit for quantitative results", formalDefinition="Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition." )
416        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ucum-units")
417        protected CodeableConcept customaryUnit;
418
419        /**
420         * Factor for converting value expressed with primary unit to value expressed with secondary unit.
421         */
422        @Child(name = "conversionFactor", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
423        @Description(shortDefinition="Primary to secondary unit conversion factor", formalDefinition="Factor for converting value expressed with primary unit to value expressed with secondary unit." )
424        protected DecimalType conversionFactor;
425
426        /**
427         * Number of digits after decimal separator when the results of such observations are of type Quantity.
428         */
429        @Child(name = "decimalPrecision", type = {IntegerType.class}, order=4, min=0, max=1, modifier=false, summary=false)
430        @Description(shortDefinition="Decimal precision of observation quantitative results", formalDefinition="Number of digits after decimal separator when the results of such observations are of type Quantity." )
431        protected IntegerType decimalPrecision;
432
433        private static final long serialVersionUID = -1745187850L;
434
435    /**
436     * Constructor
437     */
438      public ObservationDefinitionQuantitativeDetailsComponent() {
439        super();
440      }
441
442        /**
443         * @return {@link #unit} (Primary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
444         */
445        public CodeableConcept getUnit() { 
446          if (this.unit == null)
447            if (Configuration.errorOnAutoCreate())
448              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.unit");
449            else if (Configuration.doAutoCreate())
450              this.unit = new CodeableConcept(); // cc
451          return this.unit;
452        }
453
454        public boolean hasUnit() { 
455          return this.unit != null && !this.unit.isEmpty();
456        }
457
458        /**
459         * @param value {@link #unit} (Primary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
460         */
461        public ObservationDefinitionQuantitativeDetailsComponent setUnit(CodeableConcept value) { 
462          this.unit = value;
463          return this;
464        }
465
466        /**
467         * @return {@link #customaryUnit} (Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
468         */
469        public CodeableConcept getCustomaryUnit() { 
470          if (this.customaryUnit == null)
471            if (Configuration.errorOnAutoCreate())
472              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.customaryUnit");
473            else if (Configuration.doAutoCreate())
474              this.customaryUnit = new CodeableConcept(); // cc
475          return this.customaryUnit;
476        }
477
478        public boolean hasCustomaryUnit() { 
479          return this.customaryUnit != null && !this.customaryUnit.isEmpty();
480        }
481
482        /**
483         * @param value {@link #customaryUnit} (Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
484         */
485        public ObservationDefinitionQuantitativeDetailsComponent setCustomaryUnit(CodeableConcept value) { 
486          this.customaryUnit = value;
487          return this;
488        }
489
490        /**
491         * @return {@link #conversionFactor} (Factor for converting value expressed with primary unit to value expressed with secondary unit.). This is the underlying object with id, value and extensions. The accessor "getConversionFactor" gives direct access to the value
492         */
493        public DecimalType getConversionFactorElement() { 
494          if (this.conversionFactor == null)
495            if (Configuration.errorOnAutoCreate())
496              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.conversionFactor");
497            else if (Configuration.doAutoCreate())
498              this.conversionFactor = new DecimalType(); // bb
499          return this.conversionFactor;
500        }
501
502        public boolean hasConversionFactorElement() { 
503          return this.conversionFactor != null && !this.conversionFactor.isEmpty();
504        }
505
506        public boolean hasConversionFactor() { 
507          return this.conversionFactor != null && !this.conversionFactor.isEmpty();
508        }
509
510        /**
511         * @param value {@link #conversionFactor} (Factor for converting value expressed with primary unit to value expressed with secondary unit.). This is the underlying object with id, value and extensions. The accessor "getConversionFactor" gives direct access to the value
512         */
513        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactorElement(DecimalType value) { 
514          this.conversionFactor = value;
515          return this;
516        }
517
518        /**
519         * @return Factor for converting value expressed with primary unit to value expressed with secondary unit.
520         */
521        public BigDecimal getConversionFactor() { 
522          return this.conversionFactor == null ? null : this.conversionFactor.getValue();
523        }
524
525        /**
526         * @param value Factor for converting value expressed with primary unit to value expressed with secondary unit.
527         */
528        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(BigDecimal value) { 
529          if (value == null)
530            this.conversionFactor = null;
531          else {
532            if (this.conversionFactor == null)
533              this.conversionFactor = new DecimalType();
534            this.conversionFactor.setValue(value);
535          }
536          return this;
537        }
538
539        /**
540         * @param value Factor for converting value expressed with primary unit to value expressed with secondary unit.
541         */
542        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(long value) { 
543              this.conversionFactor = new DecimalType();
544            this.conversionFactor.setValue(value);
545          return this;
546        }
547
548        /**
549         * @param value Factor for converting value expressed with primary unit to value expressed with secondary unit.
550         */
551        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(double value) { 
552              this.conversionFactor = new DecimalType();
553            this.conversionFactor.setValue(value);
554          return this;
555        }
556
557        /**
558         * @return {@link #decimalPrecision} (Number of digits after decimal separator when the results of such observations are of type Quantity.). This is the underlying object with id, value and extensions. The accessor "getDecimalPrecision" gives direct access to the value
559         */
560        public IntegerType getDecimalPrecisionElement() { 
561          if (this.decimalPrecision == null)
562            if (Configuration.errorOnAutoCreate())
563              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.decimalPrecision");
564            else if (Configuration.doAutoCreate())
565              this.decimalPrecision = new IntegerType(); // bb
566          return this.decimalPrecision;
567        }
568
569        public boolean hasDecimalPrecisionElement() { 
570          return this.decimalPrecision != null && !this.decimalPrecision.isEmpty();
571        }
572
573        public boolean hasDecimalPrecision() { 
574          return this.decimalPrecision != null && !this.decimalPrecision.isEmpty();
575        }
576
577        /**
578         * @param value {@link #decimalPrecision} (Number of digits after decimal separator when the results of such observations are of type Quantity.). This is the underlying object with id, value and extensions. The accessor "getDecimalPrecision" gives direct access to the value
579         */
580        public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecisionElement(IntegerType value) { 
581          this.decimalPrecision = value;
582          return this;
583        }
584
585        /**
586         * @return Number of digits after decimal separator when the results of such observations are of type Quantity.
587         */
588        public int getDecimalPrecision() { 
589          return this.decimalPrecision == null || this.decimalPrecision.isEmpty() ? 0 : this.decimalPrecision.getValue();
590        }
591
592        /**
593         * @param value Number of digits after decimal separator when the results of such observations are of type Quantity.
594         */
595        public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecision(int value) { 
596            if (this.decimalPrecision == null)
597              this.decimalPrecision = new IntegerType();
598            this.decimalPrecision.setValue(value);
599          return this;
600        }
601
602        protected void listChildren(List<Property> children) {
603          super.listChildren(children);
604          children.add(new Property("unit", "CodeableConcept", "Primary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, unit));
605          children.add(new Property("customaryUnit", "CodeableConcept", "Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, customaryUnit));
606          children.add(new Property("conversionFactor", "decimal", "Factor for converting value expressed with primary unit to value expressed with secondary unit.", 0, 1, conversionFactor));
607          children.add(new Property("decimalPrecision", "integer", "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 1, decimalPrecision));
608        }
609
610        @Override
611        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
612          switch (_hash) {
613          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Primary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, unit);
614          case -1375586437: /*customaryUnit*/  return new Property("customaryUnit", "CodeableConcept", "Secondary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, customaryUnit);
615          case 1438876165: /*conversionFactor*/  return new Property("conversionFactor", "decimal", "Factor for converting value expressed with primary unit to value expressed with secondary unit.", 0, 1, conversionFactor);
616          case -1564447699: /*decimalPrecision*/  return new Property("decimalPrecision", "integer", "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 1, decimalPrecision);
617          default: return super.getNamedProperty(_hash, _name, _checkValid);
618          }
619
620        }
621
622      @Override
623      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
624        switch (hash) {
625        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
626        case -1375586437: /*customaryUnit*/ return this.customaryUnit == null ? new Base[0] : new Base[] {this.customaryUnit}; // CodeableConcept
627        case 1438876165: /*conversionFactor*/ return this.conversionFactor == null ? new Base[0] : new Base[] {this.conversionFactor}; // DecimalType
628        case -1564447699: /*decimalPrecision*/ return this.decimalPrecision == null ? new Base[0] : new Base[] {this.decimalPrecision}; // IntegerType
629        default: return super.getProperty(hash, name, checkValid);
630        }
631
632      }
633
634      @Override
635      public Base setProperty(int hash, String name, Base value) throws FHIRException {
636        switch (hash) {
637        case 3594628: // unit
638          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
639          return value;
640        case -1375586437: // customaryUnit
641          this.customaryUnit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
642          return value;
643        case 1438876165: // conversionFactor
644          this.conversionFactor = TypeConvertor.castToDecimal(value); // DecimalType
645          return value;
646        case -1564447699: // decimalPrecision
647          this.decimalPrecision = TypeConvertor.castToInteger(value); // IntegerType
648          return value;
649        default: return super.setProperty(hash, name, value);
650        }
651
652      }
653
654      @Override
655      public Base setProperty(String name, Base value) throws FHIRException {
656        if (name.equals("unit")) {
657          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
658        } else if (name.equals("customaryUnit")) {
659          this.customaryUnit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
660        } else if (name.equals("conversionFactor")) {
661          this.conversionFactor = TypeConvertor.castToDecimal(value); // DecimalType
662        } else if (name.equals("decimalPrecision")) {
663          this.decimalPrecision = TypeConvertor.castToInteger(value); // IntegerType
664        } else
665          return super.setProperty(name, value);
666        return value;
667      }
668
669      @Override
670      public Base makeProperty(int hash, String name) throws FHIRException {
671        switch (hash) {
672        case 3594628:  return getUnit();
673        case -1375586437:  return getCustomaryUnit();
674        case 1438876165:  return getConversionFactorElement();
675        case -1564447699:  return getDecimalPrecisionElement();
676        default: return super.makeProperty(hash, name);
677        }
678
679      }
680
681      @Override
682      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
683        switch (hash) {
684        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
685        case -1375586437: /*customaryUnit*/ return new String[] {"CodeableConcept"};
686        case 1438876165: /*conversionFactor*/ return new String[] {"decimal"};
687        case -1564447699: /*decimalPrecision*/ return new String[] {"integer"};
688        default: return super.getTypesForProperty(hash, name);
689        }
690
691      }
692
693      @Override
694      public Base addChild(String name) throws FHIRException {
695        if (name.equals("unit")) {
696          this.unit = new CodeableConcept();
697          return this.unit;
698        }
699        else if (name.equals("customaryUnit")) {
700          this.customaryUnit = new CodeableConcept();
701          return this.customaryUnit;
702        }
703        else if (name.equals("conversionFactor")) {
704          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.quantitativeDetails.conversionFactor");
705        }
706        else if (name.equals("decimalPrecision")) {
707          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.quantitativeDetails.decimalPrecision");
708        }
709        else
710          return super.addChild(name);
711      }
712
713      public ObservationDefinitionQuantitativeDetailsComponent copy() {
714        ObservationDefinitionQuantitativeDetailsComponent dst = new ObservationDefinitionQuantitativeDetailsComponent();
715        copyValues(dst);
716        return dst;
717      }
718
719      public void copyValues(ObservationDefinitionQuantitativeDetailsComponent dst) {
720        super.copyValues(dst);
721        dst.unit = unit == null ? null : unit.copy();
722        dst.customaryUnit = customaryUnit == null ? null : customaryUnit.copy();
723        dst.conversionFactor = conversionFactor == null ? null : conversionFactor.copy();
724        dst.decimalPrecision = decimalPrecision == null ? null : decimalPrecision.copy();
725      }
726
727      @Override
728      public boolean equalsDeep(Base other_) {
729        if (!super.equalsDeep(other_))
730          return false;
731        if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent))
732          return false;
733        ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_;
734        return compareDeep(unit, o.unit, true) && compareDeep(customaryUnit, o.customaryUnit, true) && compareDeep(conversionFactor, o.conversionFactor, true)
735           && compareDeep(decimalPrecision, o.decimalPrecision, true);
736      }
737
738      @Override
739      public boolean equalsShallow(Base other_) {
740        if (!super.equalsShallow(other_))
741          return false;
742        if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent))
743          return false;
744        ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_;
745        return compareValues(conversionFactor, o.conversionFactor, true) && compareValues(decimalPrecision, o.decimalPrecision, true)
746          ;
747      }
748
749      public boolean isEmpty() {
750        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(unit, customaryUnit, conversionFactor
751          , decimalPrecision);
752      }
753
754  public String fhirType() {
755    return "ObservationDefinition.quantitativeDetails";
756
757  }
758
759  }
760
761    @Block()
762    public static class ObservationDefinitionQualifiedValueComponent extends BackboneElement implements IBaseBackboneElement {
763        /**
764         * A concept defining the context for this set of qualified values.
765         */
766        @Child(name = "context", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
767        @Description(shortDefinition="Context qualifier for the set of qualified values", formalDefinition="A concept defining the context for this set of qualified values." )
768        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/referencerange-meaning")
769        protected CodeableConcept context;
770
771        /**
772         * The target population this  set of qualified values applies to.
773         */
774        @Child(name = "appliesTo", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
775        @Description(shortDefinition="Targetted population for the set of qualified values", formalDefinition="The target population this  set of qualified values applies to." )
776        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/referencerange-appliesto")
777        protected List<CodeableConcept> appliesTo;
778
779        /**
780         * The gender this  set of qualified values applies to.
781         */
782        @Child(name = "gender", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
783        @Description(shortDefinition="male | female | other | unknown", formalDefinition="The gender this  set of qualified values applies to." )
784        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administrative-gender")
785        protected Enumeration<AdministrativeGender> gender;
786
787        /**
788         * The age range this  set of qualified values applies to.
789         */
790        @Child(name = "age", type = {Range.class}, order=4, min=0, max=1, modifier=false, summary=false)
791        @Description(shortDefinition="Applicable age range for the set of qualified values", formalDefinition="The age range this  set of qualified values applies to." )
792        protected Range age;
793
794        /**
795         * The gestational age this  set of qualified values applies to.
796         */
797        @Child(name = "gestationalAge", type = {Range.class}, order=5, min=0, max=1, modifier=false, summary=false)
798        @Description(shortDefinition="Applicable gestational age range for the set of qualified values", formalDefinition="The gestational age this  set of qualified values applies to." )
799        protected Range gestationalAge;
800
801        /**
802         * Text based condition for which the the set of qualified values is valid.
803         */
804        @Child(name = "condition", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
805        @Description(shortDefinition="Condition associated with the set of qualified values", formalDefinition="Text based condition for which the the set of qualified values is valid." )
806        protected StringType condition;
807
808        /**
809         * The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.
810         */
811        @Child(name = "rangeCategory", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
812        @Description(shortDefinition="reference | critical | absolute", formalDefinition="The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values." )
813        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-range-category")
814        protected Enumeration<ObservationRangeCategory> rangeCategory;
815
816        /**
817         * The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.
818         */
819        @Child(name = "range", type = {Range.class}, order=8, min=0, max=1, modifier=false, summary=false)
820        @Description(shortDefinition="The range for continuous or ordinal observations", formalDefinition="The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values." )
821        protected Range range;
822
823        /**
824         * The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.
825         */
826        @Child(name = "validCodedValueSet", type = {CanonicalType.class}, order=9, min=0, max=1, modifier=false, summary=false)
827        @Description(shortDefinition="Value set of valid coded values as part of this set of qualified values", formalDefinition="The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values." )
828        protected CanonicalType validCodedValueSet;
829
830        /**
831         * The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.
832         */
833        @Child(name = "normalCodedValueSet", type = {CanonicalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
834        @Description(shortDefinition="Value set of normal coded values as part of this set of qualified values", formalDefinition="The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values." )
835        protected CanonicalType normalCodedValueSet;
836
837        /**
838         * The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.
839         */
840        @Child(name = "abnormalCodedValueSet", type = {CanonicalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
841        @Description(shortDefinition="Value set of abnormal coded values as part of this set of qualified values", formalDefinition="The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values." )
842        protected CanonicalType abnormalCodedValueSet;
843
844        /**
845         * The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.
846         */
847        @Child(name = "criticalCodedValueSet", type = {CanonicalType.class}, order=12, min=0, max=1, modifier=false, summary=false)
848        @Description(shortDefinition="Value set of critical coded values as part of this set of qualified values", formalDefinition="The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values." )
849        protected CanonicalType criticalCodedValueSet;
850
851        private static final long serialVersionUID = -538666361L;
852
853    /**
854     * Constructor
855     */
856      public ObservationDefinitionQualifiedValueComponent() {
857        super();
858      }
859
860        /**
861         * @return {@link #context} (A concept defining the context for this set of qualified values.)
862         */
863        public CodeableConcept getContext() { 
864          if (this.context == null)
865            if (Configuration.errorOnAutoCreate())
866              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.context");
867            else if (Configuration.doAutoCreate())
868              this.context = new CodeableConcept(); // cc
869          return this.context;
870        }
871
872        public boolean hasContext() { 
873          return this.context != null && !this.context.isEmpty();
874        }
875
876        /**
877         * @param value {@link #context} (A concept defining the context for this set of qualified values.)
878         */
879        public ObservationDefinitionQualifiedValueComponent setContext(CodeableConcept value) { 
880          this.context = value;
881          return this;
882        }
883
884        /**
885         * @return {@link #appliesTo} (The target population this  set of qualified values applies to.)
886         */
887        public List<CodeableConcept> getAppliesTo() { 
888          if (this.appliesTo == null)
889            this.appliesTo = new ArrayList<CodeableConcept>();
890          return this.appliesTo;
891        }
892
893        /**
894         * @return Returns a reference to <code>this</code> for easy method chaining
895         */
896        public ObservationDefinitionQualifiedValueComponent setAppliesTo(List<CodeableConcept> theAppliesTo) { 
897          this.appliesTo = theAppliesTo;
898          return this;
899        }
900
901        public boolean hasAppliesTo() { 
902          if (this.appliesTo == null)
903            return false;
904          for (CodeableConcept item : this.appliesTo)
905            if (!item.isEmpty())
906              return true;
907          return false;
908        }
909
910        public CodeableConcept addAppliesTo() { //3
911          CodeableConcept t = new CodeableConcept();
912          if (this.appliesTo == null)
913            this.appliesTo = new ArrayList<CodeableConcept>();
914          this.appliesTo.add(t);
915          return t;
916        }
917
918        public ObservationDefinitionQualifiedValueComponent addAppliesTo(CodeableConcept t) { //3
919          if (t == null)
920            return this;
921          if (this.appliesTo == null)
922            this.appliesTo = new ArrayList<CodeableConcept>();
923          this.appliesTo.add(t);
924          return this;
925        }
926
927        /**
928         * @return The first repetition of repeating field {@link #appliesTo}, creating it if it does not already exist {3}
929         */
930        public CodeableConcept getAppliesToFirstRep() { 
931          if (getAppliesTo().isEmpty()) {
932            addAppliesTo();
933          }
934          return getAppliesTo().get(0);
935        }
936
937        /**
938         * @return {@link #gender} (The gender this  set of qualified values applies to.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
939         */
940        public Enumeration<AdministrativeGender> getGenderElement() { 
941          if (this.gender == null)
942            if (Configuration.errorOnAutoCreate())
943              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.gender");
944            else if (Configuration.doAutoCreate())
945              this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
946          return this.gender;
947        }
948
949        public boolean hasGenderElement() { 
950          return this.gender != null && !this.gender.isEmpty();
951        }
952
953        public boolean hasGender() { 
954          return this.gender != null && !this.gender.isEmpty();
955        }
956
957        /**
958         * @param value {@link #gender} (The gender this  set of qualified values applies to.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
959         */
960        public ObservationDefinitionQualifiedValueComponent setGenderElement(Enumeration<AdministrativeGender> value) { 
961          this.gender = value;
962          return this;
963        }
964
965        /**
966         * @return The gender this  set of qualified values applies to.
967         */
968        public AdministrativeGender getGender() { 
969          return this.gender == null ? null : this.gender.getValue();
970        }
971
972        /**
973         * @param value The gender this  set of qualified values applies to.
974         */
975        public ObservationDefinitionQualifiedValueComponent setGender(AdministrativeGender value) { 
976          if (value == null)
977            this.gender = null;
978          else {
979            if (this.gender == null)
980              this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
981            this.gender.setValue(value);
982          }
983          return this;
984        }
985
986        /**
987         * @return {@link #age} (The age range this  set of qualified values applies to.)
988         */
989        public Range getAge() { 
990          if (this.age == null)
991            if (Configuration.errorOnAutoCreate())
992              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.age");
993            else if (Configuration.doAutoCreate())
994              this.age = new Range(); // cc
995          return this.age;
996        }
997
998        public boolean hasAge() { 
999          return this.age != null && !this.age.isEmpty();
1000        }
1001
1002        /**
1003         * @param value {@link #age} (The age range this  set of qualified values applies to.)
1004         */
1005        public ObservationDefinitionQualifiedValueComponent setAge(Range value) { 
1006          this.age = value;
1007          return this;
1008        }
1009
1010        /**
1011         * @return {@link #gestationalAge} (The gestational age this  set of qualified values applies to.)
1012         */
1013        public Range getGestationalAge() { 
1014          if (this.gestationalAge == null)
1015            if (Configuration.errorOnAutoCreate())
1016              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.gestationalAge");
1017            else if (Configuration.doAutoCreate())
1018              this.gestationalAge = new Range(); // cc
1019          return this.gestationalAge;
1020        }
1021
1022        public boolean hasGestationalAge() { 
1023          return this.gestationalAge != null && !this.gestationalAge.isEmpty();
1024        }
1025
1026        /**
1027         * @param value {@link #gestationalAge} (The gestational age this  set of qualified values applies to.)
1028         */
1029        public ObservationDefinitionQualifiedValueComponent setGestationalAge(Range value) { 
1030          this.gestationalAge = value;
1031          return this;
1032        }
1033
1034        /**
1035         * @return {@link #condition} (Text based condition for which the the set of qualified values is valid.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
1036         */
1037        public StringType getConditionElement() { 
1038          if (this.condition == null)
1039            if (Configuration.errorOnAutoCreate())
1040              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.condition");
1041            else if (Configuration.doAutoCreate())
1042              this.condition = new StringType(); // bb
1043          return this.condition;
1044        }
1045
1046        public boolean hasConditionElement() { 
1047          return this.condition != null && !this.condition.isEmpty();
1048        }
1049
1050        public boolean hasCondition() { 
1051          return this.condition != null && !this.condition.isEmpty();
1052        }
1053
1054        /**
1055         * @param value {@link #condition} (Text based condition for which the the set of qualified values is valid.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
1056         */
1057        public ObservationDefinitionQualifiedValueComponent setConditionElement(StringType value) { 
1058          this.condition = value;
1059          return this;
1060        }
1061
1062        /**
1063         * @return Text based condition for which the the set of qualified values is valid.
1064         */
1065        public String getCondition() { 
1066          return this.condition == null ? null : this.condition.getValue();
1067        }
1068
1069        /**
1070         * @param value Text based condition for which the the set of qualified values is valid.
1071         */
1072        public ObservationDefinitionQualifiedValueComponent setCondition(String value) { 
1073          if (Utilities.noString(value))
1074            this.condition = null;
1075          else {
1076            if (this.condition == null)
1077              this.condition = new StringType();
1078            this.condition.setValue(value);
1079          }
1080          return this;
1081        }
1082
1083        /**
1084         * @return {@link #rangeCategory} (The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getRangeCategory" gives direct access to the value
1085         */
1086        public Enumeration<ObservationRangeCategory> getRangeCategoryElement() { 
1087          if (this.rangeCategory == null)
1088            if (Configuration.errorOnAutoCreate())
1089              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.rangeCategory");
1090            else if (Configuration.doAutoCreate())
1091              this.rangeCategory = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory()); // bb
1092          return this.rangeCategory;
1093        }
1094
1095        public boolean hasRangeCategoryElement() { 
1096          return this.rangeCategory != null && !this.rangeCategory.isEmpty();
1097        }
1098
1099        public boolean hasRangeCategory() { 
1100          return this.rangeCategory != null && !this.rangeCategory.isEmpty();
1101        }
1102
1103        /**
1104         * @param value {@link #rangeCategory} (The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getRangeCategory" gives direct access to the value
1105         */
1106        public ObservationDefinitionQualifiedValueComponent setRangeCategoryElement(Enumeration<ObservationRangeCategory> value) { 
1107          this.rangeCategory = value;
1108          return this;
1109        }
1110
1111        /**
1112         * @return The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.
1113         */
1114        public ObservationRangeCategory getRangeCategory() { 
1115          return this.rangeCategory == null ? null : this.rangeCategory.getValue();
1116        }
1117
1118        /**
1119         * @param value The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.
1120         */
1121        public ObservationDefinitionQualifiedValueComponent setRangeCategory(ObservationRangeCategory value) { 
1122          if (value == null)
1123            this.rangeCategory = null;
1124          else {
1125            if (this.rangeCategory == null)
1126              this.rangeCategory = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory());
1127            this.rangeCategory.setValue(value);
1128          }
1129          return this;
1130        }
1131
1132        /**
1133         * @return {@link #range} (The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.)
1134         */
1135        public Range getRange() { 
1136          if (this.range == null)
1137            if (Configuration.errorOnAutoCreate())
1138              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.range");
1139            else if (Configuration.doAutoCreate())
1140              this.range = new Range(); // cc
1141          return this.range;
1142        }
1143
1144        public boolean hasRange() { 
1145          return this.range != null && !this.range.isEmpty();
1146        }
1147
1148        /**
1149         * @param value {@link #range} (The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.)
1150         */
1151        public ObservationDefinitionQualifiedValueComponent setRange(Range value) { 
1152          this.range = value;
1153          return this;
1154        }
1155
1156        /**
1157         * @return {@link #validCodedValueSet} (The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getValidCodedValueSet" gives direct access to the value
1158         */
1159        public CanonicalType getValidCodedValueSetElement() { 
1160          if (this.validCodedValueSet == null)
1161            if (Configuration.errorOnAutoCreate())
1162              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.validCodedValueSet");
1163            else if (Configuration.doAutoCreate())
1164              this.validCodedValueSet = new CanonicalType(); // bb
1165          return this.validCodedValueSet;
1166        }
1167
1168        public boolean hasValidCodedValueSetElement() { 
1169          return this.validCodedValueSet != null && !this.validCodedValueSet.isEmpty();
1170        }
1171
1172        public boolean hasValidCodedValueSet() { 
1173          return this.validCodedValueSet != null && !this.validCodedValueSet.isEmpty();
1174        }
1175
1176        /**
1177         * @param value {@link #validCodedValueSet} (The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getValidCodedValueSet" gives direct access to the value
1178         */
1179        public ObservationDefinitionQualifiedValueComponent setValidCodedValueSetElement(CanonicalType value) { 
1180          this.validCodedValueSet = value;
1181          return this;
1182        }
1183
1184        /**
1185         * @return The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.
1186         */
1187        public String getValidCodedValueSet() { 
1188          return this.validCodedValueSet == null ? null : this.validCodedValueSet.getValue();
1189        }
1190
1191        /**
1192         * @param value The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.
1193         */
1194        public ObservationDefinitionQualifiedValueComponent setValidCodedValueSet(String value) { 
1195          if (Utilities.noString(value))
1196            this.validCodedValueSet = null;
1197          else {
1198            if (this.validCodedValueSet == null)
1199              this.validCodedValueSet = new CanonicalType();
1200            this.validCodedValueSet.setValue(value);
1201          }
1202          return this;
1203        }
1204
1205        /**
1206         * @return {@link #normalCodedValueSet} (The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getNormalCodedValueSet" gives direct access to the value
1207         */
1208        public CanonicalType getNormalCodedValueSetElement() { 
1209          if (this.normalCodedValueSet == null)
1210            if (Configuration.errorOnAutoCreate())
1211              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.normalCodedValueSet");
1212            else if (Configuration.doAutoCreate())
1213              this.normalCodedValueSet = new CanonicalType(); // bb
1214          return this.normalCodedValueSet;
1215        }
1216
1217        public boolean hasNormalCodedValueSetElement() { 
1218          return this.normalCodedValueSet != null && !this.normalCodedValueSet.isEmpty();
1219        }
1220
1221        public boolean hasNormalCodedValueSet() { 
1222          return this.normalCodedValueSet != null && !this.normalCodedValueSet.isEmpty();
1223        }
1224
1225        /**
1226         * @param value {@link #normalCodedValueSet} (The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getNormalCodedValueSet" gives direct access to the value
1227         */
1228        public ObservationDefinitionQualifiedValueComponent setNormalCodedValueSetElement(CanonicalType value) { 
1229          this.normalCodedValueSet = value;
1230          return this;
1231        }
1232
1233        /**
1234         * @return The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.
1235         */
1236        public String getNormalCodedValueSet() { 
1237          return this.normalCodedValueSet == null ? null : this.normalCodedValueSet.getValue();
1238        }
1239
1240        /**
1241         * @param value The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.
1242         */
1243        public ObservationDefinitionQualifiedValueComponent setNormalCodedValueSet(String value) { 
1244          if (Utilities.noString(value))
1245            this.normalCodedValueSet = null;
1246          else {
1247            if (this.normalCodedValueSet == null)
1248              this.normalCodedValueSet = new CanonicalType();
1249            this.normalCodedValueSet.setValue(value);
1250          }
1251          return this;
1252        }
1253
1254        /**
1255         * @return {@link #abnormalCodedValueSet} (The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getAbnormalCodedValueSet" gives direct access to the value
1256         */
1257        public CanonicalType getAbnormalCodedValueSetElement() { 
1258          if (this.abnormalCodedValueSet == null)
1259            if (Configuration.errorOnAutoCreate())
1260              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.abnormalCodedValueSet");
1261            else if (Configuration.doAutoCreate())
1262              this.abnormalCodedValueSet = new CanonicalType(); // bb
1263          return this.abnormalCodedValueSet;
1264        }
1265
1266        public boolean hasAbnormalCodedValueSetElement() { 
1267          return this.abnormalCodedValueSet != null && !this.abnormalCodedValueSet.isEmpty();
1268        }
1269
1270        public boolean hasAbnormalCodedValueSet() { 
1271          return this.abnormalCodedValueSet != null && !this.abnormalCodedValueSet.isEmpty();
1272        }
1273
1274        /**
1275         * @param value {@link #abnormalCodedValueSet} (The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getAbnormalCodedValueSet" gives direct access to the value
1276         */
1277        public ObservationDefinitionQualifiedValueComponent setAbnormalCodedValueSetElement(CanonicalType value) { 
1278          this.abnormalCodedValueSet = value;
1279          return this;
1280        }
1281
1282        /**
1283         * @return The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.
1284         */
1285        public String getAbnormalCodedValueSet() { 
1286          return this.abnormalCodedValueSet == null ? null : this.abnormalCodedValueSet.getValue();
1287        }
1288
1289        /**
1290         * @param value The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.
1291         */
1292        public ObservationDefinitionQualifiedValueComponent setAbnormalCodedValueSet(String value) { 
1293          if (Utilities.noString(value))
1294            this.abnormalCodedValueSet = null;
1295          else {
1296            if (this.abnormalCodedValueSet == null)
1297              this.abnormalCodedValueSet = new CanonicalType();
1298            this.abnormalCodedValueSet.setValue(value);
1299          }
1300          return this;
1301        }
1302
1303        /**
1304         * @return {@link #criticalCodedValueSet} (The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getCriticalCodedValueSet" gives direct access to the value
1305         */
1306        public CanonicalType getCriticalCodedValueSetElement() { 
1307          if (this.criticalCodedValueSet == null)
1308            if (Configuration.errorOnAutoCreate())
1309              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedValueComponent.criticalCodedValueSet");
1310            else if (Configuration.doAutoCreate())
1311              this.criticalCodedValueSet = new CanonicalType(); // bb
1312          return this.criticalCodedValueSet;
1313        }
1314
1315        public boolean hasCriticalCodedValueSetElement() { 
1316          return this.criticalCodedValueSet != null && !this.criticalCodedValueSet.isEmpty();
1317        }
1318
1319        public boolean hasCriticalCodedValueSet() { 
1320          return this.criticalCodedValueSet != null && !this.criticalCodedValueSet.isEmpty();
1321        }
1322
1323        /**
1324         * @param value {@link #criticalCodedValueSet} (The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.). This is the underlying object with id, value and extensions. The accessor "getCriticalCodedValueSet" gives direct access to the value
1325         */
1326        public ObservationDefinitionQualifiedValueComponent setCriticalCodedValueSetElement(CanonicalType value) { 
1327          this.criticalCodedValueSet = value;
1328          return this;
1329        }
1330
1331        /**
1332         * @return The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.
1333         */
1334        public String getCriticalCodedValueSet() { 
1335          return this.criticalCodedValueSet == null ? null : this.criticalCodedValueSet.getValue();
1336        }
1337
1338        /**
1339         * @param value The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.
1340         */
1341        public ObservationDefinitionQualifiedValueComponent setCriticalCodedValueSet(String value) { 
1342          if (Utilities.noString(value))
1343            this.criticalCodedValueSet = null;
1344          else {
1345            if (this.criticalCodedValueSet == null)
1346              this.criticalCodedValueSet = new CanonicalType();
1347            this.criticalCodedValueSet.setValue(value);
1348          }
1349          return this;
1350        }
1351
1352        protected void listChildren(List<Property> children) {
1353          super.listChildren(children);
1354          children.add(new Property("context", "CodeableConcept", "A concept defining the context for this set of qualified values.", 0, 1, context));
1355          children.add(new Property("appliesTo", "CodeableConcept", "The target population this  set of qualified values applies to.", 0, java.lang.Integer.MAX_VALUE, appliesTo));
1356          children.add(new Property("gender", "code", "The gender this  set of qualified values applies to.", 0, 1, gender));
1357          children.add(new Property("age", "Range", "The age range this  set of qualified values applies to.", 0, 1, age));
1358          children.add(new Property("gestationalAge", "Range", "The gestational age this  set of qualified values applies to.", 0, 1, gestationalAge));
1359          children.add(new Property("condition", "string", "Text based condition for which the the set of qualified values is valid.", 0, 1, condition));
1360          children.add(new Property("rangeCategory", "code", "The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.", 0, 1, rangeCategory));
1361          children.add(new Property("range", "Range", "The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.", 0, 1, range));
1362          children.add(new Property("validCodedValueSet", "canonical(ValueSet)", "The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, validCodedValueSet));
1363          children.add(new Property("normalCodedValueSet", "canonical(ValueSet)", "The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, normalCodedValueSet));
1364          children.add(new Property("abnormalCodedValueSet", "canonical(ValueSet)", "The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, abnormalCodedValueSet));
1365          children.add(new Property("criticalCodedValueSet", "canonical(ValueSet)", "The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, criticalCodedValueSet));
1366        }
1367
1368        @Override
1369        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1370          switch (_hash) {
1371          case 951530927: /*context*/  return new Property("context", "CodeableConcept", "A concept defining the context for this set of qualified values.", 0, 1, context);
1372          case -2089924569: /*appliesTo*/  return new Property("appliesTo", "CodeableConcept", "The target population this  set of qualified values applies to.", 0, java.lang.Integer.MAX_VALUE, appliesTo);
1373          case -1249512767: /*gender*/  return new Property("gender", "code", "The gender this  set of qualified values applies to.", 0, 1, gender);
1374          case 96511: /*age*/  return new Property("age", "Range", "The age range this  set of qualified values applies to.", 0, 1, age);
1375          case -241217538: /*gestationalAge*/  return new Property("gestationalAge", "Range", "The gestational age this  set of qualified values applies to.", 0, 1, gestationalAge);
1376          case -861311717: /*condition*/  return new Property("condition", "string", "Text based condition for which the the set of qualified values is valid.", 0, 1, condition);
1377          case -363410085: /*rangeCategory*/  return new Property("rangeCategory", "code", "The category of range of values for continuous or ordinal observations that match the criteria of this set of qualified values.", 0, 1, rangeCategory);
1378          case 108280125: /*range*/  return new Property("range", "Range", "The range of values defined for continuous or ordinal observations that match the criteria of this set of qualified values.", 0, 1, range);
1379          case 1374640076: /*validCodedValueSet*/  return new Property("validCodedValueSet", "canonical(ValueSet)", "The set of valid coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, validCodedValueSet);
1380          case -837500735: /*normalCodedValueSet*/  return new Property("normalCodedValueSet", "canonical(ValueSet)", "The set of normal coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, normalCodedValueSet);
1381          case 1073600256: /*abnormalCodedValueSet*/  return new Property("abnormalCodedValueSet", "canonical(ValueSet)", "The set of abnormal coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, abnormalCodedValueSet);
1382          case 2568457: /*criticalCodedValueSet*/  return new Property("criticalCodedValueSet", "canonical(ValueSet)", "The set of critical coded results for qualitative observations  that match the criteria of this set of qualified values.", 0, 1, criticalCodedValueSet);
1383          default: return super.getNamedProperty(_hash, _name, _checkValid);
1384          }
1385
1386        }
1387
1388      @Override
1389      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1390        switch (hash) {
1391        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // CodeableConcept
1392        case -2089924569: /*appliesTo*/ return this.appliesTo == null ? new Base[0] : this.appliesTo.toArray(new Base[this.appliesTo.size()]); // CodeableConcept
1393        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
1394        case 96511: /*age*/ return this.age == null ? new Base[0] : new Base[] {this.age}; // Range
1395        case -241217538: /*gestationalAge*/ return this.gestationalAge == null ? new Base[0] : new Base[] {this.gestationalAge}; // Range
1396        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
1397        case -363410085: /*rangeCategory*/ return this.rangeCategory == null ? new Base[0] : new Base[] {this.rangeCategory}; // Enumeration<ObservationRangeCategory>
1398        case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // Range
1399        case 1374640076: /*validCodedValueSet*/ return this.validCodedValueSet == null ? new Base[0] : new Base[] {this.validCodedValueSet}; // CanonicalType
1400        case -837500735: /*normalCodedValueSet*/ return this.normalCodedValueSet == null ? new Base[0] : new Base[] {this.normalCodedValueSet}; // CanonicalType
1401        case 1073600256: /*abnormalCodedValueSet*/ return this.abnormalCodedValueSet == null ? new Base[0] : new Base[] {this.abnormalCodedValueSet}; // CanonicalType
1402        case 2568457: /*criticalCodedValueSet*/ return this.criticalCodedValueSet == null ? new Base[0] : new Base[] {this.criticalCodedValueSet}; // CanonicalType
1403        default: return super.getProperty(hash, name, checkValid);
1404        }
1405
1406      }
1407
1408      @Override
1409      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1410        switch (hash) {
1411        case 951530927: // context
1412          this.context = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1413          return value;
1414        case -2089924569: // appliesTo
1415          this.getAppliesTo().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1416          return value;
1417        case -1249512767: // gender
1418          value = new AdministrativeGenderEnumFactory().fromType(TypeConvertor.castToCode(value));
1419          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1420          return value;
1421        case 96511: // age
1422          this.age = TypeConvertor.castToRange(value); // Range
1423          return value;
1424        case -241217538: // gestationalAge
1425          this.gestationalAge = TypeConvertor.castToRange(value); // Range
1426          return value;
1427        case -861311717: // condition
1428          this.condition = TypeConvertor.castToString(value); // StringType
1429          return value;
1430        case -363410085: // rangeCategory
1431          value = new ObservationRangeCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1432          this.rangeCategory = (Enumeration) value; // Enumeration<ObservationRangeCategory>
1433          return value;
1434        case 108280125: // range
1435          this.range = TypeConvertor.castToRange(value); // Range
1436          return value;
1437        case 1374640076: // validCodedValueSet
1438          this.validCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1439          return value;
1440        case -837500735: // normalCodedValueSet
1441          this.normalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1442          return value;
1443        case 1073600256: // abnormalCodedValueSet
1444          this.abnormalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1445          return value;
1446        case 2568457: // criticalCodedValueSet
1447          this.criticalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1448          return value;
1449        default: return super.setProperty(hash, name, value);
1450        }
1451
1452      }
1453
1454      @Override
1455      public Base setProperty(String name, Base value) throws FHIRException {
1456        if (name.equals("context")) {
1457          this.context = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1458        } else if (name.equals("appliesTo")) {
1459          this.getAppliesTo().add(TypeConvertor.castToCodeableConcept(value));
1460        } else if (name.equals("gender")) {
1461          value = new AdministrativeGenderEnumFactory().fromType(TypeConvertor.castToCode(value));
1462          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1463        } else if (name.equals("age")) {
1464          this.age = TypeConvertor.castToRange(value); // Range
1465        } else if (name.equals("gestationalAge")) {
1466          this.gestationalAge = TypeConvertor.castToRange(value); // Range
1467        } else if (name.equals("condition")) {
1468          this.condition = TypeConvertor.castToString(value); // StringType
1469        } else if (name.equals("rangeCategory")) {
1470          value = new ObservationRangeCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1471          this.rangeCategory = (Enumeration) value; // Enumeration<ObservationRangeCategory>
1472        } else if (name.equals("range")) {
1473          this.range = TypeConvertor.castToRange(value); // Range
1474        } else if (name.equals("validCodedValueSet")) {
1475          this.validCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1476        } else if (name.equals("normalCodedValueSet")) {
1477          this.normalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1478        } else if (name.equals("abnormalCodedValueSet")) {
1479          this.abnormalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1480        } else if (name.equals("criticalCodedValueSet")) {
1481          this.criticalCodedValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
1482        } else
1483          return super.setProperty(name, value);
1484        return value;
1485      }
1486
1487      @Override
1488      public Base makeProperty(int hash, String name) throws FHIRException {
1489        switch (hash) {
1490        case 951530927:  return getContext();
1491        case -2089924569:  return addAppliesTo(); 
1492        case -1249512767:  return getGenderElement();
1493        case 96511:  return getAge();
1494        case -241217538:  return getGestationalAge();
1495        case -861311717:  return getConditionElement();
1496        case -363410085:  return getRangeCategoryElement();
1497        case 108280125:  return getRange();
1498        case 1374640076:  return getValidCodedValueSetElement();
1499        case -837500735:  return getNormalCodedValueSetElement();
1500        case 1073600256:  return getAbnormalCodedValueSetElement();
1501        case 2568457:  return getCriticalCodedValueSetElement();
1502        default: return super.makeProperty(hash, name);
1503        }
1504
1505      }
1506
1507      @Override
1508      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1509        switch (hash) {
1510        case 951530927: /*context*/ return new String[] {"CodeableConcept"};
1511        case -2089924569: /*appliesTo*/ return new String[] {"CodeableConcept"};
1512        case -1249512767: /*gender*/ return new String[] {"code"};
1513        case 96511: /*age*/ return new String[] {"Range"};
1514        case -241217538: /*gestationalAge*/ return new String[] {"Range"};
1515        case -861311717: /*condition*/ return new String[] {"string"};
1516        case -363410085: /*rangeCategory*/ return new String[] {"code"};
1517        case 108280125: /*range*/ return new String[] {"Range"};
1518        case 1374640076: /*validCodedValueSet*/ return new String[] {"canonical"};
1519        case -837500735: /*normalCodedValueSet*/ return new String[] {"canonical"};
1520        case 1073600256: /*abnormalCodedValueSet*/ return new String[] {"canonical"};
1521        case 2568457: /*criticalCodedValueSet*/ return new String[] {"canonical"};
1522        default: return super.getTypesForProperty(hash, name);
1523        }
1524
1525      }
1526
1527      @Override
1528      public Base addChild(String name) throws FHIRException {
1529        if (name.equals("context")) {
1530          this.context = new CodeableConcept();
1531          return this.context;
1532        }
1533        else if (name.equals("appliesTo")) {
1534          return addAppliesTo();
1535        }
1536        else if (name.equals("gender")) {
1537          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.gender");
1538        }
1539        else if (name.equals("age")) {
1540          this.age = new Range();
1541          return this.age;
1542        }
1543        else if (name.equals("gestationalAge")) {
1544          this.gestationalAge = new Range();
1545          return this.gestationalAge;
1546        }
1547        else if (name.equals("condition")) {
1548          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.condition");
1549        }
1550        else if (name.equals("rangeCategory")) {
1551          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.rangeCategory");
1552        }
1553        else if (name.equals("range")) {
1554          this.range = new Range();
1555          return this.range;
1556        }
1557        else if (name.equals("validCodedValueSet")) {
1558          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.validCodedValueSet");
1559        }
1560        else if (name.equals("normalCodedValueSet")) {
1561          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.normalCodedValueSet");
1562        }
1563        else if (name.equals("abnormalCodedValueSet")) {
1564          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.abnormalCodedValueSet");
1565        }
1566        else if (name.equals("criticalCodedValueSet")) {
1567          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedValue.criticalCodedValueSet");
1568        }
1569        else
1570          return super.addChild(name);
1571      }
1572
1573      public ObservationDefinitionQualifiedValueComponent copy() {
1574        ObservationDefinitionQualifiedValueComponent dst = new ObservationDefinitionQualifiedValueComponent();
1575        copyValues(dst);
1576        return dst;
1577      }
1578
1579      public void copyValues(ObservationDefinitionQualifiedValueComponent dst) {
1580        super.copyValues(dst);
1581        dst.context = context == null ? null : context.copy();
1582        if (appliesTo != null) {
1583          dst.appliesTo = new ArrayList<CodeableConcept>();
1584          for (CodeableConcept i : appliesTo)
1585            dst.appliesTo.add(i.copy());
1586        };
1587        dst.gender = gender == null ? null : gender.copy();
1588        dst.age = age == null ? null : age.copy();
1589        dst.gestationalAge = gestationalAge == null ? null : gestationalAge.copy();
1590        dst.condition = condition == null ? null : condition.copy();
1591        dst.rangeCategory = rangeCategory == null ? null : rangeCategory.copy();
1592        dst.range = range == null ? null : range.copy();
1593        dst.validCodedValueSet = validCodedValueSet == null ? null : validCodedValueSet.copy();
1594        dst.normalCodedValueSet = normalCodedValueSet == null ? null : normalCodedValueSet.copy();
1595        dst.abnormalCodedValueSet = abnormalCodedValueSet == null ? null : abnormalCodedValueSet.copy();
1596        dst.criticalCodedValueSet = criticalCodedValueSet == null ? null : criticalCodedValueSet.copy();
1597      }
1598
1599      @Override
1600      public boolean equalsDeep(Base other_) {
1601        if (!super.equalsDeep(other_))
1602          return false;
1603        if (!(other_ instanceof ObservationDefinitionQualifiedValueComponent))
1604          return false;
1605        ObservationDefinitionQualifiedValueComponent o = (ObservationDefinitionQualifiedValueComponent) other_;
1606        return compareDeep(context, o.context, true) && compareDeep(appliesTo, o.appliesTo, true) && compareDeep(gender, o.gender, true)
1607           && compareDeep(age, o.age, true) && compareDeep(gestationalAge, o.gestationalAge, true) && compareDeep(condition, o.condition, true)
1608           && compareDeep(rangeCategory, o.rangeCategory, true) && compareDeep(range, o.range, true) && compareDeep(validCodedValueSet, o.validCodedValueSet, true)
1609           && compareDeep(normalCodedValueSet, o.normalCodedValueSet, true) && compareDeep(abnormalCodedValueSet, o.abnormalCodedValueSet, true)
1610           && compareDeep(criticalCodedValueSet, o.criticalCodedValueSet, true);
1611      }
1612
1613      @Override
1614      public boolean equalsShallow(Base other_) {
1615        if (!super.equalsShallow(other_))
1616          return false;
1617        if (!(other_ instanceof ObservationDefinitionQualifiedValueComponent))
1618          return false;
1619        ObservationDefinitionQualifiedValueComponent o = (ObservationDefinitionQualifiedValueComponent) other_;
1620        return compareValues(gender, o.gender, true) && compareValues(condition, o.condition, true) && compareValues(rangeCategory, o.rangeCategory, true)
1621           && compareValues(validCodedValueSet, o.validCodedValueSet, true) && compareValues(normalCodedValueSet, o.normalCodedValueSet, true)
1622           && compareValues(abnormalCodedValueSet, o.abnormalCodedValueSet, true) && compareValues(criticalCodedValueSet, o.criticalCodedValueSet, true)
1623          ;
1624      }
1625
1626      public boolean isEmpty() {
1627        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(context, appliesTo, gender
1628          , age, gestationalAge, condition, rangeCategory, range, validCodedValueSet, normalCodedValueSet
1629          , abnormalCodedValueSet, criticalCodedValueSet);
1630      }
1631
1632  public String fhirType() {
1633    return "ObservationDefinition.qualifiedValue";
1634
1635  }
1636
1637  }
1638
1639    @Block()
1640    public static class ObservationDefinitionComponentComponent extends BackboneElement implements IBaseBackboneElement {
1641        /**
1642         * Describes what will be observed.
1643         */
1644        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1645        @Description(shortDefinition="Type of observation", formalDefinition="Describes what will be observed." )
1646        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
1647        protected CodeableConcept code;
1648
1649        /**
1650         * The data types allowed for the value element of the instance of this component observations.
1651         */
1652        @Child(name = "permittedDataType", type = {CodeType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1653        @Description(shortDefinition="Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period", formalDefinition="The data types allowed for the value element of the instance of this component observations." )
1654        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/permitted-data-type")
1655        protected List<Enumeration<ObservationDataType>> permittedDataType;
1656
1657        /**
1658         * Characteristics for quantitative results of this observation.
1659         */
1660        @Child(name = "quantitativeDetails", type = {ObservationDefinitionQuantitativeDetailsComponent.class}, order=3, min=0, max=1, modifier=false, summary=false)
1661        @Description(shortDefinition="Characteristics of quantitative results", formalDefinition="Characteristics for quantitative results of this observation." )
1662        protected ObservationDefinitionQuantitativeDetailsComponent quantitativeDetails;
1663
1664        /**
1665         * A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.
1666         */
1667        @Child(name = "qualifiedValue", type = {ObservationDefinitionQualifiedValueComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1668        @Description(shortDefinition="Set of qualified values for observation results", formalDefinition="A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations." )
1669        protected List<ObservationDefinitionQualifiedValueComponent> qualifiedValue;
1670
1671        private static final long serialVersionUID = -369470835L;
1672
1673    /**
1674     * Constructor
1675     */
1676      public ObservationDefinitionComponentComponent() {
1677        super();
1678      }
1679
1680    /**
1681     * Constructor
1682     */
1683      public ObservationDefinitionComponentComponent(CodeableConcept code) {
1684        super();
1685        this.setCode(code);
1686      }
1687
1688        /**
1689         * @return {@link #code} (Describes what will be observed.)
1690         */
1691        public CodeableConcept getCode() { 
1692          if (this.code == null)
1693            if (Configuration.errorOnAutoCreate())
1694              throw new Error("Attempt to auto-create ObservationDefinitionComponentComponent.code");
1695            else if (Configuration.doAutoCreate())
1696              this.code = new CodeableConcept(); // cc
1697          return this.code;
1698        }
1699
1700        public boolean hasCode() { 
1701          return this.code != null && !this.code.isEmpty();
1702        }
1703
1704        /**
1705         * @param value {@link #code} (Describes what will be observed.)
1706         */
1707        public ObservationDefinitionComponentComponent setCode(CodeableConcept value) { 
1708          this.code = value;
1709          return this;
1710        }
1711
1712        /**
1713         * @return {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1714         */
1715        public List<Enumeration<ObservationDataType>> getPermittedDataType() { 
1716          if (this.permittedDataType == null)
1717            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1718          return this.permittedDataType;
1719        }
1720
1721        /**
1722         * @return Returns a reference to <code>this</code> for easy method chaining
1723         */
1724        public ObservationDefinitionComponentComponent setPermittedDataType(List<Enumeration<ObservationDataType>> thePermittedDataType) { 
1725          this.permittedDataType = thePermittedDataType;
1726          return this;
1727        }
1728
1729        public boolean hasPermittedDataType() { 
1730          if (this.permittedDataType == null)
1731            return false;
1732          for (Enumeration<ObservationDataType> item : this.permittedDataType)
1733            if (!item.isEmpty())
1734              return true;
1735          return false;
1736        }
1737
1738        /**
1739         * @return {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1740         */
1741        public Enumeration<ObservationDataType> addPermittedDataTypeElement() {//2 
1742          Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
1743          if (this.permittedDataType == null)
1744            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1745          this.permittedDataType.add(t);
1746          return t;
1747        }
1748
1749        /**
1750         * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1751         */
1752        public ObservationDefinitionComponentComponent addPermittedDataType(ObservationDataType value) { //1
1753          Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
1754          t.setValue(value);
1755          if (this.permittedDataType == null)
1756            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1757          this.permittedDataType.add(t);
1758          return this;
1759        }
1760
1761        /**
1762         * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1763         */
1764        public boolean hasPermittedDataType(ObservationDataType value) { 
1765          if (this.permittedDataType == null)
1766            return false;
1767          for (Enumeration<ObservationDataType> v : this.permittedDataType)
1768            if (v.getValue().equals(value)) // code
1769              return true;
1770          return false;
1771        }
1772
1773        /**
1774         * @return {@link #quantitativeDetails} (Characteristics for quantitative results of this observation.)
1775         */
1776        public ObservationDefinitionQuantitativeDetailsComponent getQuantitativeDetails() { 
1777          if (this.quantitativeDetails == null)
1778            if (Configuration.errorOnAutoCreate())
1779              throw new Error("Attempt to auto-create ObservationDefinitionComponentComponent.quantitativeDetails");
1780            else if (Configuration.doAutoCreate())
1781              this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); // cc
1782          return this.quantitativeDetails;
1783        }
1784
1785        public boolean hasQuantitativeDetails() { 
1786          return this.quantitativeDetails != null && !this.quantitativeDetails.isEmpty();
1787        }
1788
1789        /**
1790         * @param value {@link #quantitativeDetails} (Characteristics for quantitative results of this observation.)
1791         */
1792        public ObservationDefinitionComponentComponent setQuantitativeDetails(ObservationDefinitionQuantitativeDetailsComponent value) { 
1793          this.quantitativeDetails = value;
1794          return this;
1795        }
1796
1797        /**
1798         * @return {@link #qualifiedValue} (A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.)
1799         */
1800        public List<ObservationDefinitionQualifiedValueComponent> getQualifiedValue() { 
1801          if (this.qualifiedValue == null)
1802            this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
1803          return this.qualifiedValue;
1804        }
1805
1806        /**
1807         * @return Returns a reference to <code>this</code> for easy method chaining
1808         */
1809        public ObservationDefinitionComponentComponent setQualifiedValue(List<ObservationDefinitionQualifiedValueComponent> theQualifiedValue) { 
1810          this.qualifiedValue = theQualifiedValue;
1811          return this;
1812        }
1813
1814        public boolean hasQualifiedValue() { 
1815          if (this.qualifiedValue == null)
1816            return false;
1817          for (ObservationDefinitionQualifiedValueComponent item : this.qualifiedValue)
1818            if (!item.isEmpty())
1819              return true;
1820          return false;
1821        }
1822
1823        public ObservationDefinitionQualifiedValueComponent addQualifiedValue() { //3
1824          ObservationDefinitionQualifiedValueComponent t = new ObservationDefinitionQualifiedValueComponent();
1825          if (this.qualifiedValue == null)
1826            this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
1827          this.qualifiedValue.add(t);
1828          return t;
1829        }
1830
1831        public ObservationDefinitionComponentComponent addQualifiedValue(ObservationDefinitionQualifiedValueComponent t) { //3
1832          if (t == null)
1833            return this;
1834          if (this.qualifiedValue == null)
1835            this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
1836          this.qualifiedValue.add(t);
1837          return this;
1838        }
1839
1840        /**
1841         * @return The first repetition of repeating field {@link #qualifiedValue}, creating it if it does not already exist {3}
1842         */
1843        public ObservationDefinitionQualifiedValueComponent getQualifiedValueFirstRep() { 
1844          if (getQualifiedValue().isEmpty()) {
1845            addQualifiedValue();
1846          }
1847          return getQualifiedValue().get(0);
1848        }
1849
1850        protected void listChildren(List<Property> children) {
1851          super.listChildren(children);
1852          children.add(new Property("code", "CodeableConcept", "Describes what will be observed.", 0, 1, code));
1853          children.add(new Property("permittedDataType", "code", "The data types allowed for the value element of the instance of this component observations.", 0, java.lang.Integer.MAX_VALUE, permittedDataType));
1854          children.add(new Property("quantitativeDetails", "@ObservationDefinition.quantitativeDetails", "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails));
1855          children.add(new Property("qualifiedValue", "@ObservationDefinition.qualifiedValue", "A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.", 0, java.lang.Integer.MAX_VALUE, qualifiedValue));
1856        }
1857
1858        @Override
1859        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1860          switch (_hash) {
1861          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Describes what will be observed.", 0, 1, code);
1862          case -99492804: /*permittedDataType*/  return new Property("permittedDataType", "code", "The data types allowed for the value element of the instance of this component observations.", 0, java.lang.Integer.MAX_VALUE, permittedDataType);
1863          case 842150763: /*quantitativeDetails*/  return new Property("quantitativeDetails", "@ObservationDefinition.quantitativeDetails", "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails);
1864          case -558517707: /*qualifiedValue*/  return new Property("qualifiedValue", "@ObservationDefinition.qualifiedValue", "A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.", 0, java.lang.Integer.MAX_VALUE, qualifiedValue);
1865          default: return super.getNamedProperty(_hash, _name, _checkValid);
1866          }
1867
1868        }
1869
1870      @Override
1871      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1872        switch (hash) {
1873        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1874        case -99492804: /*permittedDataType*/ return this.permittedDataType == null ? new Base[0] : this.permittedDataType.toArray(new Base[this.permittedDataType.size()]); // Enumeration<ObservationDataType>
1875        case 842150763: /*quantitativeDetails*/ return this.quantitativeDetails == null ? new Base[0] : new Base[] {this.quantitativeDetails}; // ObservationDefinitionQuantitativeDetailsComponent
1876        case -558517707: /*qualifiedValue*/ return this.qualifiedValue == null ? new Base[0] : this.qualifiedValue.toArray(new Base[this.qualifiedValue.size()]); // ObservationDefinitionQualifiedValueComponent
1877        default: return super.getProperty(hash, name, checkValid);
1878        }
1879
1880      }
1881
1882      @Override
1883      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1884        switch (hash) {
1885        case 3059181: // code
1886          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1887          return value;
1888        case -99492804: // permittedDataType
1889          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1890          this.getPermittedDataType().add((Enumeration) value); // Enumeration<ObservationDataType>
1891          return value;
1892        case 842150763: // quantitativeDetails
1893          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
1894          return value;
1895        case -558517707: // qualifiedValue
1896          this.getQualifiedValue().add((ObservationDefinitionQualifiedValueComponent) value); // ObservationDefinitionQualifiedValueComponent
1897          return value;
1898        default: return super.setProperty(hash, name, value);
1899        }
1900
1901      }
1902
1903      @Override
1904      public Base setProperty(String name, Base value) throws FHIRException {
1905        if (name.equals("code")) {
1906          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1907        } else if (name.equals("permittedDataType")) {
1908          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1909          this.getPermittedDataType().add((Enumeration) value);
1910        } else if (name.equals("quantitativeDetails")) {
1911          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
1912        } else if (name.equals("qualifiedValue")) {
1913          this.getQualifiedValue().add((ObservationDefinitionQualifiedValueComponent) value);
1914        } else
1915          return super.setProperty(name, value);
1916        return value;
1917      }
1918
1919      @Override
1920      public Base makeProperty(int hash, String name) throws FHIRException {
1921        switch (hash) {
1922        case 3059181:  return getCode();
1923        case -99492804:  return addPermittedDataTypeElement();
1924        case 842150763:  return getQuantitativeDetails();
1925        case -558517707:  return addQualifiedValue(); 
1926        default: return super.makeProperty(hash, name);
1927        }
1928
1929      }
1930
1931      @Override
1932      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1933        switch (hash) {
1934        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1935        case -99492804: /*permittedDataType*/ return new String[] {"code"};
1936        case 842150763: /*quantitativeDetails*/ return new String[] {"@ObservationDefinition.quantitativeDetails"};
1937        case -558517707: /*qualifiedValue*/ return new String[] {"@ObservationDefinition.qualifiedValue"};
1938        default: return super.getTypesForProperty(hash, name);
1939        }
1940
1941      }
1942
1943      @Override
1944      public Base addChild(String name) throws FHIRException {
1945        if (name.equals("code")) {
1946          this.code = new CodeableConcept();
1947          return this.code;
1948        }
1949        else if (name.equals("permittedDataType")) {
1950          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.component.permittedDataType");
1951        }
1952        else if (name.equals("quantitativeDetails")) {
1953          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent();
1954          return this.quantitativeDetails;
1955        }
1956        else if (name.equals("qualifiedValue")) {
1957          return addQualifiedValue();
1958        }
1959        else
1960          return super.addChild(name);
1961      }
1962
1963      public ObservationDefinitionComponentComponent copy() {
1964        ObservationDefinitionComponentComponent dst = new ObservationDefinitionComponentComponent();
1965        copyValues(dst);
1966        return dst;
1967      }
1968
1969      public void copyValues(ObservationDefinitionComponentComponent dst) {
1970        super.copyValues(dst);
1971        dst.code = code == null ? null : code.copy();
1972        if (permittedDataType != null) {
1973          dst.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1974          for (Enumeration<ObservationDataType> i : permittedDataType)
1975            dst.permittedDataType.add(i.copy());
1976        };
1977        dst.quantitativeDetails = quantitativeDetails == null ? null : quantitativeDetails.copy();
1978        if (qualifiedValue != null) {
1979          dst.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
1980          for (ObservationDefinitionQualifiedValueComponent i : qualifiedValue)
1981            dst.qualifiedValue.add(i.copy());
1982        };
1983      }
1984
1985      @Override
1986      public boolean equalsDeep(Base other_) {
1987        if (!super.equalsDeep(other_))
1988          return false;
1989        if (!(other_ instanceof ObservationDefinitionComponentComponent))
1990          return false;
1991        ObservationDefinitionComponentComponent o = (ObservationDefinitionComponentComponent) other_;
1992        return compareDeep(code, o.code, true) && compareDeep(permittedDataType, o.permittedDataType, true)
1993           && compareDeep(quantitativeDetails, o.quantitativeDetails, true) && compareDeep(qualifiedValue, o.qualifiedValue, true)
1994          ;
1995      }
1996
1997      @Override
1998      public boolean equalsShallow(Base other_) {
1999        if (!super.equalsShallow(other_))
2000          return false;
2001        if (!(other_ instanceof ObservationDefinitionComponentComponent))
2002          return false;
2003        ObservationDefinitionComponentComponent o = (ObservationDefinitionComponentComponent) other_;
2004        return compareValues(permittedDataType, o.permittedDataType, true);
2005      }
2006
2007      public boolean isEmpty() {
2008        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, permittedDataType, quantitativeDetails
2009          , qualifiedValue);
2010      }
2011
2012  public String fhirType() {
2013    return "ObservationDefinition.component";
2014
2015  }
2016
2017  }
2018
2019    /**
2020     * An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
2021     */
2022    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
2023    @Description(shortDefinition="Logical canonical URL to reference this ObservationDefinition (globally unique)", formalDefinition="An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions." )
2024    protected UriType url;
2025
2026    /**
2027     * Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.
2028     */
2029    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
2030    @Description(shortDefinition="Business identifier of the ObservationDefinition", formalDefinition="Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server." )
2031    protected Identifier identifier;
2032
2033    /**
2034     * The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
2035     */
2036    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2037    @Description(shortDefinition="Business version of the ObservationDefinition", formalDefinition="The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable." )
2038    protected StringType version;
2039
2040    /**
2041     * A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
2042     */
2043    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2044    @Description(shortDefinition="Name for this ObservationDefinition (computer friendly)", formalDefinition="A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
2045    protected StringType name;
2046
2047    /**
2048     * A short, descriptive, user-friendly title for the ObservationDefinition.
2049     */
2050    @Child(name = "title", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2051    @Description(shortDefinition="Name for this ObservationDefinition (human friendly)", formalDefinition="A short, descriptive, user-friendly title for the ObservationDefinition." )
2052    protected StringType title;
2053
2054    /**
2055     * The current state of the ObservationDefinition.
2056     */
2057    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
2058    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The current state of the ObservationDefinition." )
2059    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
2060    protected Enumeration<PublicationStatus> status;
2061
2062    /**
2063     * A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
2064     */
2065    @Child(name = "experimental", type = {BooleanType.class}, order=6, min=0, max=1, modifier=true, summary=true)
2066    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
2067    protected BooleanType experimental;
2068
2069    /**
2070     * The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.
2071     */
2072    @Child(name = "date", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2073    @Description(shortDefinition="Date last changed", formalDefinition="The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes." )
2074    protected DateTimeType date;
2075
2076    /**
2077     * Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.
2078     */
2079    @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
2080    @Description(shortDefinition="The name of the individual or organization that published the ObservationDefinition", formalDefinition="Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact." )
2081    protected Reference publisher;
2082
2083    /**
2084     * Contact details to assist a user in finding and communicating with the publisher.
2085     */
2086    @Child(name = "contact", type = {ContactDetail.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2087    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
2088    protected List<ContactDetail> contact;
2089
2090    /**
2091     * A free text natural language description of the ObservationDefinition from the consumer's perspective.
2092     */
2093    @Child(name = "description", type = {MarkdownType.class}, order=10, min=0, max=1, modifier=false, summary=false)
2094    @Description(shortDefinition="Natural language description of the ObservationDefinition", formalDefinition="A free text natural language description of the ObservationDefinition from the consumer's perspective." )
2095    protected MarkdownType description;
2096
2097    /**
2098     * The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances.
2099     */
2100    @Child(name = "useContext", type = {UsageContext.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2101    @Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances." )
2102    protected List<UsageContext> useContext;
2103
2104    /**
2105     * A jurisdiction in which the ObservationDefinition is intended to be used.
2106     */
2107    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2108    @Description(shortDefinition="Intended jurisdiction for this ObservationDefinition (if applicable)", formalDefinition="A jurisdiction in which the ObservationDefinition is intended to be used." )
2109    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
2110    protected List<CodeableConcept> jurisdiction;
2111
2112    /**
2113     * Explains why this ObservationDefinition is needed and why it has been designed as it has.
2114     */
2115    @Child(name = "purpose", type = {MarkdownType.class}, order=13, min=0, max=1, modifier=false, summary=false)
2116    @Description(shortDefinition="Why this ObservationDefinition is defined", formalDefinition="Explains why this ObservationDefinition is needed and why it has been designed as it has." )
2117    protected MarkdownType purpose;
2118
2119    /**
2120     * Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
2121     */
2122    @Child(name = "copyright", type = {MarkdownType.class}, order=14, min=0, max=1, modifier=false, summary=false)
2123    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition." )
2124    protected MarkdownType copyright;
2125
2126    /**
2127     * The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
2128     */
2129    @Child(name = "approvalDate", type = {DateType.class}, order=15, min=0, max=1, modifier=false, summary=false)
2130    @Description(shortDefinition="When ObservationDefinition was approved by publisher", formalDefinition="The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
2131    protected DateType approvalDate;
2132
2133    /**
2134     * The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
2135     */
2136    @Child(name = "lastReviewDate", type = {DateType.class}, order=16, min=0, max=1, modifier=false, summary=false)
2137    @Description(shortDefinition="Date on which the asset content was last reviewed", formalDefinition="The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date." )
2138    protected DateType lastReviewDate;
2139
2140    /**
2141     * The period during which the ObservationDefinition content was or is planned to be effective.
2142     */
2143    @Child(name = "effectivePeriod", type = {Period.class}, order=17, min=0, max=1, modifier=false, summary=true)
2144    @Description(shortDefinition="The effective date range for the ObservationDefinition", formalDefinition="The period during which the ObservationDefinition content was or is planned to be effective." )
2145    protected Period effectivePeriod;
2146
2147    /**
2148     * The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.
2149     */
2150    @Child(name = "derivedFromCanonical", type = {CanonicalType.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2151    @Description(shortDefinition="Based on FHIR definition of another observation", formalDefinition="The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition." )
2152    protected List<CanonicalType> derivedFromCanonical;
2153
2154    /**
2155     * The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.
2156     */
2157    @Child(name = "derivedFromUri", type = {UriType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2158    @Description(shortDefinition="Based on external definition", formalDefinition="The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition." )
2159    protected List<UriType> derivedFromUri;
2160
2161    /**
2162     * A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition.
2163     */
2164    @Child(name = "subject", type = {CodeableConcept.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2165    @Description(shortDefinition="Type of subject for the defined observation", formalDefinition="A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition." )
2166    protected List<CodeableConcept> subject;
2167
2168    /**
2169     * The type of individual/organization/device that is expected to act upon instances of this definition.
2170     */
2171    @Child(name = "performerType", type = {CodeableConcept.class}, order=21, min=0, max=1, modifier=false, summary=true)
2172    @Description(shortDefinition="Desired kind of performer for such kind of observation", formalDefinition="The type of individual/organization/device that is expected to act upon instances of this definition." )
2173    protected CodeableConcept performerType;
2174
2175    /**
2176     * A code that classifies the general type of observation.
2177     */
2178    @Child(name = "category", type = {CodeableConcept.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2179    @Description(shortDefinition="General type of observation", formalDefinition="A code that classifies the general type of observation." )
2180    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-category")
2181    protected List<CodeableConcept> category;
2182
2183    /**
2184     * Describes what will be observed. Sometimes this is called the observation "name".
2185     */
2186    @Child(name = "code", type = {CodeableConcept.class}, order=23, min=1, max=1, modifier=false, summary=true)
2187    @Description(shortDefinition="Type of observation", formalDefinition="Describes what will be observed. Sometimes this is called the observation \"name\"." )
2188    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
2189    protected CodeableConcept code;
2190
2191    /**
2192     * The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.
2193     */
2194    @Child(name = "permittedDataType", type = {CodeType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2195    @Description(shortDefinition="Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period", formalDefinition="The data types allowed for the value element of the instance observations conforming to this ObservationDefinition." )
2196    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/permitted-data-type")
2197    protected List<Enumeration<ObservationDataType>> permittedDataType;
2198
2199    /**
2200     * Multiple results allowed for observations conforming to this ObservationDefinition.
2201     */
2202    @Child(name = "multipleResultsAllowed", type = {BooleanType.class}, order=25, min=0, max=1, modifier=false, summary=false)
2203    @Description(shortDefinition="Multiple results allowed for conforming observations", formalDefinition="Multiple results allowed for observations conforming to this ObservationDefinition." )
2204    protected BooleanType multipleResultsAllowed;
2205
2206    /**
2207     * The site on the subject's body where the  observation is to be made.
2208     */
2209    @Child(name = "bodySite", type = {CodeableConcept.class}, order=26, min=0, max=1, modifier=false, summary=false)
2210    @Description(shortDefinition="Body part to be observed", formalDefinition="The site on the subject's body where the  observation is to be made." )
2211    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
2212    protected CodeableConcept bodySite;
2213
2214    /**
2215     * The method or technique used to perform the observation.
2216     */
2217    @Child(name = "method", type = {CodeableConcept.class}, order=27, min=0, max=1, modifier=false, summary=false)
2218    @Description(shortDefinition="Method used to produce the observation", formalDefinition="The method or technique used to perform the observation." )
2219    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-methods")
2220    protected CodeableConcept method;
2221
2222    /**
2223     * The kind of specimen that this type of observation is produced on.
2224     */
2225    @Child(name = "specimen", type = {SpecimenDefinition.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2226    @Description(shortDefinition="Kind of specimen used by this type of observation", formalDefinition="The kind of specimen that this type of observation is produced on." )
2227    protected List<Reference> specimen;
2228
2229    /**
2230     * The measurement model of device or actual device used to produce observations of this type.
2231     */
2232    @Child(name = "device", type = {DeviceDefinition.class, Device.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2233    @Description(shortDefinition="Measurement device or model of device", formalDefinition="The measurement model of device or actual device used to produce observations of this type." )
2234    protected List<Reference> device;
2235
2236    /**
2237     * The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
2238     */
2239    @Child(name = "preferredReportName", type = {StringType.class}, order=30, min=0, max=1, modifier=false, summary=false)
2240    @Description(shortDefinition="The preferred name to be used when reporting the observation results", formalDefinition="The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition." )
2241    protected StringType preferredReportName;
2242
2243    /**
2244     * Characteristics for quantitative results of observations conforming to this ObservationDefinition.
2245     */
2246    @Child(name = "quantitativeDetails", type = {}, order=31, min=0, max=1, modifier=false, summary=false)
2247    @Description(shortDefinition="Characteristics of quantitative results", formalDefinition="Characteristics for quantitative results of observations conforming to this ObservationDefinition." )
2248    protected ObservationDefinitionQuantitativeDetailsComponent quantitativeDetails;
2249
2250    /**
2251     * A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.
2252     */
2253    @Child(name = "qualifiedValue", type = {}, order=32, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2254    @Description(shortDefinition="Set of qualified values for observation results", formalDefinition="A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations." )
2255    protected List<ObservationDefinitionQualifiedValueComponent> qualifiedValue;
2256
2257    /**
2258     * This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.
2259     */
2260    @Child(name = "hasMember", type = {ObservationDefinition.class, Questionnaire.class}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2261    @Description(shortDefinition="Definitions of related resources belonging to this kind of observation group", formalDefinition="This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group." )
2262    protected List<Reference> hasMember;
2263
2264    /**
2265     * Some observations have multiple component observations, expressed as separate code value pairs.
2266     */
2267    @Child(name = "component", type = {}, order=34, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2268    @Description(shortDefinition="Component results", formalDefinition="Some observations have multiple component observations, expressed as separate code value pairs." )
2269    protected List<ObservationDefinitionComponentComponent> component;
2270
2271    private static final long serialVersionUID = 1085308569L;
2272
2273  /**
2274   * Constructor
2275   */
2276    public ObservationDefinition() {
2277      super();
2278    }
2279
2280  /**
2281   * Constructor
2282   */
2283    public ObservationDefinition(PublicationStatus status, CodeableConcept code) {
2284      super();
2285      this.setStatus(status);
2286      this.setCode(code);
2287    }
2288
2289    /**
2290     * @return {@link #url} (An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2291     */
2292    public UriType getUrlElement() { 
2293      if (this.url == null)
2294        if (Configuration.errorOnAutoCreate())
2295          throw new Error("Attempt to auto-create ObservationDefinition.url");
2296        else if (Configuration.doAutoCreate())
2297          this.url = new UriType(); // bb
2298      return this.url;
2299    }
2300
2301    public boolean hasUrlElement() { 
2302      return this.url != null && !this.url.isEmpty();
2303    }
2304
2305    public boolean hasUrl() { 
2306      return this.url != null && !this.url.isEmpty();
2307    }
2308
2309    /**
2310     * @param value {@link #url} (An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2311     */
2312    public ObservationDefinition setUrlElement(UriType value) { 
2313      this.url = value;
2314      return this;
2315    }
2316
2317    /**
2318     * @return An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
2319     */
2320    public String getUrl() { 
2321      return this.url == null ? null : this.url.getValue();
2322    }
2323
2324    /**
2325     * @param value An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
2326     */
2327    public ObservationDefinition setUrl(String value) { 
2328      if (Utilities.noString(value))
2329        this.url = null;
2330      else {
2331        if (this.url == null)
2332          this.url = new UriType();
2333        this.url.setValue(value);
2334      }
2335      return this;
2336    }
2337
2338    /**
2339     * @return {@link #identifier} (Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.)
2340     */
2341    public Identifier getIdentifier() { 
2342      if (this.identifier == null)
2343        if (Configuration.errorOnAutoCreate())
2344          throw new Error("Attempt to auto-create ObservationDefinition.identifier");
2345        else if (Configuration.doAutoCreate())
2346          this.identifier = new Identifier(); // cc
2347      return this.identifier;
2348    }
2349
2350    public boolean hasIdentifier() { 
2351      return this.identifier != null && !this.identifier.isEmpty();
2352    }
2353
2354    /**
2355     * @param value {@link #identifier} (Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.)
2356     */
2357    public ObservationDefinition setIdentifier(Identifier value) { 
2358      this.identifier = value;
2359      return this;
2360    }
2361
2362    /**
2363     * @return {@link #version} (The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2364     */
2365    public StringType getVersionElement() { 
2366      if (this.version == null)
2367        if (Configuration.errorOnAutoCreate())
2368          throw new Error("Attempt to auto-create ObservationDefinition.version");
2369        else if (Configuration.doAutoCreate())
2370          this.version = new StringType(); // bb
2371      return this.version;
2372    }
2373
2374    public boolean hasVersionElement() { 
2375      return this.version != null && !this.version.isEmpty();
2376    }
2377
2378    public boolean hasVersion() { 
2379      return this.version != null && !this.version.isEmpty();
2380    }
2381
2382    /**
2383     * @param value {@link #version} (The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2384     */
2385    public ObservationDefinition setVersionElement(StringType value) { 
2386      this.version = value;
2387      return this;
2388    }
2389
2390    /**
2391     * @return The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
2392     */
2393    public String getVersion() { 
2394      return this.version == null ? null : this.version.getValue();
2395    }
2396
2397    /**
2398     * @param value The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
2399     */
2400    public ObservationDefinition setVersion(String value) { 
2401      if (Utilities.noString(value))
2402        this.version = null;
2403      else {
2404        if (this.version == null)
2405          this.version = new StringType();
2406        this.version.setValue(value);
2407      }
2408      return this;
2409    }
2410
2411    /**
2412     * @return {@link #name} (A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2413     */
2414    public StringType getNameElement() { 
2415      if (this.name == null)
2416        if (Configuration.errorOnAutoCreate())
2417          throw new Error("Attempt to auto-create ObservationDefinition.name");
2418        else if (Configuration.doAutoCreate())
2419          this.name = new StringType(); // bb
2420      return this.name;
2421    }
2422
2423    public boolean hasNameElement() { 
2424      return this.name != null && !this.name.isEmpty();
2425    }
2426
2427    public boolean hasName() { 
2428      return this.name != null && !this.name.isEmpty();
2429    }
2430
2431    /**
2432     * @param value {@link #name} (A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2433     */
2434    public ObservationDefinition setNameElement(StringType value) { 
2435      this.name = value;
2436      return this;
2437    }
2438
2439    /**
2440     * @return A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
2441     */
2442    public String getName() { 
2443      return this.name == null ? null : this.name.getValue();
2444    }
2445
2446    /**
2447     * @param value A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
2448     */
2449    public ObservationDefinition setName(String value) { 
2450      if (Utilities.noString(value))
2451        this.name = null;
2452      else {
2453        if (this.name == null)
2454          this.name = new StringType();
2455        this.name.setValue(value);
2456      }
2457      return this;
2458    }
2459
2460    /**
2461     * @return {@link #title} (A short, descriptive, user-friendly title for the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2462     */
2463    public StringType getTitleElement() { 
2464      if (this.title == null)
2465        if (Configuration.errorOnAutoCreate())
2466          throw new Error("Attempt to auto-create ObservationDefinition.title");
2467        else if (Configuration.doAutoCreate())
2468          this.title = new StringType(); // bb
2469      return this.title;
2470    }
2471
2472    public boolean hasTitleElement() { 
2473      return this.title != null && !this.title.isEmpty();
2474    }
2475
2476    public boolean hasTitle() { 
2477      return this.title != null && !this.title.isEmpty();
2478    }
2479
2480    /**
2481     * @param value {@link #title} (A short, descriptive, user-friendly title for the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2482     */
2483    public ObservationDefinition setTitleElement(StringType value) { 
2484      this.title = value;
2485      return this;
2486    }
2487
2488    /**
2489     * @return A short, descriptive, user-friendly title for the ObservationDefinition.
2490     */
2491    public String getTitle() { 
2492      return this.title == null ? null : this.title.getValue();
2493    }
2494
2495    /**
2496     * @param value A short, descriptive, user-friendly title for the ObservationDefinition.
2497     */
2498    public ObservationDefinition setTitle(String value) { 
2499      if (Utilities.noString(value))
2500        this.title = null;
2501      else {
2502        if (this.title == null)
2503          this.title = new StringType();
2504        this.title.setValue(value);
2505      }
2506      return this;
2507    }
2508
2509    /**
2510     * @return {@link #status} (The current state of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2511     */
2512    public Enumeration<PublicationStatus> getStatusElement() { 
2513      if (this.status == null)
2514        if (Configuration.errorOnAutoCreate())
2515          throw new Error("Attempt to auto-create ObservationDefinition.status");
2516        else if (Configuration.doAutoCreate())
2517          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2518      return this.status;
2519    }
2520
2521    public boolean hasStatusElement() { 
2522      return this.status != null && !this.status.isEmpty();
2523    }
2524
2525    public boolean hasStatus() { 
2526      return this.status != null && !this.status.isEmpty();
2527    }
2528
2529    /**
2530     * @param value {@link #status} (The current state of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2531     */
2532    public ObservationDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
2533      this.status = value;
2534      return this;
2535    }
2536
2537    /**
2538     * @return The current state of the ObservationDefinition.
2539     */
2540    public PublicationStatus getStatus() { 
2541      return this.status == null ? null : this.status.getValue();
2542    }
2543
2544    /**
2545     * @param value The current state of the ObservationDefinition.
2546     */
2547    public ObservationDefinition setStatus(PublicationStatus value) { 
2548        if (this.status == null)
2549          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2550        this.status.setValue(value);
2551      return this;
2552    }
2553
2554    /**
2555     * @return {@link #experimental} (A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2556     */
2557    public BooleanType getExperimentalElement() { 
2558      if (this.experimental == null)
2559        if (Configuration.errorOnAutoCreate())
2560          throw new Error("Attempt to auto-create ObservationDefinition.experimental");
2561        else if (Configuration.doAutoCreate())
2562          this.experimental = new BooleanType(); // bb
2563      return this.experimental;
2564    }
2565
2566    public boolean hasExperimentalElement() { 
2567      return this.experimental != null && !this.experimental.isEmpty();
2568    }
2569
2570    public boolean hasExperimental() { 
2571      return this.experimental != null && !this.experimental.isEmpty();
2572    }
2573
2574    /**
2575     * @param value {@link #experimental} (A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2576     */
2577    public ObservationDefinition setExperimentalElement(BooleanType value) { 
2578      this.experimental = value;
2579      return this;
2580    }
2581
2582    /**
2583     * @return A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
2584     */
2585    public boolean getExperimental() { 
2586      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2587    }
2588
2589    /**
2590     * @param value A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
2591     */
2592    public ObservationDefinition setExperimental(boolean value) { 
2593        if (this.experimental == null)
2594          this.experimental = new BooleanType();
2595        this.experimental.setValue(value);
2596      return this;
2597    }
2598
2599    /**
2600     * @return {@link #date} (The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2601     */
2602    public DateTimeType getDateElement() { 
2603      if (this.date == null)
2604        if (Configuration.errorOnAutoCreate())
2605          throw new Error("Attempt to auto-create ObservationDefinition.date");
2606        else if (Configuration.doAutoCreate())
2607          this.date = new DateTimeType(); // bb
2608      return this.date;
2609    }
2610
2611    public boolean hasDateElement() { 
2612      return this.date != null && !this.date.isEmpty();
2613    }
2614
2615    public boolean hasDate() { 
2616      return this.date != null && !this.date.isEmpty();
2617    }
2618
2619    /**
2620     * @param value {@link #date} (The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2621     */
2622    public ObservationDefinition setDateElement(DateTimeType value) { 
2623      this.date = value;
2624      return this;
2625    }
2626
2627    /**
2628     * @return The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.
2629     */
2630    public Date getDate() { 
2631      return this.date == null ? null : this.date.getValue();
2632    }
2633
2634    /**
2635     * @param value The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.
2636     */
2637    public ObservationDefinition setDate(Date value) { 
2638      if (value == null)
2639        this.date = null;
2640      else {
2641        if (this.date == null)
2642          this.date = new DateTimeType();
2643        this.date.setValue(value);
2644      }
2645      return this;
2646    }
2647
2648    /**
2649     * @return {@link #publisher} (Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.)
2650     */
2651    public Reference getPublisher() { 
2652      if (this.publisher == null)
2653        if (Configuration.errorOnAutoCreate())
2654          throw new Error("Attempt to auto-create ObservationDefinition.publisher");
2655        else if (Configuration.doAutoCreate())
2656          this.publisher = new Reference(); // cc
2657      return this.publisher;
2658    }
2659
2660    public boolean hasPublisher() { 
2661      return this.publisher != null && !this.publisher.isEmpty();
2662    }
2663
2664    /**
2665     * @param value {@link #publisher} (Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.)
2666     */
2667    public ObservationDefinition setPublisher(Reference value) { 
2668      this.publisher = value;
2669      return this;
2670    }
2671
2672    /**
2673     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
2674     */
2675    public List<ContactDetail> getContact() { 
2676      if (this.contact == null)
2677        this.contact = new ArrayList<ContactDetail>();
2678      return this.contact;
2679    }
2680
2681    /**
2682     * @return Returns a reference to <code>this</code> for easy method chaining
2683     */
2684    public ObservationDefinition setContact(List<ContactDetail> theContact) { 
2685      this.contact = theContact;
2686      return this;
2687    }
2688
2689    public boolean hasContact() { 
2690      if (this.contact == null)
2691        return false;
2692      for (ContactDetail item : this.contact)
2693        if (!item.isEmpty())
2694          return true;
2695      return false;
2696    }
2697
2698    public ContactDetail addContact() { //3
2699      ContactDetail t = new ContactDetail();
2700      if (this.contact == null)
2701        this.contact = new ArrayList<ContactDetail>();
2702      this.contact.add(t);
2703      return t;
2704    }
2705
2706    public ObservationDefinition addContact(ContactDetail t) { //3
2707      if (t == null)
2708        return this;
2709      if (this.contact == null)
2710        this.contact = new ArrayList<ContactDetail>();
2711      this.contact.add(t);
2712      return this;
2713    }
2714
2715    /**
2716     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
2717     */
2718    public ContactDetail getContactFirstRep() { 
2719      if (getContact().isEmpty()) {
2720        addContact();
2721      }
2722      return getContact().get(0);
2723    }
2724
2725    /**
2726     * @return {@link #description} (A free text natural language description of the ObservationDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2727     */
2728    public MarkdownType getDescriptionElement() { 
2729      if (this.description == null)
2730        if (Configuration.errorOnAutoCreate())
2731          throw new Error("Attempt to auto-create ObservationDefinition.description");
2732        else if (Configuration.doAutoCreate())
2733          this.description = new MarkdownType(); // bb
2734      return this.description;
2735    }
2736
2737    public boolean hasDescriptionElement() { 
2738      return this.description != null && !this.description.isEmpty();
2739    }
2740
2741    public boolean hasDescription() { 
2742      return this.description != null && !this.description.isEmpty();
2743    }
2744
2745    /**
2746     * @param value {@link #description} (A free text natural language description of the ObservationDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2747     */
2748    public ObservationDefinition setDescriptionElement(MarkdownType value) { 
2749      this.description = value;
2750      return this;
2751    }
2752
2753    /**
2754     * @return A free text natural language description of the ObservationDefinition from the consumer's perspective.
2755     */
2756    public String getDescription() { 
2757      return this.description == null ? null : this.description.getValue();
2758    }
2759
2760    /**
2761     * @param value A free text natural language description of the ObservationDefinition from the consumer's perspective.
2762     */
2763    public ObservationDefinition setDescription(String value) { 
2764      if (value == null)
2765        this.description = null;
2766      else {
2767        if (this.description == null)
2768          this.description = new MarkdownType();
2769        this.description.setValue(value);
2770      }
2771      return this;
2772    }
2773
2774    /**
2775     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances.)
2776     */
2777    public List<UsageContext> getUseContext() { 
2778      if (this.useContext == null)
2779        this.useContext = new ArrayList<UsageContext>();
2780      return this.useContext;
2781    }
2782
2783    /**
2784     * @return Returns a reference to <code>this</code> for easy method chaining
2785     */
2786    public ObservationDefinition setUseContext(List<UsageContext> theUseContext) { 
2787      this.useContext = theUseContext;
2788      return this;
2789    }
2790
2791    public boolean hasUseContext() { 
2792      if (this.useContext == null)
2793        return false;
2794      for (UsageContext item : this.useContext)
2795        if (!item.isEmpty())
2796          return true;
2797      return false;
2798    }
2799
2800    public UsageContext addUseContext() { //3
2801      UsageContext t = new UsageContext();
2802      if (this.useContext == null)
2803        this.useContext = new ArrayList<UsageContext>();
2804      this.useContext.add(t);
2805      return t;
2806    }
2807
2808    public ObservationDefinition addUseContext(UsageContext t) { //3
2809      if (t == null)
2810        return this;
2811      if (this.useContext == null)
2812        this.useContext = new ArrayList<UsageContext>();
2813      this.useContext.add(t);
2814      return this;
2815    }
2816
2817    /**
2818     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
2819     */
2820    public UsageContext getUseContextFirstRep() { 
2821      if (getUseContext().isEmpty()) {
2822        addUseContext();
2823      }
2824      return getUseContext().get(0);
2825    }
2826
2827    /**
2828     * @return {@link #jurisdiction} (A jurisdiction in which the ObservationDefinition is intended to be used.)
2829     */
2830    public List<CodeableConcept> getJurisdiction() { 
2831      if (this.jurisdiction == null)
2832        this.jurisdiction = new ArrayList<CodeableConcept>();
2833      return this.jurisdiction;
2834    }
2835
2836    /**
2837     * @return Returns a reference to <code>this</code> for easy method chaining
2838     */
2839    public ObservationDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
2840      this.jurisdiction = theJurisdiction;
2841      return this;
2842    }
2843
2844    public boolean hasJurisdiction() { 
2845      if (this.jurisdiction == null)
2846        return false;
2847      for (CodeableConcept item : this.jurisdiction)
2848        if (!item.isEmpty())
2849          return true;
2850      return false;
2851    }
2852
2853    public CodeableConcept addJurisdiction() { //3
2854      CodeableConcept t = new CodeableConcept();
2855      if (this.jurisdiction == null)
2856        this.jurisdiction = new ArrayList<CodeableConcept>();
2857      this.jurisdiction.add(t);
2858      return t;
2859    }
2860
2861    public ObservationDefinition addJurisdiction(CodeableConcept t) { //3
2862      if (t == null)
2863        return this;
2864      if (this.jurisdiction == null)
2865        this.jurisdiction = new ArrayList<CodeableConcept>();
2866      this.jurisdiction.add(t);
2867      return this;
2868    }
2869
2870    /**
2871     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist {3}
2872     */
2873    public CodeableConcept getJurisdictionFirstRep() { 
2874      if (getJurisdiction().isEmpty()) {
2875        addJurisdiction();
2876      }
2877      return getJurisdiction().get(0);
2878    }
2879
2880    /**
2881     * @return {@link #purpose} (Explains why this ObservationDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2882     */
2883    public MarkdownType getPurposeElement() { 
2884      if (this.purpose == null)
2885        if (Configuration.errorOnAutoCreate())
2886          throw new Error("Attempt to auto-create ObservationDefinition.purpose");
2887        else if (Configuration.doAutoCreate())
2888          this.purpose = new MarkdownType(); // bb
2889      return this.purpose;
2890    }
2891
2892    public boolean hasPurposeElement() { 
2893      return this.purpose != null && !this.purpose.isEmpty();
2894    }
2895
2896    public boolean hasPurpose() { 
2897      return this.purpose != null && !this.purpose.isEmpty();
2898    }
2899
2900    /**
2901     * @param value {@link #purpose} (Explains why this ObservationDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2902     */
2903    public ObservationDefinition setPurposeElement(MarkdownType value) { 
2904      this.purpose = value;
2905      return this;
2906    }
2907
2908    /**
2909     * @return Explains why this ObservationDefinition is needed and why it has been designed as it has.
2910     */
2911    public String getPurpose() { 
2912      return this.purpose == null ? null : this.purpose.getValue();
2913    }
2914
2915    /**
2916     * @param value Explains why this ObservationDefinition is needed and why it has been designed as it has.
2917     */
2918    public ObservationDefinition setPurpose(String value) { 
2919      if (value == null)
2920        this.purpose = null;
2921      else {
2922        if (this.purpose == null)
2923          this.purpose = new MarkdownType();
2924        this.purpose.setValue(value);
2925      }
2926      return this;
2927    }
2928
2929    /**
2930     * @return {@link #copyright} (Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
2931     */
2932    public MarkdownType getCopyrightElement() { 
2933      if (this.copyright == null)
2934        if (Configuration.errorOnAutoCreate())
2935          throw new Error("Attempt to auto-create ObservationDefinition.copyright");
2936        else if (Configuration.doAutoCreate())
2937          this.copyright = new MarkdownType(); // bb
2938      return this.copyright;
2939    }
2940
2941    public boolean hasCopyrightElement() { 
2942      return this.copyright != null && !this.copyright.isEmpty();
2943    }
2944
2945    public boolean hasCopyright() { 
2946      return this.copyright != null && !this.copyright.isEmpty();
2947    }
2948
2949    /**
2950     * @param value {@link #copyright} (Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
2951     */
2952    public ObservationDefinition setCopyrightElement(MarkdownType value) { 
2953      this.copyright = value;
2954      return this;
2955    }
2956
2957    /**
2958     * @return Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
2959     */
2960    public String getCopyright() { 
2961      return this.copyright == null ? null : this.copyright.getValue();
2962    }
2963
2964    /**
2965     * @param value Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
2966     */
2967    public ObservationDefinition setCopyright(String value) { 
2968      if (value == null)
2969        this.copyright = null;
2970      else {
2971        if (this.copyright == null)
2972          this.copyright = new MarkdownType();
2973        this.copyright.setValue(value);
2974      }
2975      return this;
2976    }
2977
2978    /**
2979     * @return {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
2980     */
2981    public DateType getApprovalDateElement() { 
2982      if (this.approvalDate == null)
2983        if (Configuration.errorOnAutoCreate())
2984          throw new Error("Attempt to auto-create ObservationDefinition.approvalDate");
2985        else if (Configuration.doAutoCreate())
2986          this.approvalDate = new DateType(); // bb
2987      return this.approvalDate;
2988    }
2989
2990    public boolean hasApprovalDateElement() { 
2991      return this.approvalDate != null && !this.approvalDate.isEmpty();
2992    }
2993
2994    public boolean hasApprovalDate() { 
2995      return this.approvalDate != null && !this.approvalDate.isEmpty();
2996    }
2997
2998    /**
2999     * @param value {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
3000     */
3001    public ObservationDefinition setApprovalDateElement(DateType value) { 
3002      this.approvalDate = value;
3003      return this;
3004    }
3005
3006    /**
3007     * @return The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3008     */
3009    public Date getApprovalDate() { 
3010      return this.approvalDate == null ? null : this.approvalDate.getValue();
3011    }
3012
3013    /**
3014     * @param value The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3015     */
3016    public ObservationDefinition setApprovalDate(Date value) { 
3017      if (value == null)
3018        this.approvalDate = null;
3019      else {
3020        if (this.approvalDate == null)
3021          this.approvalDate = new DateType();
3022        this.approvalDate.setValue(value);
3023      }
3024      return this;
3025    }
3026
3027    /**
3028     * @return {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3029     */
3030    public DateType getLastReviewDateElement() { 
3031      if (this.lastReviewDate == null)
3032        if (Configuration.errorOnAutoCreate())
3033          throw new Error("Attempt to auto-create ObservationDefinition.lastReviewDate");
3034        else if (Configuration.doAutoCreate())
3035          this.lastReviewDate = new DateType(); // bb
3036      return this.lastReviewDate;
3037    }
3038
3039    public boolean hasLastReviewDateElement() { 
3040      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3041    }
3042
3043    public boolean hasLastReviewDate() { 
3044      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3045    }
3046
3047    /**
3048     * @param value {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3049     */
3050    public ObservationDefinition setLastReviewDateElement(DateType value) { 
3051      this.lastReviewDate = value;
3052      return this;
3053    }
3054
3055    /**
3056     * @return The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
3057     */
3058    public Date getLastReviewDate() { 
3059      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
3060    }
3061
3062    /**
3063     * @param value The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
3064     */
3065    public ObservationDefinition setLastReviewDate(Date value) { 
3066      if (value == null)
3067        this.lastReviewDate = null;
3068      else {
3069        if (this.lastReviewDate == null)
3070          this.lastReviewDate = new DateType();
3071        this.lastReviewDate.setValue(value);
3072      }
3073      return this;
3074    }
3075
3076    /**
3077     * @return {@link #effectivePeriod} (The period during which the ObservationDefinition content was or is planned to be effective.)
3078     */
3079    public Period getEffectivePeriod() { 
3080      if (this.effectivePeriod == null)
3081        if (Configuration.errorOnAutoCreate())
3082          throw new Error("Attempt to auto-create ObservationDefinition.effectivePeriod");
3083        else if (Configuration.doAutoCreate())
3084          this.effectivePeriod = new Period(); // cc
3085      return this.effectivePeriod;
3086    }
3087
3088    public boolean hasEffectivePeriod() { 
3089      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
3090    }
3091
3092    /**
3093     * @param value {@link #effectivePeriod} (The period during which the ObservationDefinition content was or is planned to be effective.)
3094     */
3095    public ObservationDefinition setEffectivePeriod(Period value) { 
3096      this.effectivePeriod = value;
3097      return this;
3098    }
3099
3100    /**
3101     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
3102     */
3103    public List<CanonicalType> getDerivedFromCanonical() { 
3104      if (this.derivedFromCanonical == null)
3105        this.derivedFromCanonical = new ArrayList<CanonicalType>();
3106      return this.derivedFromCanonical;
3107    }
3108
3109    /**
3110     * @return Returns a reference to <code>this</code> for easy method chaining
3111     */
3112    public ObservationDefinition setDerivedFromCanonical(List<CanonicalType> theDerivedFromCanonical) { 
3113      this.derivedFromCanonical = theDerivedFromCanonical;
3114      return this;
3115    }
3116
3117    public boolean hasDerivedFromCanonical() { 
3118      if (this.derivedFromCanonical == null)
3119        return false;
3120      for (CanonicalType item : this.derivedFromCanonical)
3121        if (!item.isEmpty())
3122          return true;
3123      return false;
3124    }
3125
3126    /**
3127     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
3128     */
3129    public CanonicalType addDerivedFromCanonicalElement() {//2 
3130      CanonicalType t = new CanonicalType();
3131      if (this.derivedFromCanonical == null)
3132        this.derivedFromCanonical = new ArrayList<CanonicalType>();
3133      this.derivedFromCanonical.add(t);
3134      return t;
3135    }
3136
3137    /**
3138     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
3139     */
3140    public ObservationDefinition addDerivedFromCanonical(String value) { //1
3141      CanonicalType t = new CanonicalType();
3142      t.setValue(value);
3143      if (this.derivedFromCanonical == null)
3144        this.derivedFromCanonical = new ArrayList<CanonicalType>();
3145      this.derivedFromCanonical.add(t);
3146      return this;
3147    }
3148
3149    /**
3150     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
3151     */
3152    public boolean hasDerivedFromCanonical(String value) { 
3153      if (this.derivedFromCanonical == null)
3154        return false;
3155      for (CanonicalType v : this.derivedFromCanonical)
3156        if (v.getValue().equals(value)) // canonical
3157          return true;
3158      return false;
3159    }
3160
3161    /**
3162     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
3163     */
3164    public List<UriType> getDerivedFromUri() { 
3165      if (this.derivedFromUri == null)
3166        this.derivedFromUri = new ArrayList<UriType>();
3167      return this.derivedFromUri;
3168    }
3169
3170    /**
3171     * @return Returns a reference to <code>this</code> for easy method chaining
3172     */
3173    public ObservationDefinition setDerivedFromUri(List<UriType> theDerivedFromUri) { 
3174      this.derivedFromUri = theDerivedFromUri;
3175      return this;
3176    }
3177
3178    public boolean hasDerivedFromUri() { 
3179      if (this.derivedFromUri == null)
3180        return false;
3181      for (UriType item : this.derivedFromUri)
3182        if (!item.isEmpty())
3183          return true;
3184      return false;
3185    }
3186
3187    /**
3188     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
3189     */
3190    public UriType addDerivedFromUriElement() {//2 
3191      UriType t = new UriType();
3192      if (this.derivedFromUri == null)
3193        this.derivedFromUri = new ArrayList<UriType>();
3194      this.derivedFromUri.add(t);
3195      return t;
3196    }
3197
3198    /**
3199     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
3200     */
3201    public ObservationDefinition addDerivedFromUri(String value) { //1
3202      UriType t = new UriType();
3203      t.setValue(value);
3204      if (this.derivedFromUri == null)
3205        this.derivedFromUri = new ArrayList<UriType>();
3206      this.derivedFromUri.add(t);
3207      return this;
3208    }
3209
3210    /**
3211     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
3212     */
3213    public boolean hasDerivedFromUri(String value) { 
3214      if (this.derivedFromUri == null)
3215        return false;
3216      for (UriType v : this.derivedFromUri)
3217        if (v.getValue().equals(value)) // uri
3218          return true;
3219      return false;
3220    }
3221
3222    /**
3223     * @return {@link #subject} (A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition.)
3224     */
3225    public List<CodeableConcept> getSubject() { 
3226      if (this.subject == null)
3227        this.subject = new ArrayList<CodeableConcept>();
3228      return this.subject;
3229    }
3230
3231    /**
3232     * @return Returns a reference to <code>this</code> for easy method chaining
3233     */
3234    public ObservationDefinition setSubject(List<CodeableConcept> theSubject) { 
3235      this.subject = theSubject;
3236      return this;
3237    }
3238
3239    public boolean hasSubject() { 
3240      if (this.subject == null)
3241        return false;
3242      for (CodeableConcept item : this.subject)
3243        if (!item.isEmpty())
3244          return true;
3245      return false;
3246    }
3247
3248    public CodeableConcept addSubject() { //3
3249      CodeableConcept t = new CodeableConcept();
3250      if (this.subject == null)
3251        this.subject = new ArrayList<CodeableConcept>();
3252      this.subject.add(t);
3253      return t;
3254    }
3255
3256    public ObservationDefinition addSubject(CodeableConcept t) { //3
3257      if (t == null)
3258        return this;
3259      if (this.subject == null)
3260        this.subject = new ArrayList<CodeableConcept>();
3261      this.subject.add(t);
3262      return this;
3263    }
3264
3265    /**
3266     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
3267     */
3268    public CodeableConcept getSubjectFirstRep() { 
3269      if (getSubject().isEmpty()) {
3270        addSubject();
3271      }
3272      return getSubject().get(0);
3273    }
3274
3275    /**
3276     * @return {@link #performerType} (The type of individual/organization/device that is expected to act upon instances of this definition.)
3277     */
3278    public CodeableConcept getPerformerType() { 
3279      if (this.performerType == null)
3280        if (Configuration.errorOnAutoCreate())
3281          throw new Error("Attempt to auto-create ObservationDefinition.performerType");
3282        else if (Configuration.doAutoCreate())
3283          this.performerType = new CodeableConcept(); // cc
3284      return this.performerType;
3285    }
3286
3287    public boolean hasPerformerType() { 
3288      return this.performerType != null && !this.performerType.isEmpty();
3289    }
3290
3291    /**
3292     * @param value {@link #performerType} (The type of individual/organization/device that is expected to act upon instances of this definition.)
3293     */
3294    public ObservationDefinition setPerformerType(CodeableConcept value) { 
3295      this.performerType = value;
3296      return this;
3297    }
3298
3299    /**
3300     * @return {@link #category} (A code that classifies the general type of observation.)
3301     */
3302    public List<CodeableConcept> getCategory() { 
3303      if (this.category == null)
3304        this.category = new ArrayList<CodeableConcept>();
3305      return this.category;
3306    }
3307
3308    /**
3309     * @return Returns a reference to <code>this</code> for easy method chaining
3310     */
3311    public ObservationDefinition setCategory(List<CodeableConcept> theCategory) { 
3312      this.category = theCategory;
3313      return this;
3314    }
3315
3316    public boolean hasCategory() { 
3317      if (this.category == null)
3318        return false;
3319      for (CodeableConcept item : this.category)
3320        if (!item.isEmpty())
3321          return true;
3322      return false;
3323    }
3324
3325    public CodeableConcept addCategory() { //3
3326      CodeableConcept t = new CodeableConcept();
3327      if (this.category == null)
3328        this.category = new ArrayList<CodeableConcept>();
3329      this.category.add(t);
3330      return t;
3331    }
3332
3333    public ObservationDefinition addCategory(CodeableConcept t) { //3
3334      if (t == null)
3335        return this;
3336      if (this.category == null)
3337        this.category = new ArrayList<CodeableConcept>();
3338      this.category.add(t);
3339      return this;
3340    }
3341
3342    /**
3343     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
3344     */
3345    public CodeableConcept getCategoryFirstRep() { 
3346      if (getCategory().isEmpty()) {
3347        addCategory();
3348      }
3349      return getCategory().get(0);
3350    }
3351
3352    /**
3353     * @return {@link #code} (Describes what will be observed. Sometimes this is called the observation "name".)
3354     */
3355    public CodeableConcept getCode() { 
3356      if (this.code == null)
3357        if (Configuration.errorOnAutoCreate())
3358          throw new Error("Attempt to auto-create ObservationDefinition.code");
3359        else if (Configuration.doAutoCreate())
3360          this.code = new CodeableConcept(); // cc
3361      return this.code;
3362    }
3363
3364    public boolean hasCode() { 
3365      return this.code != null && !this.code.isEmpty();
3366    }
3367
3368    /**
3369     * @param value {@link #code} (Describes what will be observed. Sometimes this is called the observation "name".)
3370     */
3371    public ObservationDefinition setCode(CodeableConcept value) { 
3372      this.code = value;
3373      return this;
3374    }
3375
3376    /**
3377     * @return {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3378     */
3379    public List<Enumeration<ObservationDataType>> getPermittedDataType() { 
3380      if (this.permittedDataType == null)
3381        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3382      return this.permittedDataType;
3383    }
3384
3385    /**
3386     * @return Returns a reference to <code>this</code> for easy method chaining
3387     */
3388    public ObservationDefinition setPermittedDataType(List<Enumeration<ObservationDataType>> thePermittedDataType) { 
3389      this.permittedDataType = thePermittedDataType;
3390      return this;
3391    }
3392
3393    public boolean hasPermittedDataType() { 
3394      if (this.permittedDataType == null)
3395        return false;
3396      for (Enumeration<ObservationDataType> item : this.permittedDataType)
3397        if (!item.isEmpty())
3398          return true;
3399      return false;
3400    }
3401
3402    /**
3403     * @return {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3404     */
3405    public Enumeration<ObservationDataType> addPermittedDataTypeElement() {//2 
3406      Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
3407      if (this.permittedDataType == null)
3408        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3409      this.permittedDataType.add(t);
3410      return t;
3411    }
3412
3413    /**
3414     * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3415     */
3416    public ObservationDefinition addPermittedDataType(ObservationDataType value) { //1
3417      Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
3418      t.setValue(value);
3419      if (this.permittedDataType == null)
3420        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3421      this.permittedDataType.add(t);
3422      return this;
3423    }
3424
3425    /**
3426     * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3427     */
3428    public boolean hasPermittedDataType(ObservationDataType value) { 
3429      if (this.permittedDataType == null)
3430        return false;
3431      for (Enumeration<ObservationDataType> v : this.permittedDataType)
3432        if (v.getValue().equals(value)) // code
3433          return true;
3434      return false;
3435    }
3436
3437    /**
3438     * @return {@link #multipleResultsAllowed} (Multiple results allowed for observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getMultipleResultsAllowed" gives direct access to the value
3439     */
3440    public BooleanType getMultipleResultsAllowedElement() { 
3441      if (this.multipleResultsAllowed == null)
3442        if (Configuration.errorOnAutoCreate())
3443          throw new Error("Attempt to auto-create ObservationDefinition.multipleResultsAllowed");
3444        else if (Configuration.doAutoCreate())
3445          this.multipleResultsAllowed = new BooleanType(); // bb
3446      return this.multipleResultsAllowed;
3447    }
3448
3449    public boolean hasMultipleResultsAllowedElement() { 
3450      return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty();
3451    }
3452
3453    public boolean hasMultipleResultsAllowed() { 
3454      return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty();
3455    }
3456
3457    /**
3458     * @param value {@link #multipleResultsAllowed} (Multiple results allowed for observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getMultipleResultsAllowed" gives direct access to the value
3459     */
3460    public ObservationDefinition setMultipleResultsAllowedElement(BooleanType value) { 
3461      this.multipleResultsAllowed = value;
3462      return this;
3463    }
3464
3465    /**
3466     * @return Multiple results allowed for observations conforming to this ObservationDefinition.
3467     */
3468    public boolean getMultipleResultsAllowed() { 
3469      return this.multipleResultsAllowed == null || this.multipleResultsAllowed.isEmpty() ? false : this.multipleResultsAllowed.getValue();
3470    }
3471
3472    /**
3473     * @param value Multiple results allowed for observations conforming to this ObservationDefinition.
3474     */
3475    public ObservationDefinition setMultipleResultsAllowed(boolean value) { 
3476        if (this.multipleResultsAllowed == null)
3477          this.multipleResultsAllowed = new BooleanType();
3478        this.multipleResultsAllowed.setValue(value);
3479      return this;
3480    }
3481
3482    /**
3483     * @return {@link #bodySite} (The site on the subject's body where the  observation is to be made.)
3484     */
3485    public CodeableConcept getBodySite() { 
3486      if (this.bodySite == null)
3487        if (Configuration.errorOnAutoCreate())
3488          throw new Error("Attempt to auto-create ObservationDefinition.bodySite");
3489        else if (Configuration.doAutoCreate())
3490          this.bodySite = new CodeableConcept(); // cc
3491      return this.bodySite;
3492    }
3493
3494    public boolean hasBodySite() { 
3495      return this.bodySite != null && !this.bodySite.isEmpty();
3496    }
3497
3498    /**
3499     * @param value {@link #bodySite} (The site on the subject's body where the  observation is to be made.)
3500     */
3501    public ObservationDefinition setBodySite(CodeableConcept value) { 
3502      this.bodySite = value;
3503      return this;
3504    }
3505
3506    /**
3507     * @return {@link #method} (The method or technique used to perform the observation.)
3508     */
3509    public CodeableConcept getMethod() { 
3510      if (this.method == null)
3511        if (Configuration.errorOnAutoCreate())
3512          throw new Error("Attempt to auto-create ObservationDefinition.method");
3513        else if (Configuration.doAutoCreate())
3514          this.method = new CodeableConcept(); // cc
3515      return this.method;
3516    }
3517
3518    public boolean hasMethod() { 
3519      return this.method != null && !this.method.isEmpty();
3520    }
3521
3522    /**
3523     * @param value {@link #method} (The method or technique used to perform the observation.)
3524     */
3525    public ObservationDefinition setMethod(CodeableConcept value) { 
3526      this.method = value;
3527      return this;
3528    }
3529
3530    /**
3531     * @return {@link #specimen} (The kind of specimen that this type of observation is produced on.)
3532     */
3533    public List<Reference> getSpecimen() { 
3534      if (this.specimen == null)
3535        this.specimen = new ArrayList<Reference>();
3536      return this.specimen;
3537    }
3538
3539    /**
3540     * @return Returns a reference to <code>this</code> for easy method chaining
3541     */
3542    public ObservationDefinition setSpecimen(List<Reference> theSpecimen) { 
3543      this.specimen = theSpecimen;
3544      return this;
3545    }
3546
3547    public boolean hasSpecimen() { 
3548      if (this.specimen == null)
3549        return false;
3550      for (Reference item : this.specimen)
3551        if (!item.isEmpty())
3552          return true;
3553      return false;
3554    }
3555
3556    public Reference addSpecimen() { //3
3557      Reference t = new Reference();
3558      if (this.specimen == null)
3559        this.specimen = new ArrayList<Reference>();
3560      this.specimen.add(t);
3561      return t;
3562    }
3563
3564    public ObservationDefinition addSpecimen(Reference t) { //3
3565      if (t == null)
3566        return this;
3567      if (this.specimen == null)
3568        this.specimen = new ArrayList<Reference>();
3569      this.specimen.add(t);
3570      return this;
3571    }
3572
3573    /**
3574     * @return The first repetition of repeating field {@link #specimen}, creating it if it does not already exist {3}
3575     */
3576    public Reference getSpecimenFirstRep() { 
3577      if (getSpecimen().isEmpty()) {
3578        addSpecimen();
3579      }
3580      return getSpecimen().get(0);
3581    }
3582
3583    /**
3584     * @return {@link #device} (The measurement model of device or actual device used to produce observations of this type.)
3585     */
3586    public List<Reference> getDevice() { 
3587      if (this.device == null)
3588        this.device = new ArrayList<Reference>();
3589      return this.device;
3590    }
3591
3592    /**
3593     * @return Returns a reference to <code>this</code> for easy method chaining
3594     */
3595    public ObservationDefinition setDevice(List<Reference> theDevice) { 
3596      this.device = theDevice;
3597      return this;
3598    }
3599
3600    public boolean hasDevice() { 
3601      if (this.device == null)
3602        return false;
3603      for (Reference item : this.device)
3604        if (!item.isEmpty())
3605          return true;
3606      return false;
3607    }
3608
3609    public Reference addDevice() { //3
3610      Reference t = new Reference();
3611      if (this.device == null)
3612        this.device = new ArrayList<Reference>();
3613      this.device.add(t);
3614      return t;
3615    }
3616
3617    public ObservationDefinition addDevice(Reference t) { //3
3618      if (t == null)
3619        return this;
3620      if (this.device == null)
3621        this.device = new ArrayList<Reference>();
3622      this.device.add(t);
3623      return this;
3624    }
3625
3626    /**
3627     * @return The first repetition of repeating field {@link #device}, creating it if it does not already exist {3}
3628     */
3629    public Reference getDeviceFirstRep() { 
3630      if (getDevice().isEmpty()) {
3631        addDevice();
3632      }
3633      return getDevice().get(0);
3634    }
3635
3636    /**
3637     * @return {@link #preferredReportName} (The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getPreferredReportName" gives direct access to the value
3638     */
3639    public StringType getPreferredReportNameElement() { 
3640      if (this.preferredReportName == null)
3641        if (Configuration.errorOnAutoCreate())
3642          throw new Error("Attempt to auto-create ObservationDefinition.preferredReportName");
3643        else if (Configuration.doAutoCreate())
3644          this.preferredReportName = new StringType(); // bb
3645      return this.preferredReportName;
3646    }
3647
3648    public boolean hasPreferredReportNameElement() { 
3649      return this.preferredReportName != null && !this.preferredReportName.isEmpty();
3650    }
3651
3652    public boolean hasPreferredReportName() { 
3653      return this.preferredReportName != null && !this.preferredReportName.isEmpty();
3654    }
3655
3656    /**
3657     * @param value {@link #preferredReportName} (The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getPreferredReportName" gives direct access to the value
3658     */
3659    public ObservationDefinition setPreferredReportNameElement(StringType value) { 
3660      this.preferredReportName = value;
3661      return this;
3662    }
3663
3664    /**
3665     * @return The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
3666     */
3667    public String getPreferredReportName() { 
3668      return this.preferredReportName == null ? null : this.preferredReportName.getValue();
3669    }
3670
3671    /**
3672     * @param value The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
3673     */
3674    public ObservationDefinition setPreferredReportName(String value) { 
3675      if (Utilities.noString(value))
3676        this.preferredReportName = null;
3677      else {
3678        if (this.preferredReportName == null)
3679          this.preferredReportName = new StringType();
3680        this.preferredReportName.setValue(value);
3681      }
3682      return this;
3683    }
3684
3685    /**
3686     * @return {@link #quantitativeDetails} (Characteristics for quantitative results of observations conforming to this ObservationDefinition.)
3687     */
3688    public ObservationDefinitionQuantitativeDetailsComponent getQuantitativeDetails() { 
3689      if (this.quantitativeDetails == null)
3690        if (Configuration.errorOnAutoCreate())
3691          throw new Error("Attempt to auto-create ObservationDefinition.quantitativeDetails");
3692        else if (Configuration.doAutoCreate())
3693          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); // cc
3694      return this.quantitativeDetails;
3695    }
3696
3697    public boolean hasQuantitativeDetails() { 
3698      return this.quantitativeDetails != null && !this.quantitativeDetails.isEmpty();
3699    }
3700
3701    /**
3702     * @param value {@link #quantitativeDetails} (Characteristics for quantitative results of observations conforming to this ObservationDefinition.)
3703     */
3704    public ObservationDefinition setQuantitativeDetails(ObservationDefinitionQuantitativeDetailsComponent value) { 
3705      this.quantitativeDetails = value;
3706      return this;
3707    }
3708
3709    /**
3710     * @return {@link #qualifiedValue} (A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.)
3711     */
3712    public List<ObservationDefinitionQualifiedValueComponent> getQualifiedValue() { 
3713      if (this.qualifiedValue == null)
3714        this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
3715      return this.qualifiedValue;
3716    }
3717
3718    /**
3719     * @return Returns a reference to <code>this</code> for easy method chaining
3720     */
3721    public ObservationDefinition setQualifiedValue(List<ObservationDefinitionQualifiedValueComponent> theQualifiedValue) { 
3722      this.qualifiedValue = theQualifiedValue;
3723      return this;
3724    }
3725
3726    public boolean hasQualifiedValue() { 
3727      if (this.qualifiedValue == null)
3728        return false;
3729      for (ObservationDefinitionQualifiedValueComponent item : this.qualifiedValue)
3730        if (!item.isEmpty())
3731          return true;
3732      return false;
3733    }
3734
3735    public ObservationDefinitionQualifiedValueComponent addQualifiedValue() { //3
3736      ObservationDefinitionQualifiedValueComponent t = new ObservationDefinitionQualifiedValueComponent();
3737      if (this.qualifiedValue == null)
3738        this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
3739      this.qualifiedValue.add(t);
3740      return t;
3741    }
3742
3743    public ObservationDefinition addQualifiedValue(ObservationDefinitionQualifiedValueComponent t) { //3
3744      if (t == null)
3745        return this;
3746      if (this.qualifiedValue == null)
3747        this.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
3748      this.qualifiedValue.add(t);
3749      return this;
3750    }
3751
3752    /**
3753     * @return The first repetition of repeating field {@link #qualifiedValue}, creating it if it does not already exist {3}
3754     */
3755    public ObservationDefinitionQualifiedValueComponent getQualifiedValueFirstRep() { 
3756      if (getQualifiedValue().isEmpty()) {
3757        addQualifiedValue();
3758      }
3759      return getQualifiedValue().get(0);
3760    }
3761
3762    /**
3763     * @return {@link #hasMember} (This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.)
3764     */
3765    public List<Reference> getHasMember() { 
3766      if (this.hasMember == null)
3767        this.hasMember = new ArrayList<Reference>();
3768      return this.hasMember;
3769    }
3770
3771    /**
3772     * @return Returns a reference to <code>this</code> for easy method chaining
3773     */
3774    public ObservationDefinition setHasMember(List<Reference> theHasMember) { 
3775      this.hasMember = theHasMember;
3776      return this;
3777    }
3778
3779    public boolean hasHasMember() { 
3780      if (this.hasMember == null)
3781        return false;
3782      for (Reference item : this.hasMember)
3783        if (!item.isEmpty())
3784          return true;
3785      return false;
3786    }
3787
3788    public Reference addHasMember() { //3
3789      Reference t = new Reference();
3790      if (this.hasMember == null)
3791        this.hasMember = new ArrayList<Reference>();
3792      this.hasMember.add(t);
3793      return t;
3794    }
3795
3796    public ObservationDefinition addHasMember(Reference t) { //3
3797      if (t == null)
3798        return this;
3799      if (this.hasMember == null)
3800        this.hasMember = new ArrayList<Reference>();
3801      this.hasMember.add(t);
3802      return this;
3803    }
3804
3805    /**
3806     * @return The first repetition of repeating field {@link #hasMember}, creating it if it does not already exist {3}
3807     */
3808    public Reference getHasMemberFirstRep() { 
3809      if (getHasMember().isEmpty()) {
3810        addHasMember();
3811      }
3812      return getHasMember().get(0);
3813    }
3814
3815    /**
3816     * @return {@link #component} (Some observations have multiple component observations, expressed as separate code value pairs.)
3817     */
3818    public List<ObservationDefinitionComponentComponent> getComponent() { 
3819      if (this.component == null)
3820        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3821      return this.component;
3822    }
3823
3824    /**
3825     * @return Returns a reference to <code>this</code> for easy method chaining
3826     */
3827    public ObservationDefinition setComponent(List<ObservationDefinitionComponentComponent> theComponent) { 
3828      this.component = theComponent;
3829      return this;
3830    }
3831
3832    public boolean hasComponent() { 
3833      if (this.component == null)
3834        return false;
3835      for (ObservationDefinitionComponentComponent item : this.component)
3836        if (!item.isEmpty())
3837          return true;
3838      return false;
3839    }
3840
3841    public ObservationDefinitionComponentComponent addComponent() { //3
3842      ObservationDefinitionComponentComponent t = new ObservationDefinitionComponentComponent();
3843      if (this.component == null)
3844        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3845      this.component.add(t);
3846      return t;
3847    }
3848
3849    public ObservationDefinition addComponent(ObservationDefinitionComponentComponent t) { //3
3850      if (t == null)
3851        return this;
3852      if (this.component == null)
3853        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3854      this.component.add(t);
3855      return this;
3856    }
3857
3858    /**
3859     * @return The first repetition of repeating field {@link #component}, creating it if it does not already exist {3}
3860     */
3861    public ObservationDefinitionComponentComponent getComponentFirstRep() { 
3862      if (getComponent().isEmpty()) {
3863        addComponent();
3864      }
3865      return getComponent().get(0);
3866    }
3867
3868      protected void listChildren(List<Property> children) {
3869        super.listChildren(children);
3870        children.add(new Property("url", "uri", "An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.", 0, 1, url));
3871        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.", 0, 1, identifier));
3872        children.add(new Property("version", "string", "The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.", 0, 1, version));
3873        children.add(new Property("name", "string", "A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
3874        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the ObservationDefinition.", 0, 1, title));
3875        children.add(new Property("status", "code", "The current state of the ObservationDefinition.", 0, 1, status));
3876        children.add(new Property("experimental", "boolean", "A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, 1, experimental));
3877        children.add(new Property("date", "dateTime", "The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.", 0, 1, date));
3878        children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact.", 0, 1, publisher));
3879        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
3880        children.add(new Property("description", "markdown", "A free text natural language description of the ObservationDefinition from the consumer's perspective.", 0, 1, description));
3881        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
3882        children.add(new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the ObservationDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
3883        children.add(new Property("purpose", "markdown", "Explains why this ObservationDefinition is needed and why it has been designed as it has.", 0, 1, purpose));
3884        children.add(new Property("copyright", "markdown", "Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.", 0, 1, copyright));
3885        children.add(new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
3886        children.add(new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate));
3887        children.add(new Property("effectivePeriod", "Period", "The period during which the ObservationDefinition content was or is planned to be effective.", 0, 1, effectivePeriod));
3888        children.add(new Property("derivedFromCanonical", "canonical(ObservationDefinition)", "The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical));
3889        children.add(new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri));
3890        children.add(new Property("subject", "CodeableConcept", "A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, subject));
3891        children.add(new Property("performerType", "CodeableConcept", "The type of individual/organization/device that is expected to act upon instances of this definition.", 0, 1, performerType));
3892        children.add(new Property("category", "CodeableConcept", "A code that classifies the general type of observation.", 0, java.lang.Integer.MAX_VALUE, category));
3893        children.add(new Property("code", "CodeableConcept", "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code));
3894        children.add(new Property("permittedDataType", "code", "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, permittedDataType));
3895        children.add(new Property("multipleResultsAllowed", "boolean", "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, multipleResultsAllowed));
3896        children.add(new Property("bodySite", "CodeableConcept", "The site on the subject's body where the  observation is to be made.", 0, 1, bodySite));
3897        children.add(new Property("method", "CodeableConcept", "The method or technique used to perform the observation.", 0, 1, method));
3898        children.add(new Property("specimen", "Reference(SpecimenDefinition)", "The kind of specimen that this type of observation is produced on.", 0, java.lang.Integer.MAX_VALUE, specimen));
3899        children.add(new Property("device", "Reference(DeviceDefinition|Device)", "The measurement model of device or actual device used to produce observations of this type.", 0, java.lang.Integer.MAX_VALUE, device));
3900        children.add(new Property("preferredReportName", "string", "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 0, 1, preferredReportName));
3901        children.add(new Property("quantitativeDetails", "", "Characteristics for quantitative results of observations conforming to this ObservationDefinition.", 0, 1, quantitativeDetails));
3902        children.add(new Property("qualifiedValue", "", "A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.", 0, java.lang.Integer.MAX_VALUE, qualifiedValue));
3903        children.add(new Property("hasMember", "Reference(ObservationDefinition|Questionnaire)", "This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.", 0, java.lang.Integer.MAX_VALUE, hasMember));
3904        children.add(new Property("component", "", "Some observations have multiple component observations, expressed as separate code value pairs.", 0, java.lang.Integer.MAX_VALUE, component));
3905      }
3906
3907      @Override
3908      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3909        switch (_hash) {
3910        case 116079: /*url*/  return new Property("url", "uri", "An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.", 0, 1, url);
3911        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.", 0, 1, identifier);
3912        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.", 0, 1, version);
3913        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the ObservationDefinition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
3914        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the ObservationDefinition.", 0, 1, title);
3915        case -892481550: /*status*/  return new Property("status", "code", "The current state of the ObservationDefinition.", 0, 1, status);
3916        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, 1, experimental);
3917        case 3076014: /*date*/  return new Property("date", "dateTime", "The date (and optionally time) when the ObservationDefinition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the ObservationDefinition changes.", 0, 1, date);
3918        case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact.", 0, 1, publisher);
3919        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
3920        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the ObservationDefinition from the consumer's perspective.", 0, 1, description);
3921        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate ObservationDefinition instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
3922        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the ObservationDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
3923        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explains why this ObservationDefinition is needed and why it has been designed as it has.", 0, 1, purpose);
3924        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.", 0, 1, copyright);
3925        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
3926        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate);
3927        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the ObservationDefinition content was or is planned to be effective.", 0, 1, effectivePeriod);
3928        case -978133683: /*derivedFromCanonical*/  return new Property("derivedFromCanonical", "canonical(ObservationDefinition)", "The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical);
3929        case -1076333435: /*derivedFromUri*/  return new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri);
3930        case -1867885268: /*subject*/  return new Property("subject", "CodeableConcept", "A code that describes the intended kind of subject of Observation instances conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, subject);
3931        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "The type of individual/organization/device that is expected to act upon instances of this definition.", 0, 1, performerType);
3932        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code that classifies the general type of observation.", 0, java.lang.Integer.MAX_VALUE, category);
3933        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code);
3934        case -99492804: /*permittedDataType*/  return new Property("permittedDataType", "code", "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, permittedDataType);
3935        case -2102414590: /*multipleResultsAllowed*/  return new Property("multipleResultsAllowed", "boolean", "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, multipleResultsAllowed);
3936        case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "The site on the subject's body where the  observation is to be made.", 0, 1, bodySite);
3937        case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "The method or technique used to perform the observation.", 0, 1, method);
3938        case -2132868344: /*specimen*/  return new Property("specimen", "Reference(SpecimenDefinition)", "The kind of specimen that this type of observation is produced on.", 0, java.lang.Integer.MAX_VALUE, specimen);
3939        case -1335157162: /*device*/  return new Property("device", "Reference(DeviceDefinition|Device)", "The measurement model of device or actual device used to produce observations of this type.", 0, java.lang.Integer.MAX_VALUE, device);
3940        case -1851030208: /*preferredReportName*/  return new Property("preferredReportName", "string", "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 0, 1, preferredReportName);
3941        case 842150763: /*quantitativeDetails*/  return new Property("quantitativeDetails", "", "Characteristics for quantitative results of observations conforming to this ObservationDefinition.", 0, 1, quantitativeDetails);
3942        case -558517707: /*qualifiedValue*/  return new Property("qualifiedValue", "", "A set of qualified values associated with a context and a set of conditions -  provides a range for quantitative and ordinal observations and a collection of value sets for qualitative observations.", 0, java.lang.Integer.MAX_VALUE, qualifiedValue);
3943        case -458019372: /*hasMember*/  return new Property("hasMember", "Reference(ObservationDefinition|Questionnaire)", "This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.", 0, java.lang.Integer.MAX_VALUE, hasMember);
3944        case -1399907075: /*component*/  return new Property("component", "", "Some observations have multiple component observations, expressed as separate code value pairs.", 0, java.lang.Integer.MAX_VALUE, component);
3945        default: return super.getNamedProperty(_hash, _name, _checkValid);
3946        }
3947
3948      }
3949
3950      @Override
3951      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3952        switch (hash) {
3953        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3954        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3955        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3956        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
3957        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3958        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
3959        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
3960        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3961        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
3962        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
3963        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
3964        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
3965        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3966        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
3967        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
3968        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
3969        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
3970        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
3971        case -978133683: /*derivedFromCanonical*/ return this.derivedFromCanonical == null ? new Base[0] : this.derivedFromCanonical.toArray(new Base[this.derivedFromCanonical.size()]); // CanonicalType
3972        case -1076333435: /*derivedFromUri*/ return this.derivedFromUri == null ? new Base[0] : this.derivedFromUri.toArray(new Base[this.derivedFromUri.size()]); // UriType
3973        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // CodeableConcept
3974        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
3975        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3976        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3977        case -99492804: /*permittedDataType*/ return this.permittedDataType == null ? new Base[0] : this.permittedDataType.toArray(new Base[this.permittedDataType.size()]); // Enumeration<ObservationDataType>
3978        case -2102414590: /*multipleResultsAllowed*/ return this.multipleResultsAllowed == null ? new Base[0] : new Base[] {this.multipleResultsAllowed}; // BooleanType
3979        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
3980        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
3981        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : this.specimen.toArray(new Base[this.specimen.size()]); // Reference
3982        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
3983        case -1851030208: /*preferredReportName*/ return this.preferredReportName == null ? new Base[0] : new Base[] {this.preferredReportName}; // StringType
3984        case 842150763: /*quantitativeDetails*/ return this.quantitativeDetails == null ? new Base[0] : new Base[] {this.quantitativeDetails}; // ObservationDefinitionQuantitativeDetailsComponent
3985        case -558517707: /*qualifiedValue*/ return this.qualifiedValue == null ? new Base[0] : this.qualifiedValue.toArray(new Base[this.qualifiedValue.size()]); // ObservationDefinitionQualifiedValueComponent
3986        case -458019372: /*hasMember*/ return this.hasMember == null ? new Base[0] : this.hasMember.toArray(new Base[this.hasMember.size()]); // Reference
3987        case -1399907075: /*component*/ return this.component == null ? new Base[0] : this.component.toArray(new Base[this.component.size()]); // ObservationDefinitionComponentComponent
3988        default: return super.getProperty(hash, name, checkValid);
3989        }
3990
3991      }
3992
3993      @Override
3994      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3995        switch (hash) {
3996        case 116079: // url
3997          this.url = TypeConvertor.castToUri(value); // UriType
3998          return value;
3999        case -1618432855: // identifier
4000          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
4001          return value;
4002        case 351608024: // version
4003          this.version = TypeConvertor.castToString(value); // StringType
4004          return value;
4005        case 3373707: // name
4006          this.name = TypeConvertor.castToString(value); // StringType
4007          return value;
4008        case 110371416: // title
4009          this.title = TypeConvertor.castToString(value); // StringType
4010          return value;
4011        case -892481550: // status
4012          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
4013          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4014          return value;
4015        case -404562712: // experimental
4016          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
4017          return value;
4018        case 3076014: // date
4019          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
4020          return value;
4021        case 1447404028: // publisher
4022          this.publisher = TypeConvertor.castToReference(value); // Reference
4023          return value;
4024        case 951526432: // contact
4025          this.getContact().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
4026          return value;
4027        case -1724546052: // description
4028          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4029          return value;
4030        case -669707736: // useContext
4031          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
4032          return value;
4033        case -507075711: // jurisdiction
4034          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4035          return value;
4036        case -220463842: // purpose
4037          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
4038          return value;
4039        case 1522889671: // copyright
4040          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
4041          return value;
4042        case 223539345: // approvalDate
4043          this.approvalDate = TypeConvertor.castToDate(value); // DateType
4044          return value;
4045        case -1687512484: // lastReviewDate
4046          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
4047          return value;
4048        case -403934648: // effectivePeriod
4049          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
4050          return value;
4051        case -978133683: // derivedFromCanonical
4052          this.getDerivedFromCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
4053          return value;
4054        case -1076333435: // derivedFromUri
4055          this.getDerivedFromUri().add(TypeConvertor.castToUri(value)); // UriType
4056          return value;
4057        case -1867885268: // subject
4058          this.getSubject().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4059          return value;
4060        case -901444568: // performerType
4061          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4062          return value;
4063        case 50511102: // category
4064          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4065          return value;
4066        case 3059181: // code
4067          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4068          return value;
4069        case -99492804: // permittedDataType
4070          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
4071          this.getPermittedDataType().add((Enumeration) value); // Enumeration<ObservationDataType>
4072          return value;
4073        case -2102414590: // multipleResultsAllowed
4074          this.multipleResultsAllowed = TypeConvertor.castToBoolean(value); // BooleanType
4075          return value;
4076        case 1702620169: // bodySite
4077          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4078          return value;
4079        case -1077554975: // method
4080          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4081          return value;
4082        case -2132868344: // specimen
4083          this.getSpecimen().add(TypeConvertor.castToReference(value)); // Reference
4084          return value;
4085        case -1335157162: // device
4086          this.getDevice().add(TypeConvertor.castToReference(value)); // Reference
4087          return value;
4088        case -1851030208: // preferredReportName
4089          this.preferredReportName = TypeConvertor.castToString(value); // StringType
4090          return value;
4091        case 842150763: // quantitativeDetails
4092          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
4093          return value;
4094        case -558517707: // qualifiedValue
4095          this.getQualifiedValue().add((ObservationDefinitionQualifiedValueComponent) value); // ObservationDefinitionQualifiedValueComponent
4096          return value;
4097        case -458019372: // hasMember
4098          this.getHasMember().add(TypeConvertor.castToReference(value)); // Reference
4099          return value;
4100        case -1399907075: // component
4101          this.getComponent().add((ObservationDefinitionComponentComponent) value); // ObservationDefinitionComponentComponent
4102          return value;
4103        default: return super.setProperty(hash, name, value);
4104        }
4105
4106      }
4107
4108      @Override
4109      public Base setProperty(String name, Base value) throws FHIRException {
4110        if (name.equals("url")) {
4111          this.url = TypeConvertor.castToUri(value); // UriType
4112        } else if (name.equals("identifier")) {
4113          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
4114        } else if (name.equals("version")) {
4115          this.version = TypeConvertor.castToString(value); // StringType
4116        } else if (name.equals("name")) {
4117          this.name = TypeConvertor.castToString(value); // StringType
4118        } else if (name.equals("title")) {
4119          this.title = TypeConvertor.castToString(value); // StringType
4120        } else if (name.equals("status")) {
4121          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
4122          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4123        } else if (name.equals("experimental")) {
4124          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
4125        } else if (name.equals("date")) {
4126          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
4127        } else if (name.equals("publisher")) {
4128          this.publisher = TypeConvertor.castToReference(value); // Reference
4129        } else if (name.equals("contact")) {
4130          this.getContact().add(TypeConvertor.castToContactDetail(value));
4131        } else if (name.equals("description")) {
4132          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4133        } else if (name.equals("useContext")) {
4134          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
4135        } else if (name.equals("jurisdiction")) {
4136          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value));
4137        } else if (name.equals("purpose")) {
4138          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
4139        } else if (name.equals("copyright")) {
4140          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
4141        } else if (name.equals("approvalDate")) {
4142          this.approvalDate = TypeConvertor.castToDate(value); // DateType
4143        } else if (name.equals("lastReviewDate")) {
4144          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
4145        } else if (name.equals("effectivePeriod")) {
4146          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
4147        } else if (name.equals("derivedFromCanonical")) {
4148          this.getDerivedFromCanonical().add(TypeConvertor.castToCanonical(value));
4149        } else if (name.equals("derivedFromUri")) {
4150          this.getDerivedFromUri().add(TypeConvertor.castToUri(value));
4151        } else if (name.equals("subject")) {
4152          this.getSubject().add(TypeConvertor.castToCodeableConcept(value));
4153        } else if (name.equals("performerType")) {
4154          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4155        } else if (name.equals("category")) {
4156          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
4157        } else if (name.equals("code")) {
4158          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4159        } else if (name.equals("permittedDataType")) {
4160          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
4161          this.getPermittedDataType().add((Enumeration) value);
4162        } else if (name.equals("multipleResultsAllowed")) {
4163          this.multipleResultsAllowed = TypeConvertor.castToBoolean(value); // BooleanType
4164        } else if (name.equals("bodySite")) {
4165          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4166        } else if (name.equals("method")) {
4167          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4168        } else if (name.equals("specimen")) {
4169          this.getSpecimen().add(TypeConvertor.castToReference(value));
4170        } else if (name.equals("device")) {
4171          this.getDevice().add(TypeConvertor.castToReference(value));
4172        } else if (name.equals("preferredReportName")) {
4173          this.preferredReportName = TypeConvertor.castToString(value); // StringType
4174        } else if (name.equals("quantitativeDetails")) {
4175          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
4176        } else if (name.equals("qualifiedValue")) {
4177          this.getQualifiedValue().add((ObservationDefinitionQualifiedValueComponent) value);
4178        } else if (name.equals("hasMember")) {
4179          this.getHasMember().add(TypeConvertor.castToReference(value));
4180        } else if (name.equals("component")) {
4181          this.getComponent().add((ObservationDefinitionComponentComponent) value);
4182        } else
4183          return super.setProperty(name, value);
4184        return value;
4185      }
4186
4187      @Override
4188      public Base makeProperty(int hash, String name) throws FHIRException {
4189        switch (hash) {
4190        case 116079:  return getUrlElement();
4191        case -1618432855:  return getIdentifier();
4192        case 351608024:  return getVersionElement();
4193        case 3373707:  return getNameElement();
4194        case 110371416:  return getTitleElement();
4195        case -892481550:  return getStatusElement();
4196        case -404562712:  return getExperimentalElement();
4197        case 3076014:  return getDateElement();
4198        case 1447404028:  return getPublisher();
4199        case 951526432:  return addContact(); 
4200        case -1724546052:  return getDescriptionElement();
4201        case -669707736:  return addUseContext(); 
4202        case -507075711:  return addJurisdiction(); 
4203        case -220463842:  return getPurposeElement();
4204        case 1522889671:  return getCopyrightElement();
4205        case 223539345:  return getApprovalDateElement();
4206        case -1687512484:  return getLastReviewDateElement();
4207        case -403934648:  return getEffectivePeriod();
4208        case -978133683:  return addDerivedFromCanonicalElement();
4209        case -1076333435:  return addDerivedFromUriElement();
4210        case -1867885268:  return addSubject(); 
4211        case -901444568:  return getPerformerType();
4212        case 50511102:  return addCategory(); 
4213        case 3059181:  return getCode();
4214        case -99492804:  return addPermittedDataTypeElement();
4215        case -2102414590:  return getMultipleResultsAllowedElement();
4216        case 1702620169:  return getBodySite();
4217        case -1077554975:  return getMethod();
4218        case -2132868344:  return addSpecimen(); 
4219        case -1335157162:  return addDevice(); 
4220        case -1851030208:  return getPreferredReportNameElement();
4221        case 842150763:  return getQuantitativeDetails();
4222        case -558517707:  return addQualifiedValue(); 
4223        case -458019372:  return addHasMember(); 
4224        case -1399907075:  return addComponent(); 
4225        default: return super.makeProperty(hash, name);
4226        }
4227
4228      }
4229
4230      @Override
4231      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4232        switch (hash) {
4233        case 116079: /*url*/ return new String[] {"uri"};
4234        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4235        case 351608024: /*version*/ return new String[] {"string"};
4236        case 3373707: /*name*/ return new String[] {"string"};
4237        case 110371416: /*title*/ return new String[] {"string"};
4238        case -892481550: /*status*/ return new String[] {"code"};
4239        case -404562712: /*experimental*/ return new String[] {"boolean"};
4240        case 3076014: /*date*/ return new String[] {"dateTime"};
4241        case 1447404028: /*publisher*/ return new String[] {"Reference"};
4242        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4243        case -1724546052: /*description*/ return new String[] {"markdown"};
4244        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4245        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4246        case -220463842: /*purpose*/ return new String[] {"markdown"};
4247        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4248        case 223539345: /*approvalDate*/ return new String[] {"date"};
4249        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
4250        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
4251        case -978133683: /*derivedFromCanonical*/ return new String[] {"canonical"};
4252        case -1076333435: /*derivedFromUri*/ return new String[] {"uri"};
4253        case -1867885268: /*subject*/ return new String[] {"CodeableConcept"};
4254        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
4255        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4256        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
4257        case -99492804: /*permittedDataType*/ return new String[] {"code"};
4258        case -2102414590: /*multipleResultsAllowed*/ return new String[] {"boolean"};
4259        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4260        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
4261        case -2132868344: /*specimen*/ return new String[] {"Reference"};
4262        case -1335157162: /*device*/ return new String[] {"Reference"};
4263        case -1851030208: /*preferredReportName*/ return new String[] {"string"};
4264        case 842150763: /*quantitativeDetails*/ return new String[] {};
4265        case -558517707: /*qualifiedValue*/ return new String[] {};
4266        case -458019372: /*hasMember*/ return new String[] {"Reference"};
4267        case -1399907075: /*component*/ return new String[] {};
4268        default: return super.getTypesForProperty(hash, name);
4269        }
4270
4271      }
4272
4273      @Override
4274      public Base addChild(String name) throws FHIRException {
4275        if (name.equals("url")) {
4276          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.url");
4277        }
4278        else if (name.equals("identifier")) {
4279          this.identifier = new Identifier();
4280          return this.identifier;
4281        }
4282        else if (name.equals("version")) {
4283          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.version");
4284        }
4285        else if (name.equals("name")) {
4286          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.name");
4287        }
4288        else if (name.equals("title")) {
4289          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.title");
4290        }
4291        else if (name.equals("status")) {
4292          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.status");
4293        }
4294        else if (name.equals("experimental")) {
4295          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.experimental");
4296        }
4297        else if (name.equals("date")) {
4298          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.date");
4299        }
4300        else if (name.equals("publisher")) {
4301          this.publisher = new Reference();
4302          return this.publisher;
4303        }
4304        else if (name.equals("contact")) {
4305          return addContact();
4306        }
4307        else if (name.equals("description")) {
4308          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.description");
4309        }
4310        else if (name.equals("useContext")) {
4311          return addUseContext();
4312        }
4313        else if (name.equals("jurisdiction")) {
4314          return addJurisdiction();
4315        }
4316        else if (name.equals("purpose")) {
4317          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.purpose");
4318        }
4319        else if (name.equals("copyright")) {
4320          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.copyright");
4321        }
4322        else if (name.equals("approvalDate")) {
4323          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.approvalDate");
4324        }
4325        else if (name.equals("lastReviewDate")) {
4326          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.lastReviewDate");
4327        }
4328        else if (name.equals("effectivePeriod")) {
4329          this.effectivePeriod = new Period();
4330          return this.effectivePeriod;
4331        }
4332        else if (name.equals("derivedFromCanonical")) {
4333          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.derivedFromCanonical");
4334        }
4335        else if (name.equals("derivedFromUri")) {
4336          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.derivedFromUri");
4337        }
4338        else if (name.equals("subject")) {
4339          return addSubject();
4340        }
4341        else if (name.equals("performerType")) {
4342          this.performerType = new CodeableConcept();
4343          return this.performerType;
4344        }
4345        else if (name.equals("category")) {
4346          return addCategory();
4347        }
4348        else if (name.equals("code")) {
4349          this.code = new CodeableConcept();
4350          return this.code;
4351        }
4352        else if (name.equals("permittedDataType")) {
4353          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.permittedDataType");
4354        }
4355        else if (name.equals("multipleResultsAllowed")) {
4356          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.multipleResultsAllowed");
4357        }
4358        else if (name.equals("bodySite")) {
4359          this.bodySite = new CodeableConcept();
4360          return this.bodySite;
4361        }
4362        else if (name.equals("method")) {
4363          this.method = new CodeableConcept();
4364          return this.method;
4365        }
4366        else if (name.equals("specimen")) {
4367          return addSpecimen();
4368        }
4369        else if (name.equals("device")) {
4370          return addDevice();
4371        }
4372        else if (name.equals("preferredReportName")) {
4373          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.preferredReportName");
4374        }
4375        else if (name.equals("quantitativeDetails")) {
4376          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent();
4377          return this.quantitativeDetails;
4378        }
4379        else if (name.equals("qualifiedValue")) {
4380          return addQualifiedValue();
4381        }
4382        else if (name.equals("hasMember")) {
4383          return addHasMember();
4384        }
4385        else if (name.equals("component")) {
4386          return addComponent();
4387        }
4388        else
4389          return super.addChild(name);
4390      }
4391
4392  public String fhirType() {
4393    return "ObservationDefinition";
4394
4395  }
4396
4397      public ObservationDefinition copy() {
4398        ObservationDefinition dst = new ObservationDefinition();
4399        copyValues(dst);
4400        return dst;
4401      }
4402
4403      public void copyValues(ObservationDefinition dst) {
4404        super.copyValues(dst);
4405        dst.url = url == null ? null : url.copy();
4406        dst.identifier = identifier == null ? null : identifier.copy();
4407        dst.version = version == null ? null : version.copy();
4408        dst.name = name == null ? null : name.copy();
4409        dst.title = title == null ? null : title.copy();
4410        dst.status = status == null ? null : status.copy();
4411        dst.experimental = experimental == null ? null : experimental.copy();
4412        dst.date = date == null ? null : date.copy();
4413        dst.publisher = publisher == null ? null : publisher.copy();
4414        if (contact != null) {
4415          dst.contact = new ArrayList<ContactDetail>();
4416          for (ContactDetail i : contact)
4417            dst.contact.add(i.copy());
4418        };
4419        dst.description = description == null ? null : description.copy();
4420        if (useContext != null) {
4421          dst.useContext = new ArrayList<UsageContext>();
4422          for (UsageContext i : useContext)
4423            dst.useContext.add(i.copy());
4424        };
4425        if (jurisdiction != null) {
4426          dst.jurisdiction = new ArrayList<CodeableConcept>();
4427          for (CodeableConcept i : jurisdiction)
4428            dst.jurisdiction.add(i.copy());
4429        };
4430        dst.purpose = purpose == null ? null : purpose.copy();
4431        dst.copyright = copyright == null ? null : copyright.copy();
4432        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
4433        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
4434        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
4435        if (derivedFromCanonical != null) {
4436          dst.derivedFromCanonical = new ArrayList<CanonicalType>();
4437          for (CanonicalType i : derivedFromCanonical)
4438            dst.derivedFromCanonical.add(i.copy());
4439        };
4440        if (derivedFromUri != null) {
4441          dst.derivedFromUri = new ArrayList<UriType>();
4442          for (UriType i : derivedFromUri)
4443            dst.derivedFromUri.add(i.copy());
4444        };
4445        if (subject != null) {
4446          dst.subject = new ArrayList<CodeableConcept>();
4447          for (CodeableConcept i : subject)
4448            dst.subject.add(i.copy());
4449        };
4450        dst.performerType = performerType == null ? null : performerType.copy();
4451        if (category != null) {
4452          dst.category = new ArrayList<CodeableConcept>();
4453          for (CodeableConcept i : category)
4454            dst.category.add(i.copy());
4455        };
4456        dst.code = code == null ? null : code.copy();
4457        if (permittedDataType != null) {
4458          dst.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
4459          for (Enumeration<ObservationDataType> i : permittedDataType)
4460            dst.permittedDataType.add(i.copy());
4461        };
4462        dst.multipleResultsAllowed = multipleResultsAllowed == null ? null : multipleResultsAllowed.copy();
4463        dst.bodySite = bodySite == null ? null : bodySite.copy();
4464        dst.method = method == null ? null : method.copy();
4465        if (specimen != null) {
4466          dst.specimen = new ArrayList<Reference>();
4467          for (Reference i : specimen)
4468            dst.specimen.add(i.copy());
4469        };
4470        if (device != null) {
4471          dst.device = new ArrayList<Reference>();
4472          for (Reference i : device)
4473            dst.device.add(i.copy());
4474        };
4475        dst.preferredReportName = preferredReportName == null ? null : preferredReportName.copy();
4476        dst.quantitativeDetails = quantitativeDetails == null ? null : quantitativeDetails.copy();
4477        if (qualifiedValue != null) {
4478          dst.qualifiedValue = new ArrayList<ObservationDefinitionQualifiedValueComponent>();
4479          for (ObservationDefinitionQualifiedValueComponent i : qualifiedValue)
4480            dst.qualifiedValue.add(i.copy());
4481        };
4482        if (hasMember != null) {
4483          dst.hasMember = new ArrayList<Reference>();
4484          for (Reference i : hasMember)
4485            dst.hasMember.add(i.copy());
4486        };
4487        if (component != null) {
4488          dst.component = new ArrayList<ObservationDefinitionComponentComponent>();
4489          for (ObservationDefinitionComponentComponent i : component)
4490            dst.component.add(i.copy());
4491        };
4492      }
4493
4494      protected ObservationDefinition typedCopy() {
4495        return copy();
4496      }
4497
4498      @Override
4499      public boolean equalsDeep(Base other_) {
4500        if (!super.equalsDeep(other_))
4501          return false;
4502        if (!(other_ instanceof ObservationDefinition))
4503          return false;
4504        ObservationDefinition o = (ObservationDefinition) other_;
4505        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
4506           && compareDeep(name, o.name, true) && compareDeep(title, o.title, true) && compareDeep(status, o.status, true)
4507           && compareDeep(experimental, o.experimental, true) && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true)
4508           && compareDeep(contact, o.contact, true) && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
4509           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4510           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4511           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(derivedFromCanonical, o.derivedFromCanonical, true)
4512           && compareDeep(derivedFromUri, o.derivedFromUri, true) && compareDeep(subject, o.subject, true)
4513           && compareDeep(performerType, o.performerType, true) && compareDeep(category, o.category, true)
4514           && compareDeep(code, o.code, true) && compareDeep(permittedDataType, o.permittedDataType, true)
4515           && compareDeep(multipleResultsAllowed, o.multipleResultsAllowed, true) && compareDeep(bodySite, o.bodySite, true)
4516           && compareDeep(method, o.method, true) && compareDeep(specimen, o.specimen, true) && compareDeep(device, o.device, true)
4517           && compareDeep(preferredReportName, o.preferredReportName, true) && compareDeep(quantitativeDetails, o.quantitativeDetails, true)
4518           && compareDeep(qualifiedValue, o.qualifiedValue, true) && compareDeep(hasMember, o.hasMember, true)
4519           && compareDeep(component, o.component, true);
4520      }
4521
4522      @Override
4523      public boolean equalsShallow(Base other_) {
4524        if (!super.equalsShallow(other_))
4525          return false;
4526        if (!(other_ instanceof ObservationDefinition))
4527          return false;
4528        ObservationDefinition o = (ObservationDefinition) other_;
4529        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
4530           && compareValues(title, o.title, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
4531           && compareValues(date, o.date, true) && compareValues(description, o.description, true) && compareValues(purpose, o.purpose, true)
4532           && compareValues(copyright, o.copyright, true) && compareValues(approvalDate, o.approvalDate, true)
4533           && compareValues(lastReviewDate, o.lastReviewDate, true) && compareValues(derivedFromCanonical, o.derivedFromCanonical, true)
4534           && compareValues(derivedFromUri, o.derivedFromUri, true) && compareValues(permittedDataType, o.permittedDataType, true)
4535           && compareValues(multipleResultsAllowed, o.multipleResultsAllowed, true) && compareValues(preferredReportName, o.preferredReportName, true)
4536          ;
4537      }
4538
4539      public boolean isEmpty() {
4540        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, identifier, version
4541          , name, title, status, experimental, date, publisher, contact, description, useContext
4542          , jurisdiction, purpose, copyright, approvalDate, lastReviewDate, effectivePeriod
4543          , derivedFromCanonical, derivedFromUri, subject, performerType, category, code, permittedDataType
4544          , multipleResultsAllowed, bodySite, method, specimen, device, preferredReportName
4545          , quantitativeDetails, qualifiedValue, hasMember, component);
4546      }
4547
4548  @Override
4549  public ResourceType getResourceType() {
4550    return ResourceType.ObservationDefinition;
4551   }
4552
4553 /**
4554   * Search parameter: <b>category</b>
4555   * <p>
4556   * Description: <b>Category (class) of observation</b><br>
4557   * Type: <b>token</b><br>
4558   * Path: <b>ObservationDefinition.category</b><br>
4559   * </p>
4560   */
4561  @SearchParamDefinition(name="category", path="ObservationDefinition.category", description="Category (class) of observation", type="token" )
4562  public static final String SP_CATEGORY = "category";
4563 /**
4564   * <b>Fluent Client</b> search parameter constant for <b>category</b>
4565   * <p>
4566   * Description: <b>Category (class) of observation</b><br>
4567   * Type: <b>token</b><br>
4568   * Path: <b>ObservationDefinition.category</b><br>
4569   * </p>
4570   */
4571  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
4572
4573 /**
4574   * Search parameter: <b>code</b>
4575   * <p>
4576   * Description: <b>Observation code</b><br>
4577   * Type: <b>token</b><br>
4578   * Path: <b>ObservationDefinition.code</b><br>
4579   * </p>
4580   */
4581  @SearchParamDefinition(name="code", path="ObservationDefinition.code", description="Observation code", type="token" )
4582  public static final String SP_CODE = "code";
4583 /**
4584   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4585   * <p>
4586   * Description: <b>Observation code</b><br>
4587   * Type: <b>token</b><br>
4588   * Path: <b>ObservationDefinition.code</b><br>
4589   * </p>
4590   */
4591  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4592
4593 /**
4594   * Search parameter: <b>experimental</b>
4595   * <p>
4596   * Description: <b>Not for genuine usage (true)</b><br>
4597   * Type: <b>token</b><br>
4598   * Path: <b>ObservationDefinition.experimental</b><br>
4599   * </p>
4600   */
4601  @SearchParamDefinition(name="experimental", path="ObservationDefinition.experimental", description="Not for genuine usage (true)", type="token" )
4602  public static final String SP_EXPERIMENTAL = "experimental";
4603 /**
4604   * <b>Fluent Client</b> search parameter constant for <b>experimental</b>
4605   * <p>
4606   * Description: <b>Not for genuine usage (true)</b><br>
4607   * Type: <b>token</b><br>
4608   * Path: <b>ObservationDefinition.experimental</b><br>
4609   * </p>
4610   */
4611  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXPERIMENTAL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EXPERIMENTAL);
4612
4613 /**
4614   * Search parameter: <b>identifier</b>
4615   * <p>
4616   * Description: <b>The unique identifier associated with the specimen definition</b><br>
4617   * Type: <b>token</b><br>
4618   * Path: <b>ObservationDefinition.identifier</b><br>
4619   * </p>
4620   */
4621  @SearchParamDefinition(name="identifier", path="ObservationDefinition.identifier", description="The unique identifier associated with the specimen definition", type="token" )
4622  public static final String SP_IDENTIFIER = "identifier";
4623 /**
4624   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4625   * <p>
4626   * Description: <b>The unique identifier associated with the specimen definition</b><br>
4627   * Type: <b>token</b><br>
4628   * Path: <b>ObservationDefinition.identifier</b><br>
4629   * </p>
4630   */
4631  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4632
4633 /**
4634   * Search parameter: <b>method</b>
4635   * <p>
4636   * Description: <b>Method of observation</b><br>
4637   * Type: <b>token</b><br>
4638   * Path: <b>ObservationDefinition.method</b><br>
4639   * </p>
4640   */
4641  @SearchParamDefinition(name="method", path="ObservationDefinition.method", description="Method of observation", type="token" )
4642  public static final String SP_METHOD = "method";
4643 /**
4644   * <b>Fluent Client</b> search parameter constant for <b>method</b>
4645   * <p>
4646   * Description: <b>Method of observation</b><br>
4647   * Type: <b>token</b><br>
4648   * Path: <b>ObservationDefinition.method</b><br>
4649   * </p>
4650   */
4651  public static final ca.uhn.fhir.rest.gclient.TokenClientParam METHOD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_METHOD);
4652
4653 /**
4654   * Search parameter: <b>status</b>
4655   * <p>
4656   * Description: <b>Publication status of the ObservationDefinition: draft, active, retired, unknown</b><br>
4657   * Type: <b>token</b><br>
4658   * Path: <b>ObservationDefinition.status</b><br>
4659   * </p>
4660   */
4661  @SearchParamDefinition(name="status", path="ObservationDefinition.status", description="Publication status of the ObservationDefinition: draft, active, retired, unknown", type="token" )
4662  public static final String SP_STATUS = "status";
4663 /**
4664   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4665   * <p>
4666   * Description: <b>Publication status of the ObservationDefinition: draft, active, retired, unknown</b><br>
4667   * Type: <b>token</b><br>
4668   * Path: <b>ObservationDefinition.status</b><br>
4669   * </p>
4670   */
4671  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4672
4673 /**
4674   * Search parameter: <b>title</b>
4675   * <p>
4676   * Description: <b>Human-friendly name of the ObservationDefinition</b><br>
4677   * Type: <b>string</b><br>
4678   * Path: <b>ObservationDefinition.title</b><br>
4679   * </p>
4680   */
4681  @SearchParamDefinition(name="title", path="ObservationDefinition.title", description="Human-friendly name of the ObservationDefinition", type="string" )
4682  public static final String SP_TITLE = "title";
4683 /**
4684   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4685   * <p>
4686   * Description: <b>Human-friendly name of the ObservationDefinition</b><br>
4687   * Type: <b>string</b><br>
4688   * Path: <b>ObservationDefinition.title</b><br>
4689   * </p>
4690   */
4691  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
4692
4693 /**
4694   * Search parameter: <b>url</b>
4695   * <p>
4696   * Description: <b>The uri that identifies the observation definition</b><br>
4697   * Type: <b>uri</b><br>
4698   * Path: <b>ObservationDefinition.url</b><br>
4699   * </p>
4700   */
4701  @SearchParamDefinition(name="url", path="ObservationDefinition.url", description="The uri that identifies the observation definition", type="uri" )
4702  public static final String SP_URL = "url";
4703 /**
4704   * <b>Fluent Client</b> search parameter constant for <b>url</b>
4705   * <p>
4706   * Description: <b>The uri that identifies the observation definition</b><br>
4707   * Type: <b>uri</b><br>
4708   * Path: <b>ObservationDefinition.url</b><br>
4709   * </p>
4710   */
4711  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
4712
4713
4714}
4715