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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048import org.hl7.fhir.instance.model.api.ICompositeType;
049import  org.hl7.fhir.r5.model.Enumerations.BindingStrength;
050import  org.hl7.fhir.r5.model.Enumerations.BindingStrengthEnumFactory;
051import  org.hl7.fhir.r5.utils.ToolingExtensions;
052import  org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
053import  org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
054/**
055 * ElementDefinition Type: Captures constraints on each element within the resource, profile, or extension.
056 */
057@DatatypeDef(name="ElementDefinition")
058public class ElementDefinition extends BackboneType implements ICompositeType {
059
060    public enum AdditionalBindingPurposeVS {
061        /**
062         * A required binding, for use when the binding strength is 'extensible' or 'preferred'
063         */
064        MAXIMUM, 
065        /**
066         * The minimum allowable value set - any conformant system SHALL support all these codes
067         */
068        MINIMUM, 
069        /**
070         * This value set is used as a required binding (in addition to the base binding (not a replacement), usually in a particular usage context)
071         */
072        REQUIRED, 
073        /**
074         * This value set is used as an extensible binding (in addition to the base binding (not a replacement), usually in a particular usage context)
075         */
076        EXTENSIBLE, 
077        /**
078         * This value set is a candidate to substitute for the overall conformance value set in some situations; usually these are defined in the documentation
079         */
080        CANDIDATE, 
081        /**
082         * New records are required to use this value set, but legacy records may use other codes. The definition of 'new record' is difficult, since systems often create new records based on pre-existing data. Usually 'current' bindings are mandated by an external authority that makes clear rules around this
083         */
084        CURRENT, 
085        /**
086         * This is the value set that is preferred in a given context (documentation should explain why)
087         */
088        PREFERRED, 
089        /**
090         * This value set is provided for user look up in a given context. Typically, these valuesets only include a subset of codes relevant for input in a context
091         */
092        UI, 
093        /**
094         * This value set is a good set of codes to start with when designing your system
095         */
096        STARTER, 
097        /**
098         * This value set is a component of the base value set. Usually this is called out so that documentation can be written about a portion of the value set
099         */
100        COMPONENT, 
101        /**
102         * added to help the parsers with the generic types
103         */
104        NULL;
105        public static AdditionalBindingPurposeVS fromCode(String codeString) throws FHIRException {
106            if (codeString == null || "".equals(codeString))
107                return null;
108        if ("maximum".equals(codeString))
109          return MAXIMUM;
110        if ("minimum".equals(codeString))
111          return MINIMUM;
112        if ("required".equals(codeString))
113          return REQUIRED;
114        if ("extensible".equals(codeString))
115          return EXTENSIBLE;
116        if ("candidate".equals(codeString))
117          return CANDIDATE;
118        if ("current".equals(codeString))
119          return CURRENT;
120        if ("preferred".equals(codeString))
121          return PREFERRED;
122        if ("ui".equals(codeString))
123          return UI;
124        if ("starter".equals(codeString))
125          return STARTER;
126        if ("component".equals(codeString))
127          return COMPONENT;
128        if (Configuration.isAcceptInvalidEnums())
129          return null;
130        else
131          throw new FHIRException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
132        }
133        public String toCode() {
134          switch (this) {
135            case MAXIMUM: return "maximum";
136            case MINIMUM: return "minimum";
137            case REQUIRED: return "required";
138            case EXTENSIBLE: return "extensible";
139            case CANDIDATE: return "candidate";
140            case CURRENT: return "current";
141            case PREFERRED: return "preferred";
142            case UI: return "ui";
143            case STARTER: return "starter";
144            case COMPONENT: return "component";
145            case NULL: return null;
146            default: return "?";
147          }
148        }
149        public String getSystem() {
150          switch (this) {
151            case MAXIMUM: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
152            case MINIMUM: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
153            case REQUIRED: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
154            case EXTENSIBLE: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
155            case CANDIDATE: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
156            case CURRENT: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
157            case PREFERRED: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
158            case UI: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
159            case STARTER: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
160            case COMPONENT: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
161            case NULL: return null;
162            default: return "?";
163          }
164        }
165        public String getDefinition() {
166          switch (this) {
167            case MAXIMUM: return "A required binding, for use when the binding strength is 'extensible' or 'preferred'";
168            case MINIMUM: return "The minimum allowable value set - any conformant system SHALL support all these codes";
169            case REQUIRED: return "This value set is used as a required binding (in addition to the base binding (not a replacement), usually in a particular usage context)";
170            case EXTENSIBLE: return "This value set is used as an extensible binding (in addition to the base binding (not a replacement), usually in a particular usage context)";
171            case CANDIDATE: return "This value set is a candidate to substitute for the overall conformance value set in some situations; usually these are defined in the documentation";
172            case CURRENT: return "New records are required to use this value set, but legacy records may use other codes. The definition of 'new record' is difficult, since systems often create new records based on pre-existing data. Usually 'current' bindings are mandated by an external authority that makes clear rules around this";
173            case PREFERRED: return "This is the value set that is preferred in a given context (documentation should explain why)";
174            case UI: return "This value set is provided for user look up in a given context. Typically, these valuesets only include a subset of codes relevant for input in a context";
175            case STARTER: return "This value set is a good set of codes to start with when designing your system";
176            case COMPONENT: return "This value set is a component of the base value set. Usually this is called out so that documentation can be written about a portion of the value set";
177            case NULL: return null;
178            default: return "?";
179          }
180        }
181        public String getDisplay() {
182          switch (this) {
183            case MAXIMUM: return "Maximum Binding";
184            case MINIMUM: return "Minimum Binding";
185            case REQUIRED: return "Required Binding";
186            case EXTENSIBLE: return "Conformance Binding";
187            case CANDIDATE: return "Candidate Binding";
188            case CURRENT: return "Current Binding";
189            case PREFERRED: return "Preferred Binding";
190            case UI: return "UI Suggested Binding";
191            case STARTER: return "Starter Binding";
192            case COMPONENT: return "Component Binding";
193            case NULL: return null;
194            default: return "?";
195          }
196        }
197    }
198
199  public static class AdditionalBindingPurposeVSEnumFactory implements EnumFactory<AdditionalBindingPurposeVS> {
200    public AdditionalBindingPurposeVS fromCode(String codeString) throws IllegalArgumentException {
201      if (codeString == null || "".equals(codeString))
202            if (codeString == null || "".equals(codeString))
203                return null;
204        if ("maximum".equals(codeString))
205          return AdditionalBindingPurposeVS.MAXIMUM;
206        if ("minimum".equals(codeString))
207          return AdditionalBindingPurposeVS.MINIMUM;
208        if ("required".equals(codeString))
209          return AdditionalBindingPurposeVS.REQUIRED;
210        if ("extensible".equals(codeString))
211          return AdditionalBindingPurposeVS.EXTENSIBLE;
212        if ("candidate".equals(codeString))
213          return AdditionalBindingPurposeVS.CANDIDATE;
214        if ("current".equals(codeString))
215          return AdditionalBindingPurposeVS.CURRENT;
216        if ("preferred".equals(codeString))
217          return AdditionalBindingPurposeVS.PREFERRED;
218        if ("ui".equals(codeString))
219          return AdditionalBindingPurposeVS.UI;
220        if ("starter".equals(codeString))
221          return AdditionalBindingPurposeVS.STARTER;
222        if ("component".equals(codeString))
223          return AdditionalBindingPurposeVS.COMPONENT;
224        throw new IllegalArgumentException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
225        }
226        public Enumeration<AdditionalBindingPurposeVS> fromType(PrimitiveType<?> code) throws FHIRException {
227          if (code == null)
228            return null;
229          if (code.isEmpty())
230            return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.NULL, code);
231          String codeString = ((PrimitiveType) code).asStringValue();
232          if (codeString == null || "".equals(codeString))
233            return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.NULL, code);
234        if ("maximum".equals(codeString))
235          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.MAXIMUM, code);
236        if ("minimum".equals(codeString))
237          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.MINIMUM, code);
238        if ("required".equals(codeString))
239          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.REQUIRED, code);
240        if ("extensible".equals(codeString))
241          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.EXTENSIBLE, code);
242        if ("candidate".equals(codeString))
243          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.CANDIDATE, code);
244        if ("current".equals(codeString))
245          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.CURRENT, code);
246        if ("preferred".equals(codeString))
247          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.PREFERRED, code);
248        if ("ui".equals(codeString))
249          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.UI, code);
250        if ("starter".equals(codeString))
251          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.STARTER, code);
252        if ("component".equals(codeString))
253          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.COMPONENT, code);
254        throw new FHIRException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
255        }
256    public String toCode(AdditionalBindingPurposeVS code) {
257       if (code == AdditionalBindingPurposeVS.NULL)
258           return null;
259       if (code == AdditionalBindingPurposeVS.MAXIMUM)
260        return "maximum";
261      if (code == AdditionalBindingPurposeVS.MINIMUM)
262        return "minimum";
263      if (code == AdditionalBindingPurposeVS.REQUIRED)
264        return "required";
265      if (code == AdditionalBindingPurposeVS.EXTENSIBLE)
266        return "extensible";
267      if (code == AdditionalBindingPurposeVS.CANDIDATE)
268        return "candidate";
269      if (code == AdditionalBindingPurposeVS.CURRENT)
270        return "current";
271      if (code == AdditionalBindingPurposeVS.PREFERRED)
272        return "preferred";
273      if (code == AdditionalBindingPurposeVS.UI)
274        return "ui";
275      if (code == AdditionalBindingPurposeVS.STARTER)
276        return "starter";
277      if (code == AdditionalBindingPurposeVS.COMPONENT)
278        return "component";
279      return "?";
280   }
281    public String toSystem(AdditionalBindingPurposeVS code) {
282      return code.getSystem();
283      }
284    }
285
286    public enum AggregationMode {
287        /**
288         * The reference is a local reference to a contained resource.
289         */
290        CONTAINED, 
291        /**
292         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
293         */
294        REFERENCED, 
295        /**
296         * When the resource is in a Bundle, the resource the reference points to will be found in the same bundle as the resource that includes the reference.
297         */
298        BUNDLED, 
299        /**
300         * added to help the parsers with the generic types
301         */
302        NULL;
303        public static AggregationMode fromCode(String codeString) throws FHIRException {
304            if (codeString == null || "".equals(codeString))
305                return null;
306        if ("contained".equals(codeString))
307          return CONTAINED;
308        if ("referenced".equals(codeString))
309          return REFERENCED;
310        if ("bundled".equals(codeString))
311          return BUNDLED;
312        if (Configuration.isAcceptInvalidEnums())
313          return null;
314        else
315          throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
316        }
317        public String toCode() {
318          switch (this) {
319            case CONTAINED: return "contained";
320            case REFERENCED: return "referenced";
321            case BUNDLED: return "bundled";
322            case NULL: return null;
323            default: return "?";
324          }
325        }
326        public String getSystem() {
327          switch (this) {
328            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
329            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
330            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
331            case NULL: return null;
332            default: return "?";
333          }
334        }
335        public String getDefinition() {
336          switch (this) {
337            case CONTAINED: return "The reference is a local reference to a contained resource.";
338            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
339            case BUNDLED: return "When the resource is in a Bundle, the resource the reference points to will be found in the same bundle as the resource that includes the reference.";
340            case NULL: return null;
341            default: return "?";
342          }
343        }
344        public String getDisplay() {
345          switch (this) {
346            case CONTAINED: return "Contained";
347            case REFERENCED: return "Referenced";
348            case BUNDLED: return "Bundled";
349            case NULL: return null;
350            default: return "?";
351          }
352        }
353    }
354
355  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
356    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
357      if (codeString == null || "".equals(codeString))
358            if (codeString == null || "".equals(codeString))
359                return null;
360        if ("contained".equals(codeString))
361          return AggregationMode.CONTAINED;
362        if ("referenced".equals(codeString))
363          return AggregationMode.REFERENCED;
364        if ("bundled".equals(codeString))
365          return AggregationMode.BUNDLED;
366        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
367        }
368        public Enumeration<AggregationMode> fromType(PrimitiveType<?> code) throws FHIRException {
369          if (code == null)
370            return null;
371          if (code.isEmpty())
372            return new Enumeration<AggregationMode>(this, AggregationMode.NULL, code);
373          String codeString = ((PrimitiveType) code).asStringValue();
374          if (codeString == null || "".equals(codeString))
375            return new Enumeration<AggregationMode>(this, AggregationMode.NULL, code);
376        if ("contained".equals(codeString))
377          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED, code);
378        if ("referenced".equals(codeString))
379          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED, code);
380        if ("bundled".equals(codeString))
381          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED, code);
382        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
383        }
384    public String toCode(AggregationMode code) {
385       if (code == AggregationMode.NULL)
386           return null;
387       if (code == AggregationMode.CONTAINED)
388        return "contained";
389      if (code == AggregationMode.REFERENCED)
390        return "referenced";
391      if (code == AggregationMode.BUNDLED)
392        return "bundled";
393      return "?";
394   }
395    public String toSystem(AggregationMode code) {
396      return code.getSystem();
397      }
398    }
399
400    public enum ConstraintSeverity {
401        /**
402         * If the constraint is violated, the resource is not conformant.
403         */
404        ERROR, 
405        /**
406         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
407         */
408        WARNING, 
409        /**
410         * added to help the parsers with the generic types
411         */
412        NULL;
413        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
414            if (codeString == null || "".equals(codeString))
415                return null;
416        if ("error".equals(codeString))
417          return ERROR;
418        if ("warning".equals(codeString))
419          return WARNING;
420        if (Configuration.isAcceptInvalidEnums())
421          return null;
422        else
423          throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
424        }
425        public String toCode() {
426          switch (this) {
427            case ERROR: return "error";
428            case WARNING: return "warning";
429            case NULL: return null;
430            default: return "?";
431          }
432        }
433        public String getSystem() {
434          switch (this) {
435            case ERROR: return "http://hl7.org/fhir/constraint-severity";
436            case WARNING: return "http://hl7.org/fhir/constraint-severity";
437            case NULL: return null;
438            default: return "?";
439          }
440        }
441        public String getDefinition() {
442          switch (this) {
443            case ERROR: return "If the constraint is violated, the resource is not conformant.";
444            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
445            case NULL: return null;
446            default: return "?";
447          }
448        }
449        public String getDisplay() {
450          switch (this) {
451            case ERROR: return "Error";
452            case WARNING: return "Warning";
453            case NULL: return null;
454            default: return "?";
455          }
456        }
457    }
458
459  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
460    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
461      if (codeString == null || "".equals(codeString))
462            if (codeString == null || "".equals(codeString))
463                return null;
464        if ("error".equals(codeString))
465          return ConstraintSeverity.ERROR;
466        if ("warning".equals(codeString))
467          return ConstraintSeverity.WARNING;
468        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
469        }
470        public Enumeration<ConstraintSeverity> fromType(PrimitiveType<?> code) throws FHIRException {
471          if (code == null)
472            return null;
473          if (code.isEmpty())
474            return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.NULL, code);
475          String codeString = ((PrimitiveType) code).asStringValue();
476          if (codeString == null || "".equals(codeString))
477            return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.NULL, code);
478        if ("error".equals(codeString))
479          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR, code);
480        if ("warning".equals(codeString))
481          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING, code);
482        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
483        }
484    public String toCode(ConstraintSeverity code) {
485       if (code == ConstraintSeverity.NULL)
486           return null;
487       if (code == ConstraintSeverity.ERROR)
488        return "error";
489      if (code == ConstraintSeverity.WARNING)
490        return "warning";
491      return "?";
492   }
493    public String toSystem(ConstraintSeverity code) {
494      return code.getSystem();
495      }
496    }
497
498    public enum DiscriminatorType {
499        /**
500         * The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding.
501         */
502        VALUE, 
503        /**
504         * The slices are differentiated by the presence or absence of the nominated element. There SHALL be no more than two slices. The slices are differentiated by the fact that one must have a max of 0 and the other must have a min of 1 (or more).  The order in which the slices are declared doesn't matter.
505         */
506        EXISTS, 
507        /**
508         * The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding. This has the same meaning as 'value' and is deprecated.
509         */
510        PATTERN, 
511        /**
512         * The slices are differentiated by type of the nominated element.
513         */
514        TYPE, 
515        /**
516         * The slices are differentiated by conformance of the nominated element to a specified profile. Note that if the path specifies .resolve() then the profile is the target profile on the reference. In this case, validation by the possible profiles is required to differentiate the slices.
517         */
518        PROFILE, 
519        /**
520         * The slices are differentiated by their index. This is only possible if all but the last slice have min=max cardinality, and the (optional) last slice contains other undifferentiated elements.
521         */
522        POSITION, 
523        /**
524         * added to help the parsers with the generic types
525         */
526        NULL;
527        public static DiscriminatorType fromCode(String codeString) throws FHIRException {
528            if (codeString == null || "".equals(codeString))
529                return null;
530        if ("value".equals(codeString))
531          return VALUE;
532        if ("exists".equals(codeString))
533          return EXISTS;
534        if ("pattern".equals(codeString))
535          return PATTERN;
536        if ("type".equals(codeString))
537          return TYPE;
538        if ("profile".equals(codeString))
539          return PROFILE;
540        if ("position".equals(codeString))
541          return POSITION;
542        if (Configuration.isAcceptInvalidEnums())
543          return null;
544        else
545          throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
546        }
547        public String toCode() {
548          switch (this) {
549            case VALUE: return "value";
550            case EXISTS: return "exists";
551            case PATTERN: return "pattern";
552            case TYPE: return "type";
553            case PROFILE: return "profile";
554            case POSITION: return "position";
555            case NULL: return null;
556            default: return "?";
557          }
558        }
559        public String getSystem() {
560          switch (this) {
561            case VALUE: return "http://hl7.org/fhir/discriminator-type";
562            case EXISTS: return "http://hl7.org/fhir/discriminator-type";
563            case PATTERN: return "http://hl7.org/fhir/discriminator-type";
564            case TYPE: return "http://hl7.org/fhir/discriminator-type";
565            case PROFILE: return "http://hl7.org/fhir/discriminator-type";
566            case POSITION: return "http://hl7.org/fhir/discriminator-type";
567            case NULL: return null;
568            default: return "?";
569          }
570        }
571        public String getDefinition() {
572          switch (this) {
573            case VALUE: return "The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding.";
574            case EXISTS: return "The slices are differentiated by the presence or absence of the nominated element. There SHALL be no more than two slices. The slices are differentiated by the fact that one must have a max of 0 and the other must have a min of 1 (or more).  The order in which the slices are declared doesn't matter.";
575            case PATTERN: return "The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding. This has the same meaning as 'value' and is deprecated.";
576            case TYPE: return "The slices are differentiated by type of the nominated element.";
577            case PROFILE: return "The slices are differentiated by conformance of the nominated element to a specified profile. Note that if the path specifies .resolve() then the profile is the target profile on the reference. In this case, validation by the possible profiles is required to differentiate the slices.";
578            case POSITION: return "The slices are differentiated by their index. This is only possible if all but the last slice have min=max cardinality, and the (optional) last slice contains other undifferentiated elements.";
579            case NULL: return null;
580            default: return "?";
581          }
582        }
583        public String getDisplay() {
584          switch (this) {
585            case VALUE: return "Value";
586            case EXISTS: return "Exists";
587            case PATTERN: return "Pattern";
588            case TYPE: return "Type";
589            case PROFILE: return "Profile";
590            case POSITION: return "Position";
591            case NULL: return null;
592            default: return "?";
593          }
594        }
595    }
596
597  public static class DiscriminatorTypeEnumFactory implements EnumFactory<DiscriminatorType> {
598    public DiscriminatorType fromCode(String codeString) throws IllegalArgumentException {
599      if (codeString == null || "".equals(codeString))
600            if (codeString == null || "".equals(codeString))
601                return null;
602        if ("value".equals(codeString))
603          return DiscriminatorType.VALUE;
604        if ("exists".equals(codeString))
605          return DiscriminatorType.EXISTS;
606        if ("pattern".equals(codeString))
607          return DiscriminatorType.PATTERN;
608        if ("type".equals(codeString))
609          return DiscriminatorType.TYPE;
610        if ("profile".equals(codeString))
611          return DiscriminatorType.PROFILE;
612        if ("position".equals(codeString))
613          return DiscriminatorType.POSITION;
614        throw new IllegalArgumentException("Unknown DiscriminatorType code '"+codeString+"'");
615        }
616        public Enumeration<DiscriminatorType> fromType(PrimitiveType<?> code) throws FHIRException {
617          if (code == null)
618            return null;
619          if (code.isEmpty())
620            return new Enumeration<DiscriminatorType>(this, DiscriminatorType.NULL, code);
621          String codeString = ((PrimitiveType) code).asStringValue();
622          if (codeString == null || "".equals(codeString))
623            return new Enumeration<DiscriminatorType>(this, DiscriminatorType.NULL, code);
624        if ("value".equals(codeString))
625          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.VALUE, code);
626        if ("exists".equals(codeString))
627          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.EXISTS, code);
628        if ("pattern".equals(codeString))
629          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PATTERN, code);
630        if ("type".equals(codeString))
631          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.TYPE, code);
632        if ("profile".equals(codeString))
633          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PROFILE, code);
634        if ("position".equals(codeString))
635          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.POSITION, code);
636        throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
637        }
638    public String toCode(DiscriminatorType code) {
639       if (code == DiscriminatorType.NULL)
640           return null;
641       if (code == DiscriminatorType.VALUE)
642        return "value";
643      if (code == DiscriminatorType.EXISTS)
644        return "exists";
645      if (code == DiscriminatorType.PATTERN)
646        return "pattern";
647      if (code == DiscriminatorType.TYPE)
648        return "type";
649      if (code == DiscriminatorType.PROFILE)
650        return "profile";
651      if (code == DiscriminatorType.POSITION)
652        return "position";
653      return "?";
654   }
655    public String toSystem(DiscriminatorType code) {
656      return code.getSystem();
657      }
658    }
659
660    public enum PropertyRepresentation {
661        /**
662         * In XML, this property is represented as an attribute not an element.
663         */
664        XMLATTR, 
665        /**
666         * This element is represented using the XML text attribute (primitives only).
667         */
668        XMLTEXT, 
669        /**
670         * The type of this element is indicated using xsi:type.
671         */
672        TYPEATTR, 
673        /**
674         * Use CDA narrative instead of XHTML.
675         */
676        CDATEXT, 
677        /**
678         * The property is represented using XHTML.
679         */
680        XHTML, 
681        /**
682         * added to help the parsers with the generic types
683         */
684        NULL;
685        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
686            if (codeString == null || "".equals(codeString))
687                return null;
688        if ("xmlAttr".equals(codeString))
689          return XMLATTR;
690        if ("xmlText".equals(codeString))
691          return XMLTEXT;
692        if ("typeAttr".equals(codeString))
693          return TYPEATTR;
694        if ("cdaText".equals(codeString))
695          return CDATEXT;
696        if ("xhtml".equals(codeString))
697          return XHTML;
698        if (Configuration.isAcceptInvalidEnums())
699          return null;
700        else
701          throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
702        }
703        public String toCode() {
704          switch (this) {
705            case XMLATTR: return "xmlAttr";
706            case XMLTEXT: return "xmlText";
707            case TYPEATTR: return "typeAttr";
708            case CDATEXT: return "cdaText";
709            case XHTML: return "xhtml";
710            case NULL: return null;
711            default: return "?";
712          }
713        }
714        public String getSystem() {
715          switch (this) {
716            case XMLATTR: return "http://hl7.org/fhir/property-representation";
717            case XMLTEXT: return "http://hl7.org/fhir/property-representation";
718            case TYPEATTR: return "http://hl7.org/fhir/property-representation";
719            case CDATEXT: return "http://hl7.org/fhir/property-representation";
720            case XHTML: return "http://hl7.org/fhir/property-representation";
721            case NULL: return null;
722            default: return "?";
723          }
724        }
725        public String getDefinition() {
726          switch (this) {
727            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
728            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only).";
729            case TYPEATTR: return "The type of this element is indicated using xsi:type.";
730            case CDATEXT: return "Use CDA narrative instead of XHTML.";
731            case XHTML: return "The property is represented using XHTML.";
732            case NULL: return null;
733            default: return "?";
734          }
735        }
736        public String getDisplay() {
737          switch (this) {
738            case XMLATTR: return "XML Attribute";
739            case XMLTEXT: return "XML Text";
740            case TYPEATTR: return "Type Attribute";
741            case CDATEXT: return "CDA Text Format";
742            case XHTML: return "XHTML";
743            case NULL: return null;
744            default: return "?";
745          }
746        }
747    }
748
749  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
750    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
751      if (codeString == null || "".equals(codeString))
752            if (codeString == null || "".equals(codeString))
753                return null;
754        if ("xmlAttr".equals(codeString))
755          return PropertyRepresentation.XMLATTR;
756        if ("xmlText".equals(codeString))
757          return PropertyRepresentation.XMLTEXT;
758        if ("typeAttr".equals(codeString))
759          return PropertyRepresentation.TYPEATTR;
760        if ("cdaText".equals(codeString))
761          return PropertyRepresentation.CDATEXT;
762        if ("xhtml".equals(codeString))
763          return PropertyRepresentation.XHTML;
764        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
765        }
766        public Enumeration<PropertyRepresentation> fromType(PrimitiveType<?> code) throws FHIRException {
767          if (code == null)
768            return null;
769          if (code.isEmpty())
770            return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.NULL, code);
771          String codeString = ((PrimitiveType) code).asStringValue();
772          if (codeString == null || "".equals(codeString))
773            return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.NULL, code);
774        if ("xmlAttr".equals(codeString))
775          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR, code);
776        if ("xmlText".equals(codeString))
777          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLTEXT, code);
778        if ("typeAttr".equals(codeString))
779          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.TYPEATTR, code);
780        if ("cdaText".equals(codeString))
781          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.CDATEXT, code);
782        if ("xhtml".equals(codeString))
783          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XHTML, code);
784        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
785        }
786    public String toCode(PropertyRepresentation code) {
787       if (code == PropertyRepresentation.NULL)
788           return null;
789       if (code == PropertyRepresentation.XMLATTR)
790        return "xmlAttr";
791      if (code == PropertyRepresentation.XMLTEXT)
792        return "xmlText";
793      if (code == PropertyRepresentation.TYPEATTR)
794        return "typeAttr";
795      if (code == PropertyRepresentation.CDATEXT)
796        return "cdaText";
797      if (code == PropertyRepresentation.XHTML)
798        return "xhtml";
799      return "?";
800   }
801    public String toSystem(PropertyRepresentation code) {
802      return code.getSystem();
803      }
804    }
805
806    public enum ReferenceVersionRules {
807        /**
808         * The reference may be either version independent or version specific.
809         */
810        EITHER, 
811        /**
812         * The reference must be version independent.
813         */
814        INDEPENDENT, 
815        /**
816         * The reference must be version specific.
817         */
818        SPECIFIC, 
819        /**
820         * added to help the parsers with the generic types
821         */
822        NULL;
823        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
824            if (codeString == null || "".equals(codeString))
825                return null;
826        if ("either".equals(codeString))
827          return EITHER;
828        if ("independent".equals(codeString))
829          return INDEPENDENT;
830        if ("specific".equals(codeString))
831          return SPECIFIC;
832        if (Configuration.isAcceptInvalidEnums())
833          return null;
834        else
835          throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
836        }
837        public String toCode() {
838          switch (this) {
839            case EITHER: return "either";
840            case INDEPENDENT: return "independent";
841            case SPECIFIC: return "specific";
842            case NULL: return null;
843            default: return "?";
844          }
845        }
846        public String getSystem() {
847          switch (this) {
848            case EITHER: return "http://hl7.org/fhir/reference-version-rules";
849            case INDEPENDENT: return "http://hl7.org/fhir/reference-version-rules";
850            case SPECIFIC: return "http://hl7.org/fhir/reference-version-rules";
851            case NULL: return null;
852            default: return "?";
853          }
854        }
855        public String getDefinition() {
856          switch (this) {
857            case EITHER: return "The reference may be either version independent or version specific.";
858            case INDEPENDENT: return "The reference must be version independent.";
859            case SPECIFIC: return "The reference must be version specific.";
860            case NULL: return null;
861            default: return "?";
862          }
863        }
864        public String getDisplay() {
865          switch (this) {
866            case EITHER: return "Either Specific or independent";
867            case INDEPENDENT: return "Version independent";
868            case SPECIFIC: return "Version Specific";
869            case NULL: return null;
870            default: return "?";
871          }
872        }
873    }
874
875  public static class ReferenceVersionRulesEnumFactory implements EnumFactory<ReferenceVersionRules> {
876    public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
877      if (codeString == null || "".equals(codeString))
878            if (codeString == null || "".equals(codeString))
879                return null;
880        if ("either".equals(codeString))
881          return ReferenceVersionRules.EITHER;
882        if ("independent".equals(codeString))
883          return ReferenceVersionRules.INDEPENDENT;
884        if ("specific".equals(codeString))
885          return ReferenceVersionRules.SPECIFIC;
886        throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
887        }
888        public Enumeration<ReferenceVersionRules> fromType(PrimitiveType<?> code) throws FHIRException {
889          if (code == null)
890            return null;
891          if (code.isEmpty())
892            return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.NULL, code);
893          String codeString = ((PrimitiveType) code).asStringValue();
894          if (codeString == null || "".equals(codeString))
895            return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.NULL, code);
896        if ("either".equals(codeString))
897          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.EITHER, code);
898        if ("independent".equals(codeString))
899          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.INDEPENDENT, code);
900        if ("specific".equals(codeString))
901          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.SPECIFIC, code);
902        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
903        }
904    public String toCode(ReferenceVersionRules code) {
905       if (code == ReferenceVersionRules.NULL)
906           return null;
907       if (code == ReferenceVersionRules.EITHER)
908        return "either";
909      if (code == ReferenceVersionRules.INDEPENDENT)
910        return "independent";
911      if (code == ReferenceVersionRules.SPECIFIC)
912        return "specific";
913      return "?";
914   }
915    public String toSystem(ReferenceVersionRules code) {
916      return code.getSystem();
917      }
918    }
919
920    public enum SlicingRules {
921        /**
922         * No additional content is allowed other than that described by the slices in this profile.
923         */
924        CLOSED, 
925        /**
926         * Additional content is allowed anywhere in the list.
927         */
928        OPEN, 
929        /**
930         * Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.
931         */
932        OPENATEND, 
933        /**
934         * added to help the parsers with the generic types
935         */
936        NULL;
937        public static SlicingRules fromCode(String codeString) throws FHIRException {
938            if (codeString == null || "".equals(codeString))
939                return null;
940        if ("closed".equals(codeString))
941          return CLOSED;
942        if ("open".equals(codeString))
943          return OPEN;
944        if ("openAtEnd".equals(codeString))
945          return OPENATEND;
946        if (Configuration.isAcceptInvalidEnums())
947          return null;
948        else
949          throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
950        }
951        public String toCode() {
952          switch (this) {
953            case CLOSED: return "closed";
954            case OPEN: return "open";
955            case OPENATEND: return "openAtEnd";
956            case NULL: return null;
957            default: return "?";
958          }
959        }
960        public String getSystem() {
961          switch (this) {
962            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
963            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
964            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
965            case NULL: return null;
966            default: return "?";
967          }
968        }
969        public String getDefinition() {
970          switch (this) {
971            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
972            case OPEN: return "Additional content is allowed anywhere in the list.";
973            case OPENATEND: return "Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.";
974            case NULL: return null;
975            default: return "?";
976          }
977        }
978        public String getDisplay() {
979          switch (this) {
980            case CLOSED: return "Closed";
981            case OPEN: return "Open";
982            case OPENATEND: return "Open at End";
983            case NULL: return null;
984            default: return "?";
985          }
986        }
987    }
988
989  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
990    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
991      if (codeString == null || "".equals(codeString))
992            if (codeString == null || "".equals(codeString))
993                return null;
994        if ("closed".equals(codeString))
995          return SlicingRules.CLOSED;
996        if ("open".equals(codeString))
997          return SlicingRules.OPEN;
998        if ("openAtEnd".equals(codeString))
999          return SlicingRules.OPENATEND;
1000        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
1001        }
1002        public Enumeration<SlicingRules> fromType(PrimitiveType<?> code) throws FHIRException {
1003          if (code == null)
1004            return null;
1005          if (code.isEmpty())
1006            return new Enumeration<SlicingRules>(this, SlicingRules.NULL, code);
1007          String codeString = ((PrimitiveType) code).asStringValue();
1008          if (codeString == null || "".equals(codeString))
1009            return new Enumeration<SlicingRules>(this, SlicingRules.NULL, code);
1010        if ("closed".equals(codeString))
1011          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED, code);
1012        if ("open".equals(codeString))
1013          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN, code);
1014        if ("openAtEnd".equals(codeString))
1015          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND, code);
1016        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
1017        }
1018    public String toCode(SlicingRules code) {
1019       if (code == SlicingRules.NULL)
1020           return null;
1021       if (code == SlicingRules.CLOSED)
1022        return "closed";
1023      if (code == SlicingRules.OPEN)
1024        return "open";
1025      if (code == SlicingRules.OPENATEND)
1026        return "openAtEnd";
1027      return "?";
1028   }
1029    public String toSystem(SlicingRules code) {
1030      return code.getSystem();
1031      }
1032    }
1033
1034    @Block()
1035    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
1036        /**
1037         * Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.
1038         */
1039        @Child(name = "discriminator", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1040        @Description(shortDefinition="Element values that are used to distinguish the slices", formalDefinition="Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices." )
1041        protected List<ElementDefinitionSlicingDiscriminatorComponent> discriminator;
1042
1043        /**
1044         * A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1045         */
1046        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1047        @Description(shortDefinition="Text description of how slicing works (or not)", formalDefinition="A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated." )
1048        protected StringType description;
1049
1050        /**
1051         * If the matching elements have to occur in the same order as defined in the profile.
1052         */
1053        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1054        @Description(shortDefinition="If elements must be in same order as slices", formalDefinition="If the matching elements have to occur in the same order as defined in the profile." )
1055        protected BooleanType ordered;
1056
1057        /**
1058         * Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1059         */
1060        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1061        @Description(shortDefinition="closed | open | openAtEnd", formalDefinition="Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end." )
1062        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-slicing-rules")
1063        protected Enumeration<SlicingRules> rules;
1064
1065        private static final long serialVersionUID = -311635839L;
1066
1067    /**
1068     * Constructor
1069     */
1070      public ElementDefinitionSlicingComponent() {
1071        super();
1072      }
1073
1074    /**
1075     * Constructor
1076     */
1077      public ElementDefinitionSlicingComponent(SlicingRules rules) {
1078        super();
1079        this.setRules(rules);
1080      }
1081
1082        /**
1083         * @return {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
1084         */
1085        public List<ElementDefinitionSlicingDiscriminatorComponent> getDiscriminator() { 
1086          if (this.discriminator == null)
1087            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1088          return this.discriminator;
1089        }
1090
1091        /**
1092         * @return Returns a reference to <code>this</code> for easy method chaining
1093         */
1094        public ElementDefinitionSlicingComponent setDiscriminator(List<ElementDefinitionSlicingDiscriminatorComponent> theDiscriminator) { 
1095          this.discriminator = theDiscriminator;
1096          return this;
1097        }
1098
1099        public boolean hasDiscriminator() { 
1100          if (this.discriminator == null)
1101            return false;
1102          for (ElementDefinitionSlicingDiscriminatorComponent item : this.discriminator)
1103            if (!item.isEmpty())
1104              return true;
1105          return false;
1106        }
1107
1108        public ElementDefinitionSlicingDiscriminatorComponent addDiscriminator() { //3
1109          ElementDefinitionSlicingDiscriminatorComponent t = new ElementDefinitionSlicingDiscriminatorComponent();
1110          if (this.discriminator == null)
1111            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1112          this.discriminator.add(t);
1113          return t;
1114        }
1115
1116        public ElementDefinitionSlicingComponent addDiscriminator(ElementDefinitionSlicingDiscriminatorComponent t) { //3
1117          if (t == null)
1118            return this;
1119          if (this.discriminator == null)
1120            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1121          this.discriminator.add(t);
1122          return this;
1123        }
1124
1125        /**
1126         * @return The first repetition of repeating field {@link #discriminator}, creating it if it does not already exist {3}
1127         */
1128        public ElementDefinitionSlicingDiscriminatorComponent getDiscriminatorFirstRep() { 
1129          if (getDiscriminator().isEmpty()) {
1130            addDiscriminator();
1131          }
1132          return getDiscriminator().get(0);
1133        }
1134
1135        /**
1136         * @return {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1137         */
1138        public StringType getDescriptionElement() { 
1139          if (this.description == null)
1140            if (Configuration.errorOnAutoCreate())
1141              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
1142            else if (Configuration.doAutoCreate())
1143              this.description = new StringType(); // bb
1144          return this.description;
1145        }
1146
1147        public boolean hasDescriptionElement() { 
1148          return this.description != null && !this.description.isEmpty();
1149        }
1150
1151        public boolean hasDescription() { 
1152          return this.description != null && !this.description.isEmpty();
1153        }
1154
1155        /**
1156         * @param value {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1157         */
1158        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
1159          this.description = value;
1160          return this;
1161        }
1162
1163        /**
1164         * @return A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1165         */
1166        public String getDescription() { 
1167          return this.description == null ? null : this.description.getValue();
1168        }
1169
1170        /**
1171         * @param value A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1172         */
1173        public ElementDefinitionSlicingComponent setDescription(String value) { 
1174          if (Utilities.noString(value))
1175            this.description = null;
1176          else {
1177            if (this.description == null)
1178              this.description = new StringType();
1179            this.description.setValue(value);
1180          }
1181          return this;
1182        }
1183
1184        /**
1185         * @return {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
1186         */
1187        public BooleanType getOrderedElement() { 
1188          if (this.ordered == null)
1189            if (Configuration.errorOnAutoCreate())
1190              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
1191            else if (Configuration.doAutoCreate())
1192              this.ordered = new BooleanType(); // bb
1193          return this.ordered;
1194        }
1195
1196        public boolean hasOrderedElement() { 
1197          return this.ordered != null && !this.ordered.isEmpty();
1198        }
1199
1200        public boolean hasOrdered() { 
1201          return this.ordered != null && !this.ordered.isEmpty();
1202        }
1203
1204        /**
1205         * @param value {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
1206         */
1207        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
1208          this.ordered = value;
1209          return this;
1210        }
1211
1212        /**
1213         * @return If the matching elements have to occur in the same order as defined in the profile.
1214         */
1215        public boolean getOrdered() { 
1216          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
1217        }
1218
1219        /**
1220         * @param value If the matching elements have to occur in the same order as defined in the profile.
1221         */
1222        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
1223            if (this.ordered == null)
1224              this.ordered = new BooleanType();
1225            this.ordered.setValue(value);
1226          return this;
1227        }
1228
1229        /**
1230         * @return {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
1231         */
1232        public Enumeration<SlicingRules> getRulesElement() { 
1233          if (this.rules == null)
1234            if (Configuration.errorOnAutoCreate())
1235              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
1236            else if (Configuration.doAutoCreate())
1237              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
1238          return this.rules;
1239        }
1240
1241        public boolean hasRulesElement() { 
1242          return this.rules != null && !this.rules.isEmpty();
1243        }
1244
1245        public boolean hasRules() { 
1246          return this.rules != null && !this.rules.isEmpty();
1247        }
1248
1249        /**
1250         * @param value {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
1251         */
1252        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
1253          this.rules = value;
1254          return this;
1255        }
1256
1257        /**
1258         * @return Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1259         */
1260        public SlicingRules getRules() { 
1261          return this.rules == null ? null : this.rules.getValue();
1262        }
1263
1264        /**
1265         * @param value Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1266         */
1267        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
1268            if (this.rules == null)
1269              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
1270            this.rules.setValue(value);
1271          return this;
1272        }
1273
1274        protected void listChildren(List<Property> children) {
1275          super.listChildren(children);
1276          children.add(new Property("discriminator", "", "Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.", 0, java.lang.Integer.MAX_VALUE, discriminator));
1277          children.add(new Property("description", "string", "A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.", 0, 1, description));
1278          children.add(new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, 1, ordered));
1279          children.add(new Property("rules", "code", "Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.", 0, 1, rules));
1280        }
1281
1282        @Override
1283        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1284          switch (_hash) {
1285          case -1888270692: /*discriminator*/  return new Property("discriminator", "", "Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.", 0, java.lang.Integer.MAX_VALUE, discriminator);
1286          case -1724546052: /*description*/  return new Property("description", "string", "A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.", 0, 1, description);
1287          case -1207109523: /*ordered*/  return new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, 1, ordered);
1288          case 108873975: /*rules*/  return new Property("rules", "code", "Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.", 0, 1, rules);
1289          default: return super.getNamedProperty(_hash, _name, _checkValid);
1290          }
1291
1292        }
1293
1294      @Override
1295      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1296        switch (hash) {
1297        case -1888270692: /*discriminator*/ return this.discriminator == null ? new Base[0] : this.discriminator.toArray(new Base[this.discriminator.size()]); // ElementDefinitionSlicingDiscriminatorComponent
1298        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1299        case -1207109523: /*ordered*/ return this.ordered == null ? new Base[0] : new Base[] {this.ordered}; // BooleanType
1300        case 108873975: /*rules*/ return this.rules == null ? new Base[0] : new Base[] {this.rules}; // Enumeration<SlicingRules>
1301        default: return super.getProperty(hash, name, checkValid);
1302        }
1303
1304      }
1305
1306      @Override
1307      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1308        switch (hash) {
1309        case -1888270692: // discriminator
1310          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value); // ElementDefinitionSlicingDiscriminatorComponent
1311          return value;
1312        case -1724546052: // description
1313          this.description = TypeConvertor.castToString(value); // StringType
1314          return value;
1315        case -1207109523: // ordered
1316          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1317          return value;
1318        case 108873975: // rules
1319          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1320          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1321          return value;
1322        default: return super.setProperty(hash, name, value);
1323        }
1324
1325      }
1326
1327      @Override
1328      public Base setProperty(String name, Base value) throws FHIRException {
1329        if (name.equals("discriminator")) {
1330          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value);
1331        } else if (name.equals("description")) {
1332          this.description = TypeConvertor.castToString(value); // StringType
1333        } else if (name.equals("ordered")) {
1334          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1335        } else if (name.equals("rules")) {
1336          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1337          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1338        } else
1339          return super.setProperty(name, value);
1340        return value;
1341      }
1342
1343  @Override
1344  public void removeChild(String name, Base value) throws FHIRException {
1345        if (name.equals("discriminator")) {
1346          this.getDiscriminator().remove((ElementDefinitionSlicingDiscriminatorComponent) value);
1347        } else if (name.equals("description")) {
1348          this.description = null;
1349        } else if (name.equals("ordered")) {
1350          this.ordered = null;
1351        } else if (name.equals("rules")) {
1352          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1353          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1354        } else
1355          super.removeChild(name, value);
1356        
1357      }
1358
1359      @Override
1360      public Base makeProperty(int hash, String name) throws FHIRException {
1361        switch (hash) {
1362        case -1888270692:  return addDiscriminator(); 
1363        case -1724546052:  return getDescriptionElement();
1364        case -1207109523:  return getOrderedElement();
1365        case 108873975:  return getRulesElement();
1366        default: return super.makeProperty(hash, name);
1367        }
1368
1369      }
1370
1371      @Override
1372      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1373        switch (hash) {
1374        case -1888270692: /*discriminator*/ return new String[] {};
1375        case -1724546052: /*description*/ return new String[] {"string"};
1376        case -1207109523: /*ordered*/ return new String[] {"boolean"};
1377        case 108873975: /*rules*/ return new String[] {"code"};
1378        default: return super.getTypesForProperty(hash, name);
1379        }
1380
1381      }
1382
1383      @Override
1384      public Base addChild(String name) throws FHIRException {
1385        if (name.equals("discriminator")) {
1386          return addDiscriminator();
1387        }
1388        else if (name.equals("description")) {
1389          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.description");
1390        }
1391        else if (name.equals("ordered")) {
1392          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.ordered");
1393        }
1394        else if (name.equals("rules")) {
1395          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.rules");
1396        }
1397        else
1398          return super.addChild(name);
1399      }
1400
1401      public ElementDefinitionSlicingComponent copy() {
1402        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
1403        copyValues(dst);
1404        return dst;
1405      }
1406
1407      public void copyValues(ElementDefinitionSlicingComponent dst) {
1408        super.copyValues(dst);
1409        if (discriminator != null) {
1410          dst.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1411          for (ElementDefinitionSlicingDiscriminatorComponent i : discriminator)
1412            dst.discriminator.add(i.copy());
1413        };
1414        dst.description = description == null ? null : description.copy();
1415        dst.ordered = ordered == null ? null : ordered.copy();
1416        dst.rules = rules == null ? null : rules.copy();
1417      }
1418
1419      @Override
1420      public boolean equalsDeep(Base other_) {
1421        if (!super.equalsDeep(other_))
1422          return false;
1423        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1424          return false;
1425        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1426        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
1427           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
1428      }
1429
1430      @Override
1431      public boolean equalsShallow(Base other_) {
1432        if (!super.equalsShallow(other_))
1433          return false;
1434        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1435          return false;
1436        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1437        return compareValues(description, o.description, true) && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true)
1438          ;
1439      }
1440
1441      public boolean isEmpty() {
1442        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(discriminator, description
1443          , ordered, rules);
1444      }
1445
1446      public String fhirType() {
1447        return "ElementDefinition.slicing";
1448
1449      }
1450
1451      @Override
1452      public String toString() {
1453        return (ordered == null ? "??" : "true".equals(ordered.asStringValue()) ? "ordered" : "unordered")+"/"+
1454            (rules == null ? "??" : rules.asStringValue())+" "+discriminator.toString();
1455      }
1456    }
1457
1458    @Block()
1459    public static class ElementDefinitionSlicingDiscriminatorComponent extends Element implements IBaseDatatypeElement {
1460        /**
1461         * How the element value is interpreted when discrimination is evaluated.
1462         */
1463        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1464        @Description(shortDefinition="value | exists | type | profile | position", formalDefinition="How the element value is interpreted when discrimination is evaluated." )
1465        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/discriminator-type")
1466        protected Enumeration<DiscriminatorType> type;
1467
1468        /**
1469         * A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1470         */
1471        @Child(name = "path", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1472        @Description(shortDefinition="Path to element value", formalDefinition="A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based." )
1473        protected StringType path;
1474
1475        private static final long serialVersionUID = 1151159293L;
1476
1477    /**
1478     * Constructor
1479     */
1480      public ElementDefinitionSlicingDiscriminatorComponent() {
1481        super();
1482      }
1483
1484    /**
1485     * Constructor
1486     */
1487      public ElementDefinitionSlicingDiscriminatorComponent(DiscriminatorType type, String path) {
1488        super();
1489        this.setType(type);
1490        this.setPath(path);
1491      }
1492
1493        /**
1494         * @return {@link #type} (How the element value is interpreted when discrimination is evaluated.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1495         */
1496        public Enumeration<DiscriminatorType> getTypeElement() { 
1497          if (this.type == null)
1498            if (Configuration.errorOnAutoCreate())
1499              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.type");
1500            else if (Configuration.doAutoCreate())
1501              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory()); // bb
1502          return this.type;
1503        }
1504
1505        public boolean hasTypeElement() { 
1506          return this.type != null && !this.type.isEmpty();
1507        }
1508
1509        public boolean hasType() { 
1510          return this.type != null && !this.type.isEmpty();
1511        }
1512
1513        /**
1514         * @param value {@link #type} (How the element value is interpreted when discrimination is evaluated.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1515         */
1516        public ElementDefinitionSlicingDiscriminatorComponent setTypeElement(Enumeration<DiscriminatorType> value) { 
1517          this.type = value;
1518          return this;
1519        }
1520
1521        /**
1522         * @return How the element value is interpreted when discrimination is evaluated.
1523         */
1524        public DiscriminatorType getType() { 
1525          return this.type == null ? null : this.type.getValue();
1526        }
1527
1528        /**
1529         * @param value How the element value is interpreted when discrimination is evaluated.
1530         */
1531        public ElementDefinitionSlicingDiscriminatorComponent setType(DiscriminatorType value) { 
1532            if (this.type == null)
1533              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory());
1534            this.type.setValue(value);
1535          return this;
1536        }
1537
1538        /**
1539         * @return {@link #path} (A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1540         */
1541        public StringType getPathElement() { 
1542          if (this.path == null)
1543            if (Configuration.errorOnAutoCreate())
1544              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.path");
1545            else if (Configuration.doAutoCreate())
1546              this.path = new StringType(); // bb
1547          return this.path;
1548        }
1549
1550        public boolean hasPathElement() { 
1551          return this.path != null && !this.path.isEmpty();
1552        }
1553
1554        public boolean hasPath() { 
1555          return this.path != null && !this.path.isEmpty();
1556        }
1557
1558        /**
1559         * @param value {@link #path} (A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1560         */
1561        public ElementDefinitionSlicingDiscriminatorComponent setPathElement(StringType value) { 
1562          this.path = value;
1563          return this;
1564        }
1565
1566        /**
1567         * @return A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1568         */
1569        public String getPath() { 
1570          return this.path == null ? null : this.path.getValue();
1571        }
1572
1573        /**
1574         * @param value A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1575         */
1576        public ElementDefinitionSlicingDiscriminatorComponent setPath(String value) { 
1577            if (this.path == null)
1578              this.path = new StringType();
1579            this.path.setValue(value);
1580          return this;
1581        }
1582
1583        protected void listChildren(List<Property> children) {
1584          super.listChildren(children);
1585          children.add(new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type));
1586          children.add(new Property("path", "string", "A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.", 0, 1, path));
1587        }
1588
1589        @Override
1590        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1591          switch (_hash) {
1592          case 3575610: /*type*/  return new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type);
1593          case 3433509: /*path*/  return new Property("path", "string", "A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.", 0, 1, path);
1594          default: return super.getNamedProperty(_hash, _name, _checkValid);
1595          }
1596
1597        }
1598
1599      @Override
1600      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1601        switch (hash) {
1602        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DiscriminatorType>
1603        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1604        default: return super.getProperty(hash, name, checkValid);
1605        }
1606
1607      }
1608
1609      @Override
1610      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1611        switch (hash) {
1612        case 3575610: // type
1613          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1614          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1615          return value;
1616        case 3433509: // path
1617          this.path = TypeConvertor.castToString(value); // StringType
1618          return value;
1619        default: return super.setProperty(hash, name, value);
1620        }
1621
1622      }
1623
1624      @Override
1625      public Base setProperty(String name, Base value) throws FHIRException {
1626        if (name.equals("type")) {
1627          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1628          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1629        } else if (name.equals("path")) {
1630          this.path = TypeConvertor.castToString(value); // StringType
1631        } else
1632          return super.setProperty(name, value);
1633        return value;
1634      }
1635
1636  @Override
1637  public void removeChild(String name, Base value) throws FHIRException {
1638        if (name.equals("type")) {
1639          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1640          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1641        } else if (name.equals("path")) {
1642          this.path = null;
1643        } else
1644          super.removeChild(name, value);
1645        
1646      }
1647
1648      @Override
1649      public Base makeProperty(int hash, String name) throws FHIRException {
1650        switch (hash) {
1651        case 3575610:  return getTypeElement();
1652        case 3433509:  return getPathElement();
1653        default: return super.makeProperty(hash, name);
1654        }
1655
1656      }
1657
1658      @Override
1659      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1660        switch (hash) {
1661        case 3575610: /*type*/ return new String[] {"code"};
1662        case 3433509: /*path*/ return new String[] {"string"};
1663        default: return super.getTypesForProperty(hash, name);
1664        }
1665
1666      }
1667
1668      @Override
1669      public Base addChild(String name) throws FHIRException {
1670        if (name.equals("type")) {
1671          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.discriminator.type");
1672        }
1673        else if (name.equals("path")) {
1674          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.discriminator.path");
1675        }
1676        else
1677          return super.addChild(name);
1678      }
1679
1680      public ElementDefinitionSlicingDiscriminatorComponent copy() {
1681        ElementDefinitionSlicingDiscriminatorComponent dst = new ElementDefinitionSlicingDiscriminatorComponent();
1682        copyValues(dst);
1683        return dst;
1684      }
1685
1686      public void copyValues(ElementDefinitionSlicingDiscriminatorComponent dst) {
1687        super.copyValues(dst);
1688        dst.type = type == null ? null : type.copy();
1689        dst.path = path == null ? null : path.copy();
1690      }
1691
1692      @Override
1693      public boolean equalsDeep(Base other_) {
1694        if (!super.equalsDeep(other_))
1695          return false;
1696        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1697          return false;
1698        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1699        return compareDeep(type, o.type, true) && compareDeep(path, o.path, true);
1700      }
1701
1702      @Override
1703      public boolean equalsShallow(Base other_) {
1704        if (!super.equalsShallow(other_))
1705          return false;
1706        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1707          return false;
1708        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1709        return compareValues(type, o.type, true) && compareValues(path, o.path, true);
1710      }
1711
1712      public boolean isEmpty() {
1713        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, path);
1714      }
1715
1716  public String fhirType() {
1717    return "ElementDefinition.slicing.discriminator";
1718
1719  }
1720
1721  @Override
1722  public String toString() {
1723    return (type == null ? "??" : type.getCode()) + "="+(path == null ? "??" : path.asStringValue());
1724  }
1725
1726  }
1727
1728    @Block()
1729    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
1730        /**
1731         * The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1732         */
1733        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1734        @Description(shortDefinition="Path that identifies the base element", formalDefinition="The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base." )
1735        protected StringType path;
1736
1737        /**
1738         * Minimum cardinality of the base element identified by the path.
1739         */
1740        @Child(name = "min", type = {UnsignedIntType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1741        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
1742        protected UnsignedIntType min;
1743
1744        /**
1745         * Maximum cardinality of the base element identified by the path.
1746         */
1747        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1748        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
1749        protected StringType max;
1750
1751        private static final long serialVersionUID = -1412704221L;
1752
1753    /**
1754     * Constructor
1755     */
1756      public ElementDefinitionBaseComponent() {
1757        super();
1758      }
1759
1760    /**
1761     * Constructor
1762     */
1763      public ElementDefinitionBaseComponent(String path, int min, String max) {
1764        super();
1765        this.setPath(path);
1766        this.setMin(min);
1767        this.setMax(max);
1768      }
1769
1770        /**
1771         * @return {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1772         */
1773        public StringType getPathElement() { 
1774          if (this.path == null)
1775            if (Configuration.errorOnAutoCreate())
1776              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
1777            else if (Configuration.doAutoCreate())
1778              this.path = new StringType(); // bb
1779          return this.path;
1780        }
1781
1782        public boolean hasPathElement() { 
1783          return this.path != null && !this.path.isEmpty();
1784        }
1785
1786        public boolean hasPath() { 
1787          return this.path != null && !this.path.isEmpty();
1788        }
1789
1790        /**
1791         * @param value {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1792         */
1793        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
1794          this.path = value;
1795          return this;
1796        }
1797
1798        /**
1799         * @return The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1800         */
1801        public String getPath() { 
1802          return this.path == null ? null : this.path.getValue();
1803        }
1804
1805        /**
1806         * @param value The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1807         */
1808        public ElementDefinitionBaseComponent setPath(String value) { 
1809            if (this.path == null)
1810              this.path = new StringType();
1811            this.path.setValue(value);
1812          return this;
1813        }
1814
1815        /**
1816         * @return {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
1817         */
1818        public UnsignedIntType getMinElement() { 
1819          if (this.min == null)
1820            if (Configuration.errorOnAutoCreate())
1821              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
1822            else if (Configuration.doAutoCreate())
1823              this.min = new UnsignedIntType(); // bb
1824          return this.min;
1825        }
1826
1827        public boolean hasMinElement() { 
1828          return this.min != null && !this.min.isEmpty();
1829        }
1830
1831        public boolean hasMin() { 
1832          return this.min != null && !this.min.isEmpty();
1833        }
1834
1835        /**
1836         * @param value {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
1837         */
1838        public ElementDefinitionBaseComponent setMinElement(UnsignedIntType value) { 
1839          this.min = value;
1840          return this;
1841        }
1842
1843        /**
1844         * @return Minimum cardinality of the base element identified by the path.
1845         */
1846        public int getMin() { 
1847          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
1848        }
1849
1850        /**
1851         * @param value Minimum cardinality of the base element identified by the path.
1852         */
1853        public ElementDefinitionBaseComponent setMin(int value) { 
1854            if (this.min == null)
1855              this.min = new UnsignedIntType();
1856            this.min.setValue(value);
1857          return this;
1858        }
1859
1860        /**
1861         * @return {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
1862         */
1863        public StringType getMaxElement() { 
1864          if (this.max == null)
1865            if (Configuration.errorOnAutoCreate())
1866              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
1867            else if (Configuration.doAutoCreate())
1868              this.max = new StringType(); // bb
1869          return this.max;
1870        }
1871
1872        public boolean hasMaxElement() { 
1873          return this.max != null && !this.max.isEmpty();
1874        }
1875
1876        public boolean hasMax() { 
1877          return this.max != null && !this.max.isEmpty();
1878        }
1879
1880        /**
1881         * @param value {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
1882         */
1883        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
1884          this.max = value;
1885          return this;
1886        }
1887
1888        /**
1889         * @return Maximum cardinality of the base element identified by the path.
1890         */
1891        public String getMax() { 
1892          return this.max == null ? null : this.max.getValue();
1893        }
1894
1895        /**
1896         * @param value Maximum cardinality of the base element identified by the path.
1897         */
1898        public ElementDefinitionBaseComponent setMax(String value) { 
1899            if (this.max == null)
1900              this.max = new StringType();
1901            this.max.setValue(value);
1902          return this;
1903        }
1904
1905        protected void listChildren(List<Property> children) {
1906          super.listChildren(children);
1907          children.add(new Property("path", "string", "The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.", 0, 1, path));
1908          children.add(new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min));
1909          children.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max));
1910        }
1911
1912        @Override
1913        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1914          switch (_hash) {
1915          case 3433509: /*path*/  return new Property("path", "string", "The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.", 0, 1, path);
1916          case 108114: /*min*/  return new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min);
1917          case 107876: /*max*/  return new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max);
1918          default: return super.getNamedProperty(_hash, _name, _checkValid);
1919          }
1920
1921        }
1922
1923      @Override
1924      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1925        switch (hash) {
1926        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1927        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
1928        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
1929        default: return super.getProperty(hash, name, checkValid);
1930        }
1931
1932      }
1933
1934      @Override
1935      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1936        switch (hash) {
1937        case 3433509: // path
1938          this.path = TypeConvertor.castToString(value); // StringType
1939          return value;
1940        case 108114: // min
1941          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1942          return value;
1943        case 107876: // max
1944          this.max = TypeConvertor.castToString(value); // StringType
1945          return value;
1946        default: return super.setProperty(hash, name, value);
1947        }
1948
1949      }
1950
1951      @Override
1952      public Base setProperty(String name, Base value) throws FHIRException {
1953        if (name.equals("path")) {
1954          this.path = TypeConvertor.castToString(value); // StringType
1955        } else if (name.equals("min")) {
1956          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1957        } else if (name.equals("max")) {
1958          this.max = TypeConvertor.castToString(value); // StringType
1959        } else
1960          return super.setProperty(name, value);
1961        return value;
1962      }
1963
1964  @Override
1965  public void removeChild(String name, Base value) throws FHIRException {
1966        if (name.equals("path")) {
1967          this.path = null;
1968        } else if (name.equals("min")) {
1969          this.min = null;
1970        } else if (name.equals("max")) {
1971          this.max = null;
1972        } else
1973          super.removeChild(name, value);
1974        
1975      }
1976
1977      @Override
1978      public Base makeProperty(int hash, String name) throws FHIRException {
1979        switch (hash) {
1980        case 3433509:  return getPathElement();
1981        case 108114:  return getMinElement();
1982        case 107876:  return getMaxElement();
1983        default: return super.makeProperty(hash, name);
1984        }
1985
1986      }
1987
1988      @Override
1989      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1990        switch (hash) {
1991        case 3433509: /*path*/ return new String[] {"string"};
1992        case 108114: /*min*/ return new String[] {"unsignedInt"};
1993        case 107876: /*max*/ return new String[] {"string"};
1994        default: return super.getTypesForProperty(hash, name);
1995        }
1996
1997      }
1998
1999      @Override
2000      public Base addChild(String name) throws FHIRException {
2001        if (name.equals("path")) {
2002          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.path");
2003        }
2004        else if (name.equals("min")) {
2005          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.min");
2006        }
2007        else if (name.equals("max")) {
2008          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.max");
2009        }
2010        else
2011          return super.addChild(name);
2012      }
2013
2014      public ElementDefinitionBaseComponent copy() {
2015        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
2016        copyValues(dst);
2017        return dst;
2018      }
2019
2020      public void copyValues(ElementDefinitionBaseComponent dst) {
2021        super.copyValues(dst);
2022        dst.path = path == null ? null : path.copy();
2023        dst.min = min == null ? null : min.copy();
2024        dst.max = max == null ? null : max.copy();
2025      }
2026
2027      @Override
2028      public boolean equalsDeep(Base other_) {
2029        if (!super.equalsDeep(other_))
2030          return false;
2031        if (!(other_ instanceof ElementDefinitionBaseComponent))
2032          return false;
2033        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
2034        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
2035          ;
2036      }
2037
2038      @Override
2039      public boolean equalsShallow(Base other_) {
2040        if (!super.equalsShallow(other_))
2041          return false;
2042        if (!(other_ instanceof ElementDefinitionBaseComponent))
2043          return false;
2044        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
2045        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
2046          ;
2047      }
2048
2049      public boolean isEmpty() {
2050        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, min, max);
2051      }
2052
2053  public String fhirType() {
2054    return "ElementDefinition.base";
2055
2056  }
2057
2058  }
2059
2060    @Block()
2061    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
2062        /**
2063         * URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2064         */
2065        @Child(name = "code", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2066        @Description(shortDefinition="Data type or Resource (reference to definition)", formalDefinition="URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models." )
2067        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/elementdefinition-types")
2068        protected UriType code;
2069
2070        /**
2071         * Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.
2072         */
2073        @Child(name = "profile", type = {CanonicalType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2074        @Description(shortDefinition="Profiles (StructureDefinition or IG) - one must apply", formalDefinition="Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide." )
2075        protected List<CanonicalType> profile;
2076
2077        /**
2078         * Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.
2079         */
2080        @Child(name = "targetProfile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2081        @Description(shortDefinition="Profile (StructureDefinition or IG) on the Reference/canonical target - one must apply", formalDefinition="Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide." )
2082        protected List<CanonicalType> targetProfile;
2083
2084        /**
2085         * If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.
2086         */
2087        @Child(name = "aggregation", type = {CodeType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2088        @Description(shortDefinition="contained | referenced | bundled - how aggregated", formalDefinition="If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle." )
2089        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-aggregation-mode")
2090        protected List<Enumeration<AggregationMode>> aggregation;
2091
2092        /**
2093         * Whether this reference needs to be version specific or version independent, or whether either can be used.
2094         */
2095        @Child(name = "versioning", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
2096        @Description(shortDefinition="either | independent | specific", formalDefinition="Whether this reference needs to be version specific or version independent, or whether either can be used." )
2097        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reference-version-rules")
2098        protected Enumeration<ReferenceVersionRules> versioning;
2099
2100        private static final long serialVersionUID = 957891653L;
2101
2102    /**
2103     * Constructor
2104     */
2105      public TypeRefComponent() {
2106        super();
2107      }
2108
2109    /**
2110     * Constructor
2111     */
2112      public TypeRefComponent(String code) {
2113        super();
2114        this.setCode(code);
2115      }
2116
2117        /**
2118         * @return {@link #code} (URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
2119         */
2120        public UriType getCodeElement() { 
2121          if (this.code == null)
2122            if (Configuration.errorOnAutoCreate())
2123              throw new Error("Attempt to auto-create TypeRefComponent.code");
2124            else if (Configuration.doAutoCreate())
2125              this.code = new UriType(); // bb
2126          return this.code;
2127        }
2128
2129        public boolean hasCodeElement() { 
2130          return this.code != null && !this.code.isEmpty();
2131        }
2132
2133        public boolean hasCode() { 
2134          return this.code != null && !this.code.isEmpty();
2135        }
2136
2137        /**
2138         * @param value {@link #code} (URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
2139         */
2140        public TypeRefComponent setCodeElement(UriType value) { 
2141          this.code = value;
2142          return this;
2143        }
2144
2145        /**
2146         * @return URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2147         */
2148        public String getCode() { 
2149          return this.code == null ? null : this.code.getValue();
2150        }
2151
2152        /**
2153         * @param value URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2154         */
2155        public TypeRefComponent setCode(String value) { 
2156            if (this.code == null)
2157              this.code = new UriType();
2158            this.code.setValue(value);
2159          return this;
2160        }
2161
2162        /**
2163         * @return {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2164         */
2165        public List<CanonicalType> getProfile() { 
2166          if (this.profile == null)
2167            this.profile = new ArrayList<CanonicalType>();
2168          return this.profile;
2169        }
2170
2171        /**
2172         * @return Returns a reference to <code>this</code> for easy method chaining
2173         */
2174        public TypeRefComponent setProfile(List<CanonicalType> theProfile) { 
2175          this.profile = theProfile;
2176          return this;
2177        }
2178
2179        public boolean hasProfile() { 
2180          if (this.profile == null)
2181            return false;
2182          for (CanonicalType item : this.profile)
2183            if (!item.isEmpty())
2184              return true;
2185          return false;
2186        }
2187
2188        /**
2189         * @return {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2190         */
2191        public CanonicalType addProfileElement() {//2 
2192          CanonicalType t = new CanonicalType();
2193          if (this.profile == null)
2194            this.profile = new ArrayList<CanonicalType>();
2195          this.profile.add(t);
2196          return t;
2197        }
2198
2199        /**
2200         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2201         */
2202        public TypeRefComponent addProfile(String value) { //1
2203          CanonicalType t = new CanonicalType();
2204          t.setValue(value);
2205          if (this.profile == null)
2206            this.profile = new ArrayList<CanonicalType>();
2207          this.profile.add(t);
2208          return this;
2209        }
2210
2211        /**
2212         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2213         */
2214        public boolean hasProfile(String value) { 
2215          if (this.profile == null)
2216            return false;
2217          for (CanonicalType v : this.profile)
2218            if (v.getValue().equals(value)) // canonical
2219              return true;
2220          return false;
2221        }
2222
2223        /**
2224         * @return {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2225         */
2226        public List<CanonicalType> getTargetProfile() { 
2227          if (this.targetProfile == null)
2228            this.targetProfile = new ArrayList<CanonicalType>();
2229          return this.targetProfile;
2230        }
2231
2232        /**
2233         * @return Returns a reference to <code>this</code> for easy method chaining
2234         */
2235        public TypeRefComponent setTargetProfile(List<CanonicalType> theTargetProfile) { 
2236          this.targetProfile = theTargetProfile;
2237          return this;
2238        }
2239
2240        public boolean hasTargetProfile() { 
2241          if (this.targetProfile == null)
2242            return false;
2243          for (CanonicalType item : this.targetProfile)
2244            if (!item.isEmpty())
2245              return true;
2246          return false;
2247        }
2248
2249        /**
2250         * @return {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2251         */
2252        public CanonicalType addTargetProfileElement() {//2 
2253          CanonicalType t = new CanonicalType();
2254          if (this.targetProfile == null)
2255            this.targetProfile = new ArrayList<CanonicalType>();
2256          this.targetProfile.add(t);
2257          return t;
2258        }
2259
2260        /**
2261         * @param value {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2262         */
2263        public TypeRefComponent addTargetProfile(String value) { //1
2264          CanonicalType t = new CanonicalType();
2265          t.setValue(value);
2266          if (this.targetProfile == null)
2267            this.targetProfile = new ArrayList<CanonicalType>();
2268          this.targetProfile.add(t);
2269          return this;
2270        }
2271
2272        /**
2273         * @param value {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2274         */
2275        public boolean hasTargetProfile(String value) { 
2276          if (this.targetProfile == null)
2277            return false;
2278          for (CanonicalType v : this.targetProfile)
2279            if (v.getValue().equals(value)) // canonical
2280              return true;
2281          return false;
2282        }
2283
2284        /**
2285         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2286         */
2287        public List<Enumeration<AggregationMode>> getAggregation() { 
2288          if (this.aggregation == null)
2289            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2290          return this.aggregation;
2291        }
2292
2293        /**
2294         * @return Returns a reference to <code>this</code> for easy method chaining
2295         */
2296        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> theAggregation) { 
2297          this.aggregation = theAggregation;
2298          return this;
2299        }
2300
2301        public boolean hasAggregation() { 
2302          if (this.aggregation == null)
2303            return false;
2304          for (Enumeration<AggregationMode> item : this.aggregation)
2305            if (!item.isEmpty())
2306              return true;
2307          return false;
2308        }
2309
2310        /**
2311         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2312         */
2313        public Enumeration<AggregationMode> addAggregationElement() {//2 
2314          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2315          if (this.aggregation == null)
2316            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2317          this.aggregation.add(t);
2318          return t;
2319        }
2320
2321        /**
2322         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2323         */
2324        public TypeRefComponent addAggregation(AggregationMode value) { //1
2325          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2326          t.setValue(value);
2327          if (this.aggregation == null)
2328            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2329          this.aggregation.add(t);
2330          return this;
2331        }
2332
2333        /**
2334         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2335         */
2336        public boolean hasAggregation(AggregationMode value) { 
2337          if (this.aggregation == null)
2338            return false;
2339          for (Enumeration<AggregationMode> v : this.aggregation)
2340            if (v.getValue().equals(value)) // code
2341              return true;
2342          return false;
2343        }
2344
2345        /**
2346         * @return {@link #versioning} (Whether this reference needs to be version specific or version independent, or whether either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
2347         */
2348        public Enumeration<ReferenceVersionRules> getVersioningElement() { 
2349          if (this.versioning == null)
2350            if (Configuration.errorOnAutoCreate())
2351              throw new Error("Attempt to auto-create TypeRefComponent.versioning");
2352            else if (Configuration.doAutoCreate())
2353              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory()); // bb
2354          return this.versioning;
2355        }
2356
2357        public boolean hasVersioningElement() { 
2358          return this.versioning != null && !this.versioning.isEmpty();
2359        }
2360
2361        public boolean hasVersioning() { 
2362          return this.versioning != null && !this.versioning.isEmpty();
2363        }
2364
2365        /**
2366         * @param value {@link #versioning} (Whether this reference needs to be version specific or version independent, or whether either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
2367         */
2368        public TypeRefComponent setVersioningElement(Enumeration<ReferenceVersionRules> value) { 
2369          this.versioning = value;
2370          return this;
2371        }
2372
2373        /**
2374         * @return Whether this reference needs to be version specific or version independent, or whether either can be used.
2375         */
2376        public ReferenceVersionRules getVersioning() { 
2377          return this.versioning == null ? null : this.versioning.getValue();
2378        }
2379
2380        /**
2381         * @param value Whether this reference needs to be version specific or version independent, or whether either can be used.
2382         */
2383        public TypeRefComponent setVersioning(ReferenceVersionRules value) { 
2384          if (value == null)
2385            this.versioning = null;
2386          else {
2387            if (this.versioning == null)
2388              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory());
2389            this.versioning.setValue(value);
2390          }
2391          return this;
2392        }
2393
2394        protected void listChildren(List<Property> children) {
2395          super.listChildren(children);
2396          children.add(new Property("code", "uri", "URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.", 0, 1, code));
2397          children.add(new Property("profile", "canonical(StructureDefinition|ImplementationGuide)", "Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile));
2398          children.add(new Property("targetProfile", "canonical(StructureDefinition|ImplementationGuide)", "Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, targetProfile));
2399          children.add(new Property("aggregation", "code", "If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.", 0, java.lang.Integer.MAX_VALUE, aggregation));
2400          children.add(new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whether either can be used.", 0, 1, versioning));
2401        }
2402
2403        @Override
2404        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2405          switch (_hash) {
2406          case 3059181: /*code*/  return new Property("code", "uri", "URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.", 0, 1, code);
2407          case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition|ImplementationGuide)", "Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile);
2408          case 1994521304: /*targetProfile*/  return new Property("targetProfile", "canonical(StructureDefinition|ImplementationGuide)", "Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, targetProfile);
2409          case 841524962: /*aggregation*/  return new Property("aggregation", "code", "If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.", 0, java.lang.Integer.MAX_VALUE, aggregation);
2410          case -670487542: /*versioning*/  return new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whether either can be used.", 0, 1, versioning);
2411          default: return super.getNamedProperty(_hash, _name, _checkValid);
2412          }
2413
2414        }
2415
2416      @Override
2417      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2418        switch (hash) {
2419        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // UriType
2420        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
2421        case 1994521304: /*targetProfile*/ return this.targetProfile == null ? new Base[0] : this.targetProfile.toArray(new Base[this.targetProfile.size()]); // CanonicalType
2422        case 841524962: /*aggregation*/ return this.aggregation == null ? new Base[0] : this.aggregation.toArray(new Base[this.aggregation.size()]); // Enumeration<AggregationMode>
2423        case -670487542: /*versioning*/ return this.versioning == null ? new Base[0] : new Base[] {this.versioning}; // Enumeration<ReferenceVersionRules>
2424        default: return super.getProperty(hash, name, checkValid);
2425        }
2426
2427      }
2428
2429      @Override
2430      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2431        switch (hash) {
2432        case 3059181: // code
2433          this.code = TypeConvertor.castToUri(value); // UriType
2434          return value;
2435        case -309425751: // profile
2436          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2437          return value;
2438        case 1994521304: // targetProfile
2439          this.getTargetProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2440          return value;
2441        case 841524962: // aggregation
2442          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2443          this.getAggregation().add((Enumeration) value); // Enumeration<AggregationMode>
2444          return value;
2445        case -670487542: // versioning
2446          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2447          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2448          return value;
2449        default: return super.setProperty(hash, name, value);
2450        }
2451
2452      }
2453
2454      @Override
2455      public Base setProperty(String name, Base value) throws FHIRException {
2456        if (name.equals("code")) {
2457          this.code = TypeConvertor.castToUri(value); // UriType
2458        } else if (name.equals("profile")) {
2459          this.getProfile().add(TypeConvertor.castToCanonical(value));
2460        } else if (name.equals("targetProfile")) {
2461          this.getTargetProfile().add(TypeConvertor.castToCanonical(value));
2462        } else if (name.equals("aggregation")) {
2463          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2464          this.getAggregation().add((Enumeration) value);
2465        } else if (name.equals("versioning")) {
2466          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2467          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2468        } else
2469          return super.setProperty(name, value);
2470        return value;
2471      }
2472
2473  @Override
2474  public void removeChild(String name, Base value) throws FHIRException {
2475        if (name.equals("code")) {
2476          this.code = null;
2477        } else if (name.equals("profile")) {
2478          this.getProfile().remove(value);
2479        } else if (name.equals("targetProfile")) {
2480          this.getTargetProfile().remove(value);
2481        } else if (name.equals("aggregation")) {
2482          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2483          this.getAggregation().remove((Enumeration) value);
2484        } else if (name.equals("versioning")) {
2485          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2486          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2487        } else
2488          super.removeChild(name, value);
2489        
2490      }
2491
2492      @Override
2493      public Base makeProperty(int hash, String name) throws FHIRException {
2494        switch (hash) {
2495        case 3059181:  return getCodeElement();
2496        case -309425751:  return addProfileElement();
2497        case 1994521304:  return addTargetProfileElement();
2498        case 841524962:  return addAggregationElement();
2499        case -670487542:  return getVersioningElement();
2500        default: return super.makeProperty(hash, name);
2501        }
2502
2503      }
2504
2505      @Override
2506      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2507        switch (hash) {
2508        case 3059181: /*code*/ return new String[] {"uri"};
2509        case -309425751: /*profile*/ return new String[] {"canonical"};
2510        case 1994521304: /*targetProfile*/ return new String[] {"canonical"};
2511        case 841524962: /*aggregation*/ return new String[] {"code"};
2512        case -670487542: /*versioning*/ return new String[] {"code"};
2513        default: return super.getTypesForProperty(hash, name);
2514        }
2515
2516      }
2517
2518      @Override
2519      public Base addChild(String name) throws FHIRException {
2520        if (name.equals("code")) {
2521          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.code");
2522        }
2523        else if (name.equals("profile")) {
2524          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.profile");
2525        }
2526        else if (name.equals("targetProfile")) {
2527          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.targetProfile");
2528        }
2529        else if (name.equals("aggregation")) {
2530          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.aggregation");
2531        }
2532        else if (name.equals("versioning")) {
2533          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.versioning");
2534        }
2535        else
2536          return super.addChild(name);
2537      }
2538
2539      public TypeRefComponent copy() {
2540        TypeRefComponent dst = new TypeRefComponent();
2541        copyValues(dst);
2542        return dst;
2543      }
2544
2545      public void copyValues(TypeRefComponent dst) {
2546        super.copyValues(dst);
2547        dst.code = code == null ? null : code.copy();
2548        if (profile != null) {
2549          dst.profile = new ArrayList<CanonicalType>();
2550          for (CanonicalType i : profile)
2551            dst.profile.add(i.copy());
2552        };
2553        if (targetProfile != null) {
2554          dst.targetProfile = new ArrayList<CanonicalType>();
2555          for (CanonicalType i : targetProfile)
2556            dst.targetProfile.add(i.copy());
2557        };
2558        if (aggregation != null) {
2559          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2560          for (Enumeration<AggregationMode> i : aggregation)
2561            dst.aggregation.add(i.copy());
2562        };
2563        dst.versioning = versioning == null ? null : versioning.copy();
2564      }
2565
2566      @Override
2567      public boolean equalsDeep(Base other_) {
2568        if (!super.equalsDeep(other_))
2569          return false;
2570        if (!(other_ instanceof TypeRefComponent))
2571          return false;
2572        TypeRefComponent o = (TypeRefComponent) other_;
2573        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(targetProfile, o.targetProfile, true)
2574           && compareDeep(aggregation, o.aggregation, true) && compareDeep(versioning, o.versioning, true)
2575          ;
2576      }
2577
2578      @Override
2579      public boolean equalsShallow(Base other_) {
2580        if (!super.equalsShallow(other_))
2581          return false;
2582        if (!(other_ instanceof TypeRefComponent))
2583          return false;
2584        TypeRefComponent o = (TypeRefComponent) other_;
2585        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(targetProfile, o.targetProfile, true)
2586           && compareValues(aggregation, o.aggregation, true) && compareValues(versioning, o.versioning, true)
2587          ;
2588      }
2589
2590      public boolean isEmpty() {
2591        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, profile, targetProfile
2592          , aggregation, versioning);
2593      }
2594
2595  public String fhirType() {
2596    return "ElementDefinition.type";
2597
2598  }
2599
2600// added from java-adornments.txt:
2601public boolean hasTarget() {
2602    return Utilities.existsInList(getCode(), "Reference", "canonical", "CodeableReference");
2603  }
2604  
2605    /**
2606   * This code checks for the system prefix and returns the FHIR type
2607   * 
2608   * @return
2609   */
2610  public String getWorkingCode() {
2611    if (hasExtension(ToolingExtensions.EXT_FHIR_TYPE))
2612      return getExtensionString(ToolingExtensions.EXT_FHIR_TYPE);
2613    if (!hasCodeElement()) 
2614      return null;
2615    if (getCodeElement().hasExtension(ToolingExtensions.EXT_XML_TYPE)) {
2616      String s = getCodeElement().getExtensionString(ToolingExtensions.EXT_XML_TYPE);
2617      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date OR xsd:dateTime".equalsIgnoreCase(s))
2618        return "dateTime";
2619      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date".equalsIgnoreCase(s))
2620        return "date";
2621      if ("xsd:dateTime".equalsIgnoreCase(s))
2622        return "instant";
2623      if ("xsd:token".equals(s))
2624        return "code";
2625      if ("xsd:boolean".equals(s))
2626        return "boolean";
2627      if ("xsd:string".equals(s))
2628        return "string";
2629      if ("xsd:time".equals(s))
2630        return "time";
2631      if ("xsd:int".equals(s))
2632        return "integer";
2633      if ("xsd:decimal OR xsd:double".equals(s))
2634        return "decimal";
2635      if ("xsd:decimal".equalsIgnoreCase(s))
2636        return "decimal";
2637      if ("xsd:base64Binary".equalsIgnoreCase(s))
2638        return "base64Binary";
2639      if ("xsd:positiveInteger".equalsIgnoreCase(s))
2640        return "positiveInt";
2641      if ("xsd:nonNegativeInteger".equalsIgnoreCase(s))
2642        return "unsignedInt";
2643      if ("xsd:anyURI".equalsIgnoreCase(s))
2644        return "uri";
2645      if ("xhtml:div".equalsIgnoreCase(s))
2646        return "xhtml";
2647      
2648      throw new Error("Unknown xml type '"+s+"'");
2649    }
2650    return getCode();
2651  }
2652
2653  @Override
2654  public String toString() {
2655    String res = getCode();
2656    if (hasProfile()) {
2657      res = res + "{";
2658      boolean first = true;
2659      for (CanonicalType s : getProfile()) {
2660        if (first) first = false; else res = res + "|";
2661        res = res + s.getValue();
2662      }
2663      res = res + "}";
2664    }
2665    if (hasTargetProfile()) {
2666      res = res + "(";
2667      boolean first = true;
2668      for (CanonicalType s : getTargetProfile()) {
2669        if (first) first = false; else res = res + "|";
2670        res = res + s.getValue();
2671      }
2672      res = res + ")";
2673    }    
2674    return res;
2675  }
2676
2677  public String getName() {
2678    return getWorkingCode();
2679  }
2680
2681  public boolean isResourceReference() {
2682    return "Reference".equals(getCode()) && hasTargetProfile();
2683  }
2684// end addition
2685  }
2686
2687    @Block()
2688    public static class ElementDefinitionExampleComponent extends Element implements IBaseDatatypeElement {
2689        /**
2690         * Describes the purpose of this example among the set of examples.
2691         */
2692        @Child(name = "label", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2693        @Description(shortDefinition="Describes the purpose of this example", formalDefinition="Describes the purpose of this example among the set of examples." )
2694        protected StringType label;
2695
2696        /**
2697         * The actual value for the element, which must be one of the types allowed for this element.
2698         */
2699        @Child(name = "value", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=2, min=1, max=1, modifier=false, summary=true)
2700        @Description(shortDefinition="Value of Example (one of allowed types)", formalDefinition="The actual value for the element, which must be one of the types allowed for this element." )
2701        protected DataType value;
2702
2703        private static final long serialVersionUID = 463190922L;
2704
2705    /**
2706     * Constructor
2707     */
2708      public ElementDefinitionExampleComponent() {
2709        super();
2710      }
2711
2712    /**
2713     * Constructor
2714     */
2715      public ElementDefinitionExampleComponent(String label, DataType value) {
2716        super();
2717        this.setLabel(label);
2718        this.setValue(value);
2719      }
2720
2721        /**
2722         * @return {@link #label} (Describes the purpose of this example among the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2723         */
2724        public StringType getLabelElement() { 
2725          if (this.label == null)
2726            if (Configuration.errorOnAutoCreate())
2727              throw new Error("Attempt to auto-create ElementDefinitionExampleComponent.label");
2728            else if (Configuration.doAutoCreate())
2729              this.label = new StringType(); // bb
2730          return this.label;
2731        }
2732
2733        public boolean hasLabelElement() { 
2734          return this.label != null && !this.label.isEmpty();
2735        }
2736
2737        public boolean hasLabel() { 
2738          return this.label != null && !this.label.isEmpty();
2739        }
2740
2741        /**
2742         * @param value {@link #label} (Describes the purpose of this example among the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2743         */
2744        public ElementDefinitionExampleComponent setLabelElement(StringType value) { 
2745          this.label = value;
2746          return this;
2747        }
2748
2749        /**
2750         * @return Describes the purpose of this example among the set of examples.
2751         */
2752        public String getLabel() { 
2753          return this.label == null ? null : this.label.getValue();
2754        }
2755
2756        /**
2757         * @param value Describes the purpose of this example among the set of examples.
2758         */
2759        public ElementDefinitionExampleComponent setLabel(String value) { 
2760            if (this.label == null)
2761              this.label = new StringType();
2762            this.label.setValue(value);
2763          return this;
2764        }
2765
2766        /**
2767         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2768         */
2769        public DataType getValue() { 
2770          return this.value;
2771        }
2772
2773        /**
2774         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2775         */
2776        public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
2777          if (this.value == null)
2778            this.value = new Base64BinaryType();
2779          if (!(this.value instanceof Base64BinaryType))
2780            throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
2781          return (Base64BinaryType) this.value;
2782        }
2783
2784        public boolean hasValueBase64BinaryType() { 
2785          return this != null && this.value instanceof Base64BinaryType;
2786        }
2787
2788        /**
2789         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2790         */
2791        public BooleanType getValueBooleanType() throws FHIRException { 
2792          if (this.value == null)
2793            this.value = new BooleanType();
2794          if (!(this.value instanceof BooleanType))
2795            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2796          return (BooleanType) this.value;
2797        }
2798
2799        public boolean hasValueBooleanType() { 
2800          return this != null && this.value instanceof BooleanType;
2801        }
2802
2803        /**
2804         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2805         */
2806        public CanonicalType getValueCanonicalType() throws FHIRException { 
2807          if (this.value == null)
2808            this.value = new CanonicalType();
2809          if (!(this.value instanceof CanonicalType))
2810            throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.value.getClass().getName()+" was encountered");
2811          return (CanonicalType) this.value;
2812        }
2813
2814        public boolean hasValueCanonicalType() { 
2815          return this != null && this.value instanceof CanonicalType;
2816        }
2817
2818        /**
2819         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2820         */
2821        public CodeType getValueCodeType() throws FHIRException { 
2822          if (this.value == null)
2823            this.value = new CodeType();
2824          if (!(this.value instanceof CodeType))
2825            throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
2826          return (CodeType) this.value;
2827        }
2828
2829        public boolean hasValueCodeType() { 
2830          return this != null && this.value instanceof CodeType;
2831        }
2832
2833        /**
2834         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2835         */
2836        public DateType getValueDateType() throws FHIRException { 
2837          if (this.value == null)
2838            this.value = new DateType();
2839          if (!(this.value instanceof DateType))
2840            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2841          return (DateType) this.value;
2842        }
2843
2844        public boolean hasValueDateType() { 
2845          return this != null && this.value instanceof DateType;
2846        }
2847
2848        /**
2849         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2850         */
2851        public DateTimeType getValueDateTimeType() throws FHIRException { 
2852          if (this.value == null)
2853            this.value = new DateTimeType();
2854          if (!(this.value instanceof DateTimeType))
2855            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2856          return (DateTimeType) this.value;
2857        }
2858
2859        public boolean hasValueDateTimeType() { 
2860          return this != null && this.value instanceof DateTimeType;
2861        }
2862
2863        /**
2864         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2865         */
2866        public DecimalType getValueDecimalType() throws FHIRException { 
2867          if (this.value == null)
2868            this.value = new DecimalType();
2869          if (!(this.value instanceof DecimalType))
2870            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2871          return (DecimalType) this.value;
2872        }
2873
2874        public boolean hasValueDecimalType() { 
2875          return this != null && this.value instanceof DecimalType;
2876        }
2877
2878        /**
2879         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2880         */
2881        public IdType getValueIdType() throws FHIRException { 
2882          if (this.value == null)
2883            this.value = new IdType();
2884          if (!(this.value instanceof IdType))
2885            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
2886          return (IdType) this.value;
2887        }
2888
2889        public boolean hasValueIdType() { 
2890          return this != null && this.value instanceof IdType;
2891        }
2892
2893        /**
2894         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2895         */
2896        public InstantType getValueInstantType() throws FHIRException { 
2897          if (this.value == null)
2898            this.value = new InstantType();
2899          if (!(this.value instanceof InstantType))
2900            throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.value.getClass().getName()+" was encountered");
2901          return (InstantType) this.value;
2902        }
2903
2904        public boolean hasValueInstantType() { 
2905          return this != null && this.value instanceof InstantType;
2906        }
2907
2908        /**
2909         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2910         */
2911        public IntegerType getValueIntegerType() throws FHIRException { 
2912          if (this.value == null)
2913            this.value = new IntegerType();
2914          if (!(this.value instanceof IntegerType))
2915            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2916          return (IntegerType) this.value;
2917        }
2918
2919        public boolean hasValueIntegerType() { 
2920          return this != null && this.value instanceof IntegerType;
2921        }
2922
2923        /**
2924         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2925         */
2926        public Integer64Type getValueInteger64Type() throws FHIRException { 
2927          if (this.value == null)
2928            this.value = new Integer64Type();
2929          if (!(this.value instanceof Integer64Type))
2930            throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.value.getClass().getName()+" was encountered");
2931          return (Integer64Type) this.value;
2932        }
2933
2934        public boolean hasValueInteger64Type() { 
2935          return this != null && this.value instanceof Integer64Type;
2936        }
2937
2938        /**
2939         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2940         */
2941        public MarkdownType getValueMarkdownType() throws FHIRException { 
2942          if (this.value == null)
2943            this.value = new MarkdownType();
2944          if (!(this.value instanceof MarkdownType))
2945            throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
2946          return (MarkdownType) this.value;
2947        }
2948
2949        public boolean hasValueMarkdownType() { 
2950          return this != null && this.value instanceof MarkdownType;
2951        }
2952
2953        /**
2954         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2955         */
2956        public OidType getValueOidType() throws FHIRException { 
2957          if (this.value == null)
2958            this.value = new OidType();
2959          if (!(this.value instanceof OidType))
2960            throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
2961          return (OidType) this.value;
2962        }
2963
2964        public boolean hasValueOidType() { 
2965          return this != null && this.value instanceof OidType;
2966        }
2967
2968        /**
2969         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2970         */
2971        public PositiveIntType getValuePositiveIntType() throws FHIRException { 
2972          if (this.value == null)
2973            this.value = new PositiveIntType();
2974          if (!(this.value instanceof PositiveIntType))
2975            throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
2976          return (PositiveIntType) this.value;
2977        }
2978
2979        public boolean hasValuePositiveIntType() { 
2980          return this != null && this.value instanceof PositiveIntType;
2981        }
2982
2983        /**
2984         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2985         */
2986        public StringType getValueStringType() throws FHIRException { 
2987          if (this.value == null)
2988            this.value = new StringType();
2989          if (!(this.value instanceof StringType))
2990            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2991          return (StringType) this.value;
2992        }
2993
2994        public boolean hasValueStringType() { 
2995          return this != null && this.value instanceof StringType;
2996        }
2997
2998        /**
2999         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3000         */
3001        public TimeType getValueTimeType() throws FHIRException { 
3002          if (this.value == null)
3003            this.value = new TimeType();
3004          if (!(this.value instanceof TimeType))
3005            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3006          return (TimeType) this.value;
3007        }
3008
3009        public boolean hasValueTimeType() { 
3010          return this != null && this.value instanceof TimeType;
3011        }
3012
3013        /**
3014         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3015         */
3016        public UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
3017          if (this.value == null)
3018            this.value = new UnsignedIntType();
3019          if (!(this.value instanceof UnsignedIntType))
3020            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
3021          return (UnsignedIntType) this.value;
3022        }
3023
3024        public boolean hasValueUnsignedIntType() { 
3025          return this != null && this.value instanceof UnsignedIntType;
3026        }
3027
3028        /**
3029         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3030         */
3031        public UriType getValueUriType() throws FHIRException { 
3032          if (this.value == null)
3033            this.value = new UriType();
3034          if (!(this.value instanceof UriType))
3035            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3036          return (UriType) this.value;
3037        }
3038
3039        public boolean hasValueUriType() { 
3040          return this != null && this.value instanceof UriType;
3041        }
3042
3043        /**
3044         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3045         */
3046        public UrlType getValueUrlType() throws FHIRException { 
3047          if (this.value == null)
3048            this.value = new UrlType();
3049          if (!(this.value instanceof UrlType))
3050            throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
3051          return (UrlType) this.value;
3052        }
3053
3054        public boolean hasValueUrlType() { 
3055          return this != null && this.value instanceof UrlType;
3056        }
3057
3058        /**
3059         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3060         */
3061        public UuidType getValueUuidType() throws FHIRException { 
3062          if (this.value == null)
3063            this.value = new UuidType();
3064          if (!(this.value instanceof UuidType))
3065            throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
3066          return (UuidType) this.value;
3067        }
3068
3069        public boolean hasValueUuidType() { 
3070          return this != null && this.value instanceof UuidType;
3071        }
3072
3073        /**
3074         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3075         */
3076        public Address getValueAddress() throws FHIRException { 
3077          if (this.value == null)
3078            this.value = new Address();
3079          if (!(this.value instanceof Address))
3080            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
3081          return (Address) this.value;
3082        }
3083
3084        public boolean hasValueAddress() { 
3085          return this != null && this.value instanceof Address;
3086        }
3087
3088        /**
3089         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3090         */
3091        public Age getValueAge() throws FHIRException { 
3092          if (this.value == null)
3093            this.value = new Age();
3094          if (!(this.value instanceof Age))
3095            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
3096          return (Age) this.value;
3097        }
3098
3099        public boolean hasValueAge() { 
3100          return this != null && this.value instanceof Age;
3101        }
3102
3103        /**
3104         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3105         */
3106        public Annotation getValueAnnotation() throws FHIRException { 
3107          if (this.value == null)
3108            this.value = new Annotation();
3109          if (!(this.value instanceof Annotation))
3110            throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
3111          return (Annotation) this.value;
3112        }
3113
3114        public boolean hasValueAnnotation() { 
3115          return this != null && this.value instanceof Annotation;
3116        }
3117
3118        /**
3119         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3120         */
3121        public Attachment getValueAttachment() throws FHIRException { 
3122          if (this.value == null)
3123            this.value = new Attachment();
3124          if (!(this.value instanceof Attachment))
3125            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3126          return (Attachment) this.value;
3127        }
3128
3129        public boolean hasValueAttachment() { 
3130          return this != null && this.value instanceof Attachment;
3131        }
3132
3133        /**
3134         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3135         */
3136        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
3137          if (this.value == null)
3138            this.value = new CodeableConcept();
3139          if (!(this.value instanceof CodeableConcept))
3140            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
3141          return (CodeableConcept) this.value;
3142        }
3143
3144        public boolean hasValueCodeableConcept() { 
3145          return this != null && this.value instanceof CodeableConcept;
3146        }
3147
3148        /**
3149         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3150         */
3151        public CodeableReference getValueCodeableReference() throws FHIRException { 
3152          if (this.value == null)
3153            this.value = new CodeableReference();
3154          if (!(this.value instanceof CodeableReference))
3155            throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.value.getClass().getName()+" was encountered");
3156          return (CodeableReference) this.value;
3157        }
3158
3159        public boolean hasValueCodeableReference() { 
3160          return this != null && this.value instanceof CodeableReference;
3161        }
3162
3163        /**
3164         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3165         */
3166        public Coding getValueCoding() throws FHIRException { 
3167          if (this.value == null)
3168            this.value = new Coding();
3169          if (!(this.value instanceof Coding))
3170            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3171          return (Coding) this.value;
3172        }
3173
3174        public boolean hasValueCoding() { 
3175          return this != null && this.value instanceof Coding;
3176        }
3177
3178        /**
3179         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3180         */
3181        public ContactPoint getValueContactPoint() throws FHIRException { 
3182          if (this.value == null)
3183            this.value = new ContactPoint();
3184          if (!(this.value instanceof ContactPoint))
3185            throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
3186          return (ContactPoint) this.value;
3187        }
3188
3189        public boolean hasValueContactPoint() { 
3190          return this != null && this.value instanceof ContactPoint;
3191        }
3192
3193        /**
3194         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3195         */
3196        public Count getValueCount() throws FHIRException { 
3197          if (this.value == null)
3198            this.value = new Count();
3199          if (!(this.value instanceof Count))
3200            throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
3201          return (Count) this.value;
3202        }
3203
3204        public boolean hasValueCount() { 
3205          return this != null && this.value instanceof Count;
3206        }
3207
3208        /**
3209         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3210         */
3211        public Distance getValueDistance() throws FHIRException { 
3212          if (this.value == null)
3213            this.value = new Distance();
3214          if (!(this.value instanceof Distance))
3215            throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
3216          return (Distance) this.value;
3217        }
3218
3219        public boolean hasValueDistance() { 
3220          return this != null && this.value instanceof Distance;
3221        }
3222
3223        /**
3224         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3225         */
3226        public Duration getValueDuration() throws FHIRException { 
3227          if (this.value == null)
3228            this.value = new Duration();
3229          if (!(this.value instanceof Duration))
3230            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
3231          return (Duration) this.value;
3232        }
3233
3234        public boolean hasValueDuration() { 
3235          return this != null && this.value instanceof Duration;
3236        }
3237
3238        /**
3239         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3240         */
3241        public HumanName getValueHumanName() throws FHIRException { 
3242          if (this.value == null)
3243            this.value = new HumanName();
3244          if (!(this.value instanceof HumanName))
3245            throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
3246          return (HumanName) this.value;
3247        }
3248
3249        public boolean hasValueHumanName() { 
3250          return this != null && this.value instanceof HumanName;
3251        }
3252
3253        /**
3254         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3255         */
3256        public Identifier getValueIdentifier() throws FHIRException { 
3257          if (this.value == null)
3258            this.value = new Identifier();
3259          if (!(this.value instanceof Identifier))
3260            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
3261          return (Identifier) this.value;
3262        }
3263
3264        public boolean hasValueIdentifier() { 
3265          return this != null && this.value instanceof Identifier;
3266        }
3267
3268        /**
3269         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3270         */
3271        public Money getValueMoney() throws FHIRException { 
3272          if (this.value == null)
3273            this.value = new Money();
3274          if (!(this.value instanceof Money))
3275            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
3276          return (Money) this.value;
3277        }
3278
3279        public boolean hasValueMoney() { 
3280          return this != null && this.value instanceof Money;
3281        }
3282
3283        /**
3284         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3285         */
3286        public Period getValuePeriod() throws FHIRException { 
3287          if (this.value == null)
3288            this.value = new Period();
3289          if (!(this.value instanceof Period))
3290            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
3291          return (Period) this.value;
3292        }
3293
3294        public boolean hasValuePeriod() { 
3295          return this != null && this.value instanceof Period;
3296        }
3297
3298        /**
3299         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3300         */
3301        public Quantity getValueQuantity() throws FHIRException { 
3302          if (this.value == null)
3303            this.value = new Quantity();
3304          if (!(this.value instanceof Quantity))
3305            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3306          return (Quantity) this.value;
3307        }
3308
3309        public boolean hasValueQuantity() { 
3310          return this != null && this.value instanceof Quantity;
3311        }
3312
3313        /**
3314         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3315         */
3316        public Range getValueRange() throws FHIRException { 
3317          if (this.value == null)
3318            this.value = new Range();
3319          if (!(this.value instanceof Range))
3320            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
3321          return (Range) this.value;
3322        }
3323
3324        public boolean hasValueRange() { 
3325          return this != null && this.value instanceof Range;
3326        }
3327
3328        /**
3329         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3330         */
3331        public Ratio getValueRatio() throws FHIRException { 
3332          if (this.value == null)
3333            this.value = new Ratio();
3334          if (!(this.value instanceof Ratio))
3335            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
3336          return (Ratio) this.value;
3337        }
3338
3339        public boolean hasValueRatio() { 
3340          return this != null && this.value instanceof Ratio;
3341        }
3342
3343        /**
3344         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3345         */
3346        public RatioRange getValueRatioRange() throws FHIRException { 
3347          if (this.value == null)
3348            this.value = new RatioRange();
3349          if (!(this.value instanceof RatioRange))
3350            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.value.getClass().getName()+" was encountered");
3351          return (RatioRange) this.value;
3352        }
3353
3354        public boolean hasValueRatioRange() { 
3355          return this != null && this.value instanceof RatioRange;
3356        }
3357
3358        /**
3359         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3360         */
3361        public Reference getValueReference() throws FHIRException { 
3362          if (this.value == null)
3363            this.value = new Reference();
3364          if (!(this.value instanceof Reference))
3365            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3366          return (Reference) this.value;
3367        }
3368
3369        public boolean hasValueReference() { 
3370          return this != null && this.value instanceof Reference;
3371        }
3372
3373        /**
3374         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3375         */
3376        public SampledData getValueSampledData() throws FHIRException { 
3377          if (this.value == null)
3378            this.value = new SampledData();
3379          if (!(this.value instanceof SampledData))
3380            throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
3381          return (SampledData) this.value;
3382        }
3383
3384        public boolean hasValueSampledData() { 
3385          return this != null && this.value instanceof SampledData;
3386        }
3387
3388        /**
3389         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3390         */
3391        public Signature getValueSignature() throws FHIRException { 
3392          if (this.value == null)
3393            this.value = new Signature();
3394          if (!(this.value instanceof Signature))
3395            throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
3396          return (Signature) this.value;
3397        }
3398
3399        public boolean hasValueSignature() { 
3400          return this != null && this.value instanceof Signature;
3401        }
3402
3403        /**
3404         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3405         */
3406        public Timing getValueTiming() throws FHIRException { 
3407          if (this.value == null)
3408            this.value = new Timing();
3409          if (!(this.value instanceof Timing))
3410            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
3411          return (Timing) this.value;
3412        }
3413
3414        public boolean hasValueTiming() { 
3415          return this != null && this.value instanceof Timing;
3416        }
3417
3418        /**
3419         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3420         */
3421        public ContactDetail getValueContactDetail() throws FHIRException { 
3422          if (this.value == null)
3423            this.value = new ContactDetail();
3424          if (!(this.value instanceof ContactDetail))
3425            throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
3426          return (ContactDetail) this.value;
3427        }
3428
3429        public boolean hasValueContactDetail() { 
3430          return this != null && this.value instanceof ContactDetail;
3431        }
3432
3433        /**
3434         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3435         */
3436        public DataRequirement getValueDataRequirement() throws FHIRException { 
3437          if (this.value == null)
3438            this.value = new DataRequirement();
3439          if (!(this.value instanceof DataRequirement))
3440            throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
3441          return (DataRequirement) this.value;
3442        }
3443
3444        public boolean hasValueDataRequirement() { 
3445          return this != null && this.value instanceof DataRequirement;
3446        }
3447
3448        /**
3449         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3450         */
3451        public Expression getValueExpression() throws FHIRException { 
3452          if (this.value == null)
3453            this.value = new Expression();
3454          if (!(this.value instanceof Expression))
3455            throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
3456          return (Expression) this.value;
3457        }
3458
3459        public boolean hasValueExpression() { 
3460          return this != null && this.value instanceof Expression;
3461        }
3462
3463        /**
3464         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3465         */
3466        public ParameterDefinition getValueParameterDefinition() throws FHIRException { 
3467          if (this.value == null)
3468            this.value = new ParameterDefinition();
3469          if (!(this.value instanceof ParameterDefinition))
3470            throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3471          return (ParameterDefinition) this.value;
3472        }
3473
3474        public boolean hasValueParameterDefinition() { 
3475          return this != null && this.value instanceof ParameterDefinition;
3476        }
3477
3478        /**
3479         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3480         */
3481        public RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
3482          if (this.value == null)
3483            this.value = new RelatedArtifact();
3484          if (!(this.value instanceof RelatedArtifact))
3485            throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
3486          return (RelatedArtifact) this.value;
3487        }
3488
3489        public boolean hasValueRelatedArtifact() { 
3490          return this != null && this.value instanceof RelatedArtifact;
3491        }
3492
3493        /**
3494         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3495         */
3496        public TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
3497          if (this.value == null)
3498            this.value = new TriggerDefinition();
3499          if (!(this.value instanceof TriggerDefinition))
3500            throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3501          return (TriggerDefinition) this.value;
3502        }
3503
3504        public boolean hasValueTriggerDefinition() { 
3505          return this != null && this.value instanceof TriggerDefinition;
3506        }
3507
3508        /**
3509         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3510         */
3511        public UsageContext getValueUsageContext() throws FHIRException { 
3512          if (this.value == null)
3513            this.value = new UsageContext();
3514          if (!(this.value instanceof UsageContext))
3515            throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
3516          return (UsageContext) this.value;
3517        }
3518
3519        public boolean hasValueUsageContext() { 
3520          return this != null && this.value instanceof UsageContext;
3521        }
3522
3523        /**
3524         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3525         */
3526        public Availability getValueAvailability() throws FHIRException { 
3527          if (this.value == null)
3528            this.value = new Availability();
3529          if (!(this.value instanceof Availability))
3530            throw new FHIRException("Type mismatch: the type Availability was expected, but "+this.value.getClass().getName()+" was encountered");
3531          return (Availability) this.value;
3532        }
3533
3534        public boolean hasValueAvailability() { 
3535          return this != null && this.value instanceof Availability;
3536        }
3537
3538        /**
3539         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3540         */
3541        public ExtendedContactDetail getValueExtendedContactDetail() throws FHIRException { 
3542          if (this.value == null)
3543            this.value = new ExtendedContactDetail();
3544          if (!(this.value instanceof ExtendedContactDetail))
3545            throw new FHIRException("Type mismatch: the type ExtendedContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
3546          return (ExtendedContactDetail) this.value;
3547        }
3548
3549        public boolean hasValueExtendedContactDetail() { 
3550          return this != null && this.value instanceof ExtendedContactDetail;
3551        }
3552
3553        /**
3554         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3555         */
3556        public Dosage getValueDosage() throws FHIRException { 
3557          if (this.value == null)
3558            this.value = new Dosage();
3559          if (!(this.value instanceof Dosage))
3560            throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
3561          return (Dosage) this.value;
3562        }
3563
3564        public boolean hasValueDosage() { 
3565          return this != null && this.value instanceof Dosage;
3566        }
3567
3568        /**
3569         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3570         */
3571        public Meta getValueMeta() throws FHIRException { 
3572          if (this.value == null)
3573            this.value = new Meta();
3574          if (!(this.value instanceof Meta))
3575            throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
3576          return (Meta) this.value;
3577        }
3578
3579        public boolean hasValueMeta() { 
3580          return this != null && this.value instanceof Meta;
3581        }
3582
3583        public boolean hasValue() { 
3584          return this.value != null && !this.value.isEmpty();
3585        }
3586
3587        /**
3588         * @param value {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3589         */
3590        public ElementDefinitionExampleComponent setValue(DataType value) { 
3591          if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || value instanceof Quantity || value instanceof Range || value instanceof Ratio || value instanceof RatioRange || value instanceof Reference || value instanceof SampledData || value instanceof Signature || value instanceof Timing || value instanceof ContactDetail || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Availability || value instanceof ExtendedContactDetail || value instanceof Dosage || value instanceof Meta))
3592            throw new FHIRException("Not the right type for ElementDefinition.example.value[x]: "+value.fhirType());
3593          this.value = value;
3594          return this;
3595        }
3596
3597        protected void listChildren(List<Property> children) {
3598          super.listChildren(children);
3599          children.add(new Property("label", "string", "Describes the purpose of this example among the set of examples.", 0, 1, label));
3600          children.add(new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value));
3601        }
3602
3603        @Override
3604        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3605          switch (_hash) {
3606          case 102727412: /*label*/  return new Property("label", "string", "Describes the purpose of this example among the set of examples.", 0, 1, label);
3607          case -1410166417: /*value[x]*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3608          case 111972721: /*value*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3609          case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "base64Binary", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3610          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3611          case -786218365: /*valueCanonical*/  return new Property("value[x]", "canonical", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3612          case -766209282: /*valueCode*/  return new Property("value[x]", "code", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3613          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3614          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3615          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "decimal", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3616          case 231604844: /*valueId*/  return new Property("value[x]", "id", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3617          case -1668687056: /*valueInstant*/  return new Property("value[x]", "instant", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3618          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3619          case -1122120181: /*valueInteger64*/  return new Property("value[x]", "integer64", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3620          case -497880704: /*valueMarkdown*/  return new Property("value[x]", "markdown", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3621          case -1410178407: /*valueOid*/  return new Property("value[x]", "oid", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3622          case -1249932027: /*valuePositiveInt*/  return new Property("value[x]", "positiveInt", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3623          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3624          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3625          case 26529417: /*valueUnsignedInt*/  return new Property("value[x]", "unsignedInt", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3626          case -1410172357: /*valueUri*/  return new Property("value[x]", "uri", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3627          case -1410172354: /*valueUrl*/  return new Property("value[x]", "url", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3628          case -765667124: /*valueUuid*/  return new Property("value[x]", "uuid", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3629          case -478981821: /*valueAddress*/  return new Property("value[x]", "Address", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3630          case -1410191922: /*valueAge*/  return new Property("value[x]", "Age", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3631          case -67108992: /*valueAnnotation*/  return new Property("value[x]", "Annotation", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3632          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3633          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3634          case -257955629: /*valueCodeableReference*/  return new Property("value[x]", "CodeableReference", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3635          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3636          case 944904545: /*valueContactPoint*/  return new Property("value[x]", "ContactPoint", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3637          case 2017332766: /*valueCount*/  return new Property("value[x]", "Count", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3638          case -456359802: /*valueDistance*/  return new Property("value[x]", "Distance", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3639          case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3640          case -2026205465: /*valueHumanName*/  return new Property("value[x]", "HumanName", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3641          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "Identifier", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3642          case 2026560975: /*valueMoney*/  return new Property("value[x]", "Money", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3643          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3644          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3645          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3646          case 2030767386: /*valueRatio*/  return new Property("value[x]", "Ratio", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3647          case -706454461: /*valueRatioRange*/  return new Property("value[x]", "RatioRange", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3648          case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3649          case -962229101: /*valueSampledData*/  return new Property("value[x]", "SampledData", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3650          case -540985785: /*valueSignature*/  return new Property("value[x]", "Signature", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3651          case -1406282469: /*valueTiming*/  return new Property("value[x]", "Timing", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3652          case -1125200224: /*valueContactDetail*/  return new Property("value[x]", "ContactDetail", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3653          case 1710554248: /*valueDataRequirement*/  return new Property("value[x]", "DataRequirement", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3654          case -307517719: /*valueExpression*/  return new Property("value[x]", "Expression", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3655          case 1387478187: /*valueParameterDefinition*/  return new Property("value[x]", "ParameterDefinition", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3656          case 1748214124: /*valueRelatedArtifact*/  return new Property("value[x]", "RelatedArtifact", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3657          case 976830394: /*valueTriggerDefinition*/  return new Property("value[x]", "TriggerDefinition", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3658          case 588000479: /*valueUsageContext*/  return new Property("value[x]", "UsageContext", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3659          case 1678530924: /*valueAvailability*/  return new Property("value[x]", "Availability", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3660          case -1567222041: /*valueExtendedContactDetail*/  return new Property("value[x]", "ExtendedContactDetail", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3661          case -1858636920: /*valueDosage*/  return new Property("value[x]", "Dosage", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3662          case -765920490: /*valueMeta*/  return new Property("value[x]", "Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3663          default: return super.getNamedProperty(_hash, _name, _checkValid);
3664          }
3665
3666        }
3667
3668      @Override
3669      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3670        switch (hash) {
3671        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
3672        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3673        default: return super.getProperty(hash, name, checkValid);
3674        }
3675
3676      }
3677
3678      @Override
3679      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3680        switch (hash) {
3681        case 102727412: // label
3682          this.label = TypeConvertor.castToString(value); // StringType
3683          return value;
3684        case 111972721: // value
3685          this.value = TypeConvertor.castToType(value); // DataType
3686          return value;
3687        default: return super.setProperty(hash, name, value);
3688        }
3689
3690      }
3691
3692      @Override
3693      public Base setProperty(String name, Base value) throws FHIRException {
3694        if (name.equals("label")) {
3695          this.label = TypeConvertor.castToString(value); // StringType
3696        } else if (name.equals("value[x]")) {
3697          this.value = TypeConvertor.castToType(value); // DataType
3698        } else
3699          return super.setProperty(name, value);
3700        return value;
3701      }
3702
3703  @Override
3704  public void removeChild(String name, Base value) throws FHIRException {
3705        if (name.equals("label")) {
3706          this.label = null;
3707        } else if (name.equals("value[x]")) {
3708          this.value = null;
3709        } else
3710          super.removeChild(name, value);
3711        
3712      }
3713
3714      @Override
3715      public Base makeProperty(int hash, String name) throws FHIRException {
3716        switch (hash) {
3717        case 102727412:  return getLabelElement();
3718        case -1410166417:  return getValue();
3719        case 111972721:  return getValue();
3720        default: return super.makeProperty(hash, name);
3721        }
3722
3723      }
3724
3725      @Override
3726      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3727        switch (hash) {
3728        case 102727412: /*label*/ return new String[] {"string"};
3729        case 111972721: /*value*/ return new String[] {"base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "integer64", "markdown", "oid", "positiveInt", "string", "time", "unsignedInt", "uri", "url", "uuid", "Address", "Age", "Annotation", "Attachment", "CodeableConcept", "CodeableReference", "Coding", "ContactPoint", "Count", "Distance", "Duration", "HumanName", "Identifier", "Money", "Period", "Quantity", "Range", "Ratio", "RatioRange", "Reference", "SampledData", "Signature", "Timing", "ContactDetail", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext", "Availability", "ExtendedContactDetail", "Dosage", "Meta"};
3730        default: return super.getTypesForProperty(hash, name);
3731        }
3732
3733      }
3734
3735      @Override
3736      public Base addChild(String name) throws FHIRException {
3737        if (name.equals("label")) {
3738          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.example.label");
3739        }
3740        else if (name.equals("valueBase64Binary")) {
3741          this.value = new Base64BinaryType();
3742          return this.value;
3743        }
3744        else if (name.equals("valueBoolean")) {
3745          this.value = new BooleanType();
3746          return this.value;
3747        }
3748        else if (name.equals("valueCanonical")) {
3749          this.value = new CanonicalType();
3750          return this.value;
3751        }
3752        else if (name.equals("valueCode")) {
3753          this.value = new CodeType();
3754          return this.value;
3755        }
3756        else if (name.equals("valueDate")) {
3757          this.value = new DateType();
3758          return this.value;
3759        }
3760        else if (name.equals("valueDateTime")) {
3761          this.value = new DateTimeType();
3762          return this.value;
3763        }
3764        else if (name.equals("valueDecimal")) {
3765          this.value = new DecimalType();
3766          return this.value;
3767        }
3768        else if (name.equals("valueId")) {
3769          this.value = new IdType();
3770          return this.value;
3771        }
3772        else if (name.equals("valueInstant")) {
3773          this.value = new InstantType();
3774          return this.value;
3775        }
3776        else if (name.equals("valueInteger")) {
3777          this.value = new IntegerType();
3778          return this.value;
3779        }
3780        else if (name.equals("valueInteger64")) {
3781          this.value = new Integer64Type();
3782          return this.value;
3783        }
3784        else if (name.equals("valueMarkdown")) {
3785          this.value = new MarkdownType();
3786          return this.value;
3787        }
3788        else if (name.equals("valueOid")) {
3789          this.value = new OidType();
3790          return this.value;
3791        }
3792        else if (name.equals("valuePositiveInt")) {
3793          this.value = new PositiveIntType();
3794          return this.value;
3795        }
3796        else if (name.equals("valueString")) {
3797          this.value = new StringType();
3798          return this.value;
3799        }
3800        else if (name.equals("valueTime")) {
3801          this.value = new TimeType();
3802          return this.value;
3803        }
3804        else if (name.equals("valueUnsignedInt")) {
3805          this.value = new UnsignedIntType();
3806          return this.value;
3807        }
3808        else if (name.equals("valueUri")) {
3809          this.value = new UriType();
3810          return this.value;
3811        }
3812        else if (name.equals("valueUrl")) {
3813          this.value = new UrlType();
3814          return this.value;
3815        }
3816        else if (name.equals("valueUuid")) {
3817          this.value = new UuidType();
3818          return this.value;
3819        }
3820        else if (name.equals("valueAddress")) {
3821          this.value = new Address();
3822          return this.value;
3823        }
3824        else if (name.equals("valueAge")) {
3825          this.value = new Age();
3826          return this.value;
3827        }
3828        else if (name.equals("valueAnnotation")) {
3829          this.value = new Annotation();
3830          return this.value;
3831        }
3832        else if (name.equals("valueAttachment")) {
3833          this.value = new Attachment();
3834          return this.value;
3835        }
3836        else if (name.equals("valueCodeableConcept")) {
3837          this.value = new CodeableConcept();
3838          return this.value;
3839        }
3840        else if (name.equals("valueCodeableReference")) {
3841          this.value = new CodeableReference();
3842          return this.value;
3843        }
3844        else if (name.equals("valueCoding")) {
3845          this.value = new Coding();
3846          return this.value;
3847        }
3848        else if (name.equals("valueContactPoint")) {
3849          this.value = new ContactPoint();
3850          return this.value;
3851        }
3852        else if (name.equals("valueCount")) {
3853          this.value = new Count();
3854          return this.value;
3855        }
3856        else if (name.equals("valueDistance")) {
3857          this.value = new Distance();
3858          return this.value;
3859        }
3860        else if (name.equals("valueDuration")) {
3861          this.value = new Duration();
3862          return this.value;
3863        }
3864        else if (name.equals("valueHumanName")) {
3865          this.value = new HumanName();
3866          return this.value;
3867        }
3868        else if (name.equals("valueIdentifier")) {
3869          this.value = new Identifier();
3870          return this.value;
3871        }
3872        else if (name.equals("valueMoney")) {
3873          this.value = new Money();
3874          return this.value;
3875        }
3876        else if (name.equals("valuePeriod")) {
3877          this.value = new Period();
3878          return this.value;
3879        }
3880        else if (name.equals("valueQuantity")) {
3881          this.value = new Quantity();
3882          return this.value;
3883        }
3884        else if (name.equals("valueRange")) {
3885          this.value = new Range();
3886          return this.value;
3887        }
3888        else if (name.equals("valueRatio")) {
3889          this.value = new Ratio();
3890          return this.value;
3891        }
3892        else if (name.equals("valueRatioRange")) {
3893          this.value = new RatioRange();
3894          return this.value;
3895        }
3896        else if (name.equals("valueReference")) {
3897          this.value = new Reference();
3898          return this.value;
3899        }
3900        else if (name.equals("valueSampledData")) {
3901          this.value = new SampledData();
3902          return this.value;
3903        }
3904        else if (name.equals("valueSignature")) {
3905          this.value = new Signature();
3906          return this.value;
3907        }
3908        else if (name.equals("valueTiming")) {
3909          this.value = new Timing();
3910          return this.value;
3911        }
3912        else if (name.equals("valueContactDetail")) {
3913          this.value = new ContactDetail();
3914          return this.value;
3915        }
3916        else if (name.equals("valueDataRequirement")) {
3917          this.value = new DataRequirement();
3918          return this.value;
3919        }
3920        else if (name.equals("valueExpression")) {
3921          this.value = new Expression();
3922          return this.value;
3923        }
3924        else if (name.equals("valueParameterDefinition")) {
3925          this.value = new ParameterDefinition();
3926          return this.value;
3927        }
3928        else if (name.equals("valueRelatedArtifact")) {
3929          this.value = new RelatedArtifact();
3930          return this.value;
3931        }
3932        else if (name.equals("valueTriggerDefinition")) {
3933          this.value = new TriggerDefinition();
3934          return this.value;
3935        }
3936        else if (name.equals("valueUsageContext")) {
3937          this.value = new UsageContext();
3938          return this.value;
3939        }
3940        else if (name.equals("valueAvailability")) {
3941          this.value = new Availability();
3942          return this.value;
3943        }
3944        else if (name.equals("valueExtendedContactDetail")) {
3945          this.value = new ExtendedContactDetail();
3946          return this.value;
3947        }
3948        else if (name.equals("valueDosage")) {
3949          this.value = new Dosage();
3950          return this.value;
3951        }
3952        else if (name.equals("valueMeta")) {
3953          this.value = new Meta();
3954          return this.value;
3955        }
3956        else
3957          return super.addChild(name);
3958      }
3959
3960      public ElementDefinitionExampleComponent copy() {
3961        ElementDefinitionExampleComponent dst = new ElementDefinitionExampleComponent();
3962        copyValues(dst);
3963        return dst;
3964      }
3965
3966      public void copyValues(ElementDefinitionExampleComponent dst) {
3967        super.copyValues(dst);
3968        dst.label = label == null ? null : label.copy();
3969        dst.value = value == null ? null : value.copy();
3970      }
3971
3972      @Override
3973      public boolean equalsDeep(Base other_) {
3974        if (!super.equalsDeep(other_))
3975          return false;
3976        if (!(other_ instanceof ElementDefinitionExampleComponent))
3977          return false;
3978        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3979        return compareDeep(label, o.label, true) && compareDeep(value, o.value, true);
3980      }
3981
3982      @Override
3983      public boolean equalsShallow(Base other_) {
3984        if (!super.equalsShallow(other_))
3985          return false;
3986        if (!(other_ instanceof ElementDefinitionExampleComponent))
3987          return false;
3988        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3989        return compareValues(label, o.label, true);
3990      }
3991
3992      public boolean isEmpty() {
3993        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(label, value);
3994      }
3995
3996  public String fhirType() {
3997    return "ElementDefinition.example";
3998
3999  }
4000
4001  }
4002
4003    @Block()
4004    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
4005        /**
4006         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
4007         */
4008        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4009        @Description(shortDefinition="Target of 'condition' reference above", formalDefinition="Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality." )
4010        protected IdType key;
4011
4012        /**
4013         * Description of why this constraint is necessary or appropriate.
4014         */
4015        @Child(name = "requirements", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4016        @Description(shortDefinition="Why this constraint is necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
4017        protected MarkdownType requirements;
4018
4019        /**
4020         * Identifies the impact constraint violation has on the conformance of the instance.
4021         */
4022        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
4023        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
4024        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/constraint-severity")
4025        protected Enumeration<ConstraintSeverity> severity;
4026
4027        /**
4028         * If true, indicates that the warning or best practice guideline should be suppressed.
4029         */
4030        @Child(name = "suppress", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4031        @Description(shortDefinition="Suppress warning or hint in profile", formalDefinition="If true, indicates that the warning or best practice guideline should be suppressed." )
4032        protected BooleanType suppress;
4033
4034        /**
4035         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
4036         */
4037        @Child(name = "human", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
4038        @Description(shortDefinition="Human description of constraint", formalDefinition="Text that can be used to describe the constraint in messages identifying that the constraint has been violated." )
4039        protected StringType human;
4040
4041        /**
4042         * A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
4043         */
4044        @Child(name = "expression", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
4045        @Description(shortDefinition="FHIRPath expression of constraint", formalDefinition="A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met." )
4046        protected StringType expression;
4047
4048        /**
4049         * A reference to the original source of the constraint, for traceability purposes.
4050         */
4051        @Child(name = "source", type = {CanonicalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
4052        @Description(shortDefinition="Reference to original source of constraint", formalDefinition="A reference to the original source of the constraint, for traceability purposes." )
4053        protected CanonicalType source;
4054
4055        private static final long serialVersionUID = 1642607838L;
4056
4057    /**
4058     * Constructor
4059     */
4060      public ElementDefinitionConstraintComponent() {
4061        super();
4062      }
4063
4064    /**
4065     * Constructor
4066     */
4067      public ElementDefinitionConstraintComponent(String key, ConstraintSeverity severity, String human) {
4068        super();
4069        this.setKey(key);
4070        this.setSeverity(severity);
4071        this.setHuman(human);
4072      }
4073
4074        /**
4075         * @return {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
4076         */
4077        public IdType getKeyElement() { 
4078          if (this.key == null)
4079            if (Configuration.errorOnAutoCreate())
4080              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
4081            else if (Configuration.doAutoCreate())
4082              this.key = new IdType(); // bb
4083          return this.key;
4084        }
4085
4086        public boolean hasKeyElement() { 
4087          return this.key != null && !this.key.isEmpty();
4088        }
4089
4090        public boolean hasKey() { 
4091          return this.key != null && !this.key.isEmpty();
4092        }
4093
4094        /**
4095         * @param value {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
4096         */
4097        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
4098          this.key = value;
4099          return this;
4100        }
4101
4102        /**
4103         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
4104         */
4105        public String getKey() { 
4106          return this.key == null ? null : this.key.getValue();
4107        }
4108
4109        /**
4110         * @param value Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
4111         */
4112        public ElementDefinitionConstraintComponent setKey(String value) { 
4113            if (this.key == null)
4114              this.key = new IdType();
4115            this.key.setValue(value);
4116          return this;
4117        }
4118
4119        /**
4120         * @return {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
4121         */
4122        public MarkdownType getRequirementsElement() { 
4123          if (this.requirements == null)
4124            if (Configuration.errorOnAutoCreate())
4125              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
4126            else if (Configuration.doAutoCreate())
4127              this.requirements = new MarkdownType(); // bb
4128          return this.requirements;
4129        }
4130
4131        public boolean hasRequirementsElement() { 
4132          return this.requirements != null && !this.requirements.isEmpty();
4133        }
4134
4135        public boolean hasRequirements() { 
4136          return this.requirements != null && !this.requirements.isEmpty();
4137        }
4138
4139        /**
4140         * @param value {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
4141         */
4142        public ElementDefinitionConstraintComponent setRequirementsElement(MarkdownType value) { 
4143          this.requirements = value;
4144          return this;
4145        }
4146
4147        /**
4148         * @return Description of why this constraint is necessary or appropriate.
4149         */
4150        public String getRequirements() { 
4151          return this.requirements == null ? null : this.requirements.getValue();
4152        }
4153
4154        /**
4155         * @param value Description of why this constraint is necessary or appropriate.
4156         */
4157        public ElementDefinitionConstraintComponent setRequirements(String value) { 
4158          if (Utilities.noString(value))
4159            this.requirements = null;
4160          else {
4161            if (this.requirements == null)
4162              this.requirements = new MarkdownType();
4163            this.requirements.setValue(value);
4164          }
4165          return this;
4166        }
4167
4168        /**
4169         * @return {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
4170         */
4171        public Enumeration<ConstraintSeverity> getSeverityElement() { 
4172          if (this.severity == null)
4173            if (Configuration.errorOnAutoCreate())
4174              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
4175            else if (Configuration.doAutoCreate())
4176              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
4177          return this.severity;
4178        }
4179
4180        public boolean hasSeverityElement() { 
4181          return this.severity != null && !this.severity.isEmpty();
4182        }
4183
4184        public boolean hasSeverity() { 
4185          return this.severity != null && !this.severity.isEmpty();
4186        }
4187
4188        /**
4189         * @param value {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
4190         */
4191        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
4192          this.severity = value;
4193          return this;
4194        }
4195
4196        /**
4197         * @return Identifies the impact constraint violation has on the conformance of the instance.
4198         */
4199        public ConstraintSeverity getSeverity() { 
4200          return this.severity == null ? null : this.severity.getValue();
4201        }
4202
4203        /**
4204         * @param value Identifies the impact constraint violation has on the conformance of the instance.
4205         */
4206        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
4207            if (this.severity == null)
4208              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
4209            this.severity.setValue(value);
4210          return this;
4211        }
4212
4213        /**
4214         * @return {@link #suppress} (If true, indicates that the warning or best practice guideline should be suppressed.). This is the underlying object with id, value and extensions. The accessor "getSuppress" gives direct access to the value
4215         */
4216        public BooleanType getSuppressElement() { 
4217          if (this.suppress == null)
4218            if (Configuration.errorOnAutoCreate())
4219              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.suppress");
4220            else if (Configuration.doAutoCreate())
4221              this.suppress = new BooleanType(); // bb
4222          return this.suppress;
4223        }
4224
4225        public boolean hasSuppressElement() { 
4226          return this.suppress != null && !this.suppress.isEmpty();
4227        }
4228
4229        public boolean hasSuppress() { 
4230          return this.suppress != null && !this.suppress.isEmpty();
4231        }
4232
4233        /**
4234         * @param value {@link #suppress} (If true, indicates that the warning or best practice guideline should be suppressed.). This is the underlying object with id, value and extensions. The accessor "getSuppress" gives direct access to the value
4235         */
4236        public ElementDefinitionConstraintComponent setSuppressElement(BooleanType value) { 
4237          this.suppress = value;
4238          return this;
4239        }
4240
4241        /**
4242         * @return If true, indicates that the warning or best practice guideline should be suppressed.
4243         */
4244        public boolean getSuppress() { 
4245          return this.suppress == null || this.suppress.isEmpty() ? false : this.suppress.getValue();
4246        }
4247
4248        /**
4249         * @param value If true, indicates that the warning or best practice guideline should be suppressed.
4250         */
4251        public ElementDefinitionConstraintComponent setSuppress(boolean value) { 
4252            if (this.suppress == null)
4253              this.suppress = new BooleanType();
4254            this.suppress.setValue(value);
4255          return this;
4256        }
4257
4258        /**
4259         * @return {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
4260         */
4261        public StringType getHumanElement() { 
4262          if (this.human == null)
4263            if (Configuration.errorOnAutoCreate())
4264              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
4265            else if (Configuration.doAutoCreate())
4266              this.human = new StringType(); // bb
4267          return this.human;
4268        }
4269
4270        public boolean hasHumanElement() { 
4271          return this.human != null && !this.human.isEmpty();
4272        }
4273
4274        public boolean hasHuman() { 
4275          return this.human != null && !this.human.isEmpty();
4276        }
4277
4278        /**
4279         * @param value {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
4280         */
4281        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
4282          this.human = value;
4283          return this;
4284        }
4285
4286        /**
4287         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
4288         */
4289        public String getHuman() { 
4290          return this.human == null ? null : this.human.getValue();
4291        }
4292
4293        /**
4294         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
4295         */
4296        public ElementDefinitionConstraintComponent setHuman(String value) { 
4297            if (this.human == null)
4298              this.human = new StringType();
4299            this.human.setValue(value);
4300          return this;
4301        }
4302
4303        /**
4304         * @return {@link #expression} (A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
4305         */
4306        public StringType getExpressionElement() { 
4307          if (this.expression == null)
4308            if (Configuration.errorOnAutoCreate())
4309              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.expression");
4310            else if (Configuration.doAutoCreate())
4311              this.expression = new StringType(); // bb
4312          return this.expression;
4313        }
4314
4315        public boolean hasExpressionElement() { 
4316          return this.expression != null && !this.expression.isEmpty();
4317        }
4318
4319        public boolean hasExpression() { 
4320          return this.expression != null && !this.expression.isEmpty();
4321        }
4322
4323        /**
4324         * @param value {@link #expression} (A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
4325         */
4326        public ElementDefinitionConstraintComponent setExpressionElement(StringType value) { 
4327          this.expression = value;
4328          return this;
4329        }
4330
4331        /**
4332         * @return A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
4333         */
4334        public String getExpression() { 
4335          return this.expression == null ? null : this.expression.getValue();
4336        }
4337
4338        /**
4339         * @param value A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
4340         */
4341        public ElementDefinitionConstraintComponent setExpression(String value) { 
4342          if (Utilities.noString(value))
4343            this.expression = null;
4344          else {
4345            if (this.expression == null)
4346              this.expression = new StringType();
4347            this.expression.setValue(value);
4348          }
4349          return this;
4350        }
4351
4352        /**
4353         * @return {@link #source} (A reference to the original source of the constraint, for traceability purposes.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
4354         */
4355        public CanonicalType getSourceElement() { 
4356          if (this.source == null)
4357            if (Configuration.errorOnAutoCreate())
4358              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.source");
4359            else if (Configuration.doAutoCreate())
4360              this.source = new CanonicalType(); // bb
4361          return this.source;
4362        }
4363
4364        public boolean hasSourceElement() { 
4365          return this.source != null && !this.source.isEmpty();
4366        }
4367
4368        public boolean hasSource() { 
4369          return this.source != null && !this.source.isEmpty();
4370        }
4371
4372        /**
4373         * @param value {@link #source} (A reference to the original source of the constraint, for traceability purposes.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
4374         */
4375        public ElementDefinitionConstraintComponent setSourceElement(CanonicalType value) { 
4376          this.source = value;
4377          return this;
4378        }
4379
4380        /**
4381         * @return A reference to the original source of the constraint, for traceability purposes.
4382         */
4383        public String getSource() { 
4384          return this.source == null ? null : this.source.getValue();
4385        }
4386
4387        /**
4388         * @param value A reference to the original source of the constraint, for traceability purposes.
4389         */
4390        public ElementDefinitionConstraintComponent setSource(String value) { 
4391          if (Utilities.noString(value))
4392            this.source = null;
4393          else {
4394            if (this.source == null)
4395              this.source = new CanonicalType();
4396            this.source.setValue(value);
4397          }
4398          return this;
4399        }
4400
4401        protected void listChildren(List<Property> children) {
4402          super.listChildren(children);
4403          children.add(new Property("key", "id", "Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.", 0, 1, key));
4404          children.add(new Property("requirements", "markdown", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements));
4405          children.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity));
4406          children.add(new Property("suppress", "boolean", "If true, indicates that the warning or best practice guideline should be suppressed.", 0, 1, suppress));
4407          children.add(new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, 1, human));
4408          children.add(new Property("expression", "string", "A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.", 0, 1, expression));
4409          children.add(new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source));
4410        }
4411
4412        @Override
4413        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4414          switch (_hash) {
4415          case 106079: /*key*/  return new Property("key", "id", "Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.", 0, 1, key);
4416          case -1619874672: /*requirements*/  return new Property("requirements", "markdown", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements);
4417          case 1478300413: /*severity*/  return new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity);
4418          case -1663129931: /*suppress*/  return new Property("suppress", "boolean", "If true, indicates that the warning or best practice guideline should be suppressed.", 0, 1, suppress);
4419          case 99639597: /*human*/  return new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, 1, human);
4420          case -1795452264: /*expression*/  return new Property("expression", "string", "A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.", 0, 1, expression);
4421          case -896505829: /*source*/  return new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source);
4422          default: return super.getNamedProperty(_hash, _name, _checkValid);
4423          }
4424
4425        }
4426
4427      @Override
4428      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4429        switch (hash) {
4430        case 106079: /*key*/ return this.key == null ? new Base[0] : new Base[] {this.key}; // IdType
4431        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // MarkdownType
4432        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<ConstraintSeverity>
4433        case -1663129931: /*suppress*/ return this.suppress == null ? new Base[0] : new Base[] {this.suppress}; // BooleanType
4434        case 99639597: /*human*/ return this.human == null ? new Base[0] : new Base[] {this.human}; // StringType
4435        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
4436        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // CanonicalType
4437        default: return super.getProperty(hash, name, checkValid);
4438        }
4439
4440      }
4441
4442      @Override
4443      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4444        switch (hash) {
4445        case 106079: // key
4446          this.key = TypeConvertor.castToId(value); // IdType
4447          return value;
4448        case -1619874672: // requirements
4449          this.requirements = TypeConvertor.castToMarkdown(value); // MarkdownType
4450          return value;
4451        case 1478300413: // severity
4452          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4453          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4454          return value;
4455        case -1663129931: // suppress
4456          this.suppress = TypeConvertor.castToBoolean(value); // BooleanType
4457          return value;
4458        case 99639597: // human
4459          this.human = TypeConvertor.castToString(value); // StringType
4460          return value;
4461        case -1795452264: // expression
4462          this.expression = TypeConvertor.castToString(value); // StringType
4463          return value;
4464        case -896505829: // source
4465          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4466          return value;
4467        default: return super.setProperty(hash, name, value);
4468        }
4469
4470      }
4471
4472      @Override
4473      public Base setProperty(String name, Base value) throws FHIRException {
4474        if (name.equals("key")) {
4475          this.key = TypeConvertor.castToId(value); // IdType
4476        } else if (name.equals("requirements")) {
4477          this.requirements = TypeConvertor.castToMarkdown(value); // MarkdownType
4478        } else if (name.equals("severity")) {
4479          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4480          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4481        } else if (name.equals("suppress")) {
4482          this.suppress = TypeConvertor.castToBoolean(value); // BooleanType
4483        } else if (name.equals("human")) {
4484          this.human = TypeConvertor.castToString(value); // StringType
4485        } else if (name.equals("expression")) {
4486          this.expression = TypeConvertor.castToString(value); // StringType
4487        } else if (name.equals("source")) {
4488          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4489        } else
4490          return super.setProperty(name, value);
4491        return value;
4492      }
4493
4494  @Override
4495  public void removeChild(String name, Base value) throws FHIRException {
4496        if (name.equals("key")) {
4497          this.key = null;
4498        } else if (name.equals("requirements")) {
4499          this.requirements = null;
4500        } else if (name.equals("severity")) {
4501          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4502          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4503        } else if (name.equals("suppress")) {
4504          this.suppress = null;
4505        } else if (name.equals("human")) {
4506          this.human = null;
4507        } else if (name.equals("expression")) {
4508          this.expression = null;
4509        } else if (name.equals("source")) {
4510          this.source = null;
4511        } else
4512          super.removeChild(name, value);
4513        
4514      }
4515
4516      @Override
4517      public Base makeProperty(int hash, String name) throws FHIRException {
4518        switch (hash) {
4519        case 106079:  return getKeyElement();
4520        case -1619874672:  return getRequirementsElement();
4521        case 1478300413:  return getSeverityElement();
4522        case -1663129931:  return getSuppressElement();
4523        case 99639597:  return getHumanElement();
4524        case -1795452264:  return getExpressionElement();
4525        case -896505829:  return getSourceElement();
4526        default: return super.makeProperty(hash, name);
4527        }
4528
4529      }
4530
4531      @Override
4532      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4533        switch (hash) {
4534        case 106079: /*key*/ return new String[] {"id"};
4535        case -1619874672: /*requirements*/ return new String[] {"markdown"};
4536        case 1478300413: /*severity*/ return new String[] {"code"};
4537        case -1663129931: /*suppress*/ return new String[] {"boolean"};
4538        case 99639597: /*human*/ return new String[] {"string"};
4539        case -1795452264: /*expression*/ return new String[] {"string"};
4540        case -896505829: /*source*/ return new String[] {"canonical"};
4541        default: return super.getTypesForProperty(hash, name);
4542        }
4543
4544      }
4545
4546      @Override
4547      public Base addChild(String name) throws FHIRException {
4548        if (name.equals("key")) {
4549          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.key");
4550        }
4551        else if (name.equals("requirements")) {
4552          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.requirements");
4553        }
4554        else if (name.equals("severity")) {
4555          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.severity");
4556        }
4557        else if (name.equals("suppress")) {
4558          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.suppress");
4559        }
4560        else if (name.equals("human")) {
4561          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.human");
4562        }
4563        else if (name.equals("expression")) {
4564          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.expression");
4565        }
4566        else if (name.equals("source")) {
4567          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.source");
4568        }
4569        else
4570          return super.addChild(name);
4571      }
4572
4573      public ElementDefinitionConstraintComponent copy() {
4574        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
4575        copyValues(dst);
4576        return dst;
4577      }
4578
4579      public void copyValues(ElementDefinitionConstraintComponent dst) {
4580        super.copyValues(dst);
4581        dst.key = key == null ? null : key.copy();
4582        dst.requirements = requirements == null ? null : requirements.copy();
4583        dst.severity = severity == null ? null : severity.copy();
4584        dst.suppress = suppress == null ? null : suppress.copy();
4585        dst.human = human == null ? null : human.copy();
4586        dst.expression = expression == null ? null : expression.copy();
4587        dst.source = source == null ? null : source.copy();
4588      }
4589
4590      @Override
4591      public boolean equalsDeep(Base other_) {
4592        if (!super.equalsDeep(other_))
4593          return false;
4594        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4595          return false;
4596        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4597        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
4598           && compareDeep(suppress, o.suppress, true) && compareDeep(human, o.human, true) && compareDeep(expression, o.expression, true)
4599           && compareDeep(source, o.source, true);
4600      }
4601
4602      @Override
4603      public boolean equalsShallow(Base other_) {
4604        if (!super.equalsShallow(other_))
4605          return false;
4606        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4607          return false;
4608        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4609        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
4610           && compareValues(suppress, o.suppress, true) && compareValues(human, o.human, true) && compareValues(expression, o.expression, true)
4611           && compareValues(source, o.source, true);
4612      }
4613
4614      public boolean isEmpty() {
4615        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(key, requirements, severity
4616          , suppress, human, expression, source);
4617      }
4618
4619  public String fhirType() {
4620    return "ElementDefinition.constraint";
4621
4622  }
4623
4624  @Override
4625  public String toString() {
4626    return key + ":" + expression + (severity == null ? "("+severity.asStringValue()+")" : "");
4627  }
4628
4629  }
4630
4631    @Block()
4632    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
4633        /**
4634         * Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4635         */
4636        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4637        @Description(shortDefinition="required | extensible | preferred | example", formalDefinition="Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances." )
4638        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/binding-strength")
4639        protected Enumeration<BindingStrength> strength;
4640
4641        /**
4642         * Describes the intended use of this particular set of codes.
4643         */
4644        @Child(name = "description", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4645        @Description(shortDefinition="Intended use of codes in the bound value set", formalDefinition="Describes the intended use of this particular set of codes." )
4646        protected MarkdownType description;
4647
4648        /**
4649         * Refers to the value set that identifies the set of codes the binding refers to.
4650         */
4651        @Child(name = "valueSet", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4652        @Description(shortDefinition="Source of value set", formalDefinition="Refers to the value set that identifies the set of codes the binding refers to." )
4653        protected CanonicalType valueSet;
4654
4655        /**
4656         * Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.
4657         */
4658        @Child(name = "additional", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4659        @Description(shortDefinition="Additional Bindings - more rules about the binding", formalDefinition="Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context." )
4660        protected List<ElementDefinitionBindingAdditionalComponent> additional;
4661
4662        private static final long serialVersionUID = 16276611L;
4663
4664    /**
4665     * Constructor
4666     */
4667      public ElementDefinitionBindingComponent() {
4668        super();
4669      }
4670
4671    /**
4672     * Constructor
4673     */
4674      public ElementDefinitionBindingComponent(BindingStrength strength) {
4675        super();
4676        this.setStrength(strength);
4677      }
4678
4679        /**
4680         * @return {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
4681         */
4682        public Enumeration<BindingStrength> getStrengthElement() { 
4683          if (this.strength == null)
4684            if (Configuration.errorOnAutoCreate())
4685              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
4686            else if (Configuration.doAutoCreate())
4687              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
4688          return this.strength;
4689        }
4690
4691        public boolean hasStrengthElement() { 
4692          return this.strength != null && !this.strength.isEmpty();
4693        }
4694
4695        public boolean hasStrength() { 
4696          return this.strength != null && !this.strength.isEmpty();
4697        }
4698
4699        /**
4700         * @param value {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
4701         */
4702        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
4703          this.strength = value;
4704          return this;
4705        }
4706
4707        /**
4708         * @return Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4709         */
4710        public BindingStrength getStrength() { 
4711          return this.strength == null ? null : this.strength.getValue();
4712        }
4713
4714        /**
4715         * @param value Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4716         */
4717        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
4718            if (this.strength == null)
4719              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
4720            this.strength.setValue(value);
4721          return this;
4722        }
4723
4724        /**
4725         * @return {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4726         */
4727        public MarkdownType getDescriptionElement() { 
4728          if (this.description == null)
4729            if (Configuration.errorOnAutoCreate())
4730              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
4731            else if (Configuration.doAutoCreate())
4732              this.description = new MarkdownType(); // bb
4733          return this.description;
4734        }
4735
4736        public boolean hasDescriptionElement() { 
4737          return this.description != null && !this.description.isEmpty();
4738        }
4739
4740        public boolean hasDescription() { 
4741          return this.description != null && !this.description.isEmpty();
4742        }
4743
4744        /**
4745         * @param value {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4746         */
4747        public ElementDefinitionBindingComponent setDescriptionElement(MarkdownType value) { 
4748          this.description = value;
4749          return this;
4750        }
4751
4752        /**
4753         * @return Describes the intended use of this particular set of codes.
4754         */
4755        public String getDescription() { 
4756          return this.description == null ? null : this.description.getValue();
4757        }
4758
4759        /**
4760         * @param value Describes the intended use of this particular set of codes.
4761         */
4762        public ElementDefinitionBindingComponent setDescription(String value) { 
4763          if (Utilities.noString(value))
4764            this.description = null;
4765          else {
4766            if (this.description == null)
4767              this.description = new MarkdownType();
4768            this.description.setValue(value);
4769          }
4770          return this;
4771        }
4772
4773        /**
4774         * @return {@link #valueSet} (Refers to the value set that identifies the set of codes the binding refers to.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
4775         */
4776        public CanonicalType getValueSetElement() { 
4777          if (this.valueSet == null)
4778            if (Configuration.errorOnAutoCreate())
4779              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.valueSet");
4780            else if (Configuration.doAutoCreate())
4781              this.valueSet = new CanonicalType(); // bb
4782          return this.valueSet;
4783        }
4784
4785        public boolean hasValueSetElement() { 
4786          return this.valueSet != null && !this.valueSet.isEmpty();
4787        }
4788
4789        public boolean hasValueSet() { 
4790          return this.valueSet != null && !this.valueSet.isEmpty();
4791        }
4792
4793        /**
4794         * @param value {@link #valueSet} (Refers to the value set that identifies the set of codes the binding refers to.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
4795         */
4796        public ElementDefinitionBindingComponent setValueSetElement(CanonicalType value) { 
4797          this.valueSet = value;
4798          return this;
4799        }
4800
4801        /**
4802         * @return Refers to the value set that identifies the set of codes the binding refers to.
4803         */
4804        public String getValueSet() { 
4805          return this.valueSet == null ? null : this.valueSet.getValue();
4806        }
4807
4808        /**
4809         * @param value Refers to the value set that identifies the set of codes the binding refers to.
4810         */
4811        public ElementDefinitionBindingComponent setValueSet(String value) { 
4812          if (Utilities.noString(value))
4813            this.valueSet = null;
4814          else {
4815            if (this.valueSet == null)
4816              this.valueSet = new CanonicalType();
4817            this.valueSet.setValue(value);
4818          }
4819          return this;
4820        }
4821
4822        /**
4823         * @return {@link #additional} (Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.)
4824         */
4825        public List<ElementDefinitionBindingAdditionalComponent> getAdditional() { 
4826          if (this.additional == null)
4827            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4828          return this.additional;
4829        }
4830
4831        /**
4832         * @return Returns a reference to <code>this</code> for easy method chaining
4833         */
4834        public ElementDefinitionBindingComponent setAdditional(List<ElementDefinitionBindingAdditionalComponent> theAdditional) { 
4835          this.additional = theAdditional;
4836          return this;
4837        }
4838
4839        public boolean hasAdditional() { 
4840          if (this.additional == null)
4841            return false;
4842          for (ElementDefinitionBindingAdditionalComponent item : this.additional)
4843            if (!item.isEmpty())
4844              return true;
4845          return false;
4846        }
4847
4848        public ElementDefinitionBindingAdditionalComponent addAdditional() { //3
4849          ElementDefinitionBindingAdditionalComponent t = new ElementDefinitionBindingAdditionalComponent();
4850          if (this.additional == null)
4851            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4852          this.additional.add(t);
4853          return t;
4854        }
4855
4856        public ElementDefinitionBindingComponent addAdditional(ElementDefinitionBindingAdditionalComponent t) { //3
4857          if (t == null)
4858            return this;
4859          if (this.additional == null)
4860            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4861          this.additional.add(t);
4862          return this;
4863        }
4864
4865        /**
4866         * @return The first repetition of repeating field {@link #additional}, creating it if it does not already exist {3}
4867         */
4868        public ElementDefinitionBindingAdditionalComponent getAdditionalFirstRep() { 
4869          if (getAdditional().isEmpty()) {
4870            addAdditional();
4871          }
4872          return getAdditional().get(0);
4873        }
4874
4875        protected void listChildren(List<Property> children) {
4876          super.listChildren(children);
4877          children.add(new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, 1, strength));
4878          children.add(new Property("description", "markdown", "Describes the intended use of this particular set of codes.", 0, 1, description));
4879          children.add(new Property("valueSet", "canonical(ValueSet)", "Refers to the value set that identifies the set of codes the binding refers to.", 0, 1, valueSet));
4880          children.add(new Property("additional", "", "Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.", 0, java.lang.Integer.MAX_VALUE, additional));
4881        }
4882
4883        @Override
4884        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4885          switch (_hash) {
4886          case 1791316033: /*strength*/  return new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, 1, strength);
4887          case -1724546052: /*description*/  return new Property("description", "markdown", "Describes the intended use of this particular set of codes.", 0, 1, description);
4888          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "Refers to the value set that identifies the set of codes the binding refers to.", 0, 1, valueSet);
4889          case -1931413465: /*additional*/  return new Property("additional", "", "Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.", 0, java.lang.Integer.MAX_VALUE, additional);
4890          default: return super.getNamedProperty(_hash, _name, _checkValid);
4891          }
4892
4893        }
4894
4895      @Override
4896      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4897        switch (hash) {
4898        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Enumeration<BindingStrength>
4899        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4900        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
4901        case -1931413465: /*additional*/ return this.additional == null ? new Base[0] : this.additional.toArray(new Base[this.additional.size()]); // ElementDefinitionBindingAdditionalComponent
4902        default: return super.getProperty(hash, name, checkValid);
4903        }
4904
4905      }
4906
4907      @Override
4908      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4909        switch (hash) {
4910        case 1791316033: // strength
4911          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4912          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4913          return value;
4914        case -1724546052: // description
4915          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4916          return value;
4917        case -1410174671: // valueSet
4918          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4919          return value;
4920        case -1931413465: // additional
4921          this.getAdditional().add((ElementDefinitionBindingAdditionalComponent) value); // ElementDefinitionBindingAdditionalComponent
4922          return value;
4923        default: return super.setProperty(hash, name, value);
4924        }
4925
4926      }
4927
4928      @Override
4929      public Base setProperty(String name, Base value) throws FHIRException {
4930        if (name.equals("strength")) {
4931          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4932          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4933        } else if (name.equals("description")) {
4934          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4935        } else if (name.equals("valueSet")) {
4936          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4937        } else if (name.equals("additional")) {
4938          this.getAdditional().add((ElementDefinitionBindingAdditionalComponent) value);
4939        } else
4940          return super.setProperty(name, value);
4941        return value;
4942      }
4943
4944  @Override
4945  public void removeChild(String name, Base value) throws FHIRException {
4946        if (name.equals("strength")) {
4947          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4948          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4949        } else if (name.equals("description")) {
4950          this.description = null;
4951        } else if (name.equals("valueSet")) {
4952          this.valueSet = null;
4953        } else if (name.equals("additional")) {
4954          this.getAdditional().remove((ElementDefinitionBindingAdditionalComponent) value);
4955        } else
4956          super.removeChild(name, value);
4957        
4958      }
4959
4960      @Override
4961      public Base makeProperty(int hash, String name) throws FHIRException {
4962        switch (hash) {
4963        case 1791316033:  return getStrengthElement();
4964        case -1724546052:  return getDescriptionElement();
4965        case -1410174671:  return getValueSetElement();
4966        case -1931413465:  return addAdditional(); 
4967        default: return super.makeProperty(hash, name);
4968        }
4969
4970      }
4971
4972      @Override
4973      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4974        switch (hash) {
4975        case 1791316033: /*strength*/ return new String[] {"code"};
4976        case -1724546052: /*description*/ return new String[] {"markdown"};
4977        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
4978        case -1931413465: /*additional*/ return new String[] {};
4979        default: return super.getTypesForProperty(hash, name);
4980        }
4981
4982      }
4983
4984      @Override
4985      public Base addChild(String name) throws FHIRException {
4986        if (name.equals("strength")) {
4987          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.strength");
4988        }
4989        else if (name.equals("description")) {
4990          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.description");
4991        }
4992        else if (name.equals("valueSet")) {
4993          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.valueSet");
4994        }
4995        else if (name.equals("additional")) {
4996          return addAdditional();
4997        }
4998        else
4999          return super.addChild(name);
5000      }
5001
5002      public ElementDefinitionBindingComponent copy() {
5003        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
5004        copyValues(dst);
5005        return dst;
5006      }
5007
5008      public void copyValues(ElementDefinitionBindingComponent dst) {
5009        super.copyValues(dst);
5010        dst.strength = strength == null ? null : strength.copy();
5011        dst.description = description == null ? null : description.copy();
5012        dst.valueSet = valueSet == null ? null : valueSet.copy();
5013        if (additional != null) {
5014          dst.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
5015          for (ElementDefinitionBindingAdditionalComponent i : additional)
5016            dst.additional.add(i.copy());
5017        };
5018      }
5019
5020      @Override
5021      public boolean equalsDeep(Base other_) {
5022        if (!super.equalsDeep(other_))
5023          return false;
5024        if (!(other_ instanceof ElementDefinitionBindingComponent))
5025          return false;
5026        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
5027        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
5028           && compareDeep(valueSet, o.valueSet, true) && compareDeep(additional, o.additional, true);
5029      }
5030
5031      @Override
5032      public boolean equalsShallow(Base other_) {
5033        if (!super.equalsShallow(other_))
5034          return false;
5035        if (!(other_ instanceof ElementDefinitionBindingComponent))
5036          return false;
5037        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
5038        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
5039           && compareValues(valueSet, o.valueSet, true);
5040      }
5041
5042      public boolean isEmpty() {
5043        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(strength, description, valueSet
5044          , additional);
5045      }
5046
5047  public String fhirType() {
5048    return "ElementDefinition.binding";
5049
5050  }
5051
5052  public boolean hasAdditional(ElementDefinitionBindingAdditionalComponent ab) {
5053    if (hasAdditional()) {
5054      for (ElementDefinitionBindingAdditionalComponent t : getAdditional()) {
5055        if (Base.compareDeep(t, ab, false)) {
5056          return true;
5057        }
5058      }
5059    }
5060    return false;
5061  }
5062
5063  }
5064
5065    @Block()
5066    public static class ElementDefinitionBindingAdditionalComponent extends Element implements IBaseDatatypeElement {
5067        /**
5068         * The use of this additional binding.
5069         */
5070        @Child(name = "purpose", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
5071        @Description(shortDefinition="maximum | minimum | required | extensible | candidate | current | preferred | ui | starter | component", formalDefinition="The use of this additional binding." )
5072        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/additional-binding-purpose")
5073        protected Enumeration<AdditionalBindingPurposeVS> purpose;
5074
5075        /**
5076         * The valueSet that is being bound for the purpose.
5077         */
5078        @Child(name = "valueSet", type = {CanonicalType.class}, order=2, min=1, max=1, modifier=false, summary=true)
5079        @Description(shortDefinition="The value set for the additional binding", formalDefinition="The valueSet that is being bound for the purpose." )
5080        protected CanonicalType valueSet;
5081
5082        /**
5083         * Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
5084         */
5085        @Child(name = "documentation", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=true)
5086        @Description(shortDefinition="Documentation of the purpose of use of the binding", formalDefinition="Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used." )
5087        protected MarkdownType documentation;
5088
5089        /**
5090         * Concise documentation - for summary tables.
5091         */
5092        @Child(name = "shortDoco", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5093        @Description(shortDefinition="Concise documentation - for summary tables", formalDefinition="Concise documentation - for summary tables." )
5094        protected StringType shortDoco;
5095
5096        /**
5097         * Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.
5098         */
5099        @Child(name = "usage", type = {UsageContext.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5100        @Description(shortDefinition="Qualifies the usage - jurisdiction, gender, workflow status etc.", formalDefinition="Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling." )
5101        protected List<UsageContext> usage;
5102
5103        /**
5104         * Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
5105         */
5106        @Child(name = "any", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=true)
5107        @Description(shortDefinition="Whether binding can applies to all repeats, or just one", formalDefinition="Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat." )
5108        protected BooleanType any;
5109
5110        private static final long serialVersionUID = -1312796441L;
5111
5112    /**
5113     * Constructor
5114     */
5115      public ElementDefinitionBindingAdditionalComponent() {
5116        super();
5117      }
5118
5119    /**
5120     * Constructor
5121     */
5122      public ElementDefinitionBindingAdditionalComponent(AdditionalBindingPurposeVS purpose, String valueSet) {
5123        super();
5124        this.setPurpose(purpose);
5125        this.setValueSet(valueSet);
5126      }
5127
5128        /**
5129         * @return {@link #purpose} (The use of this additional binding.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5130         */
5131        public Enumeration<AdditionalBindingPurposeVS> getPurposeElement() { 
5132          if (this.purpose == null)
5133            if (Configuration.errorOnAutoCreate())
5134              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.purpose");
5135            else if (Configuration.doAutoCreate())
5136              this.purpose = new Enumeration<AdditionalBindingPurposeVS>(new AdditionalBindingPurposeVSEnumFactory()); // bb
5137          return this.purpose;
5138        }
5139
5140        public boolean hasPurposeElement() { 
5141          return this.purpose != null && !this.purpose.isEmpty();
5142        }
5143
5144        public boolean hasPurpose() { 
5145          return this.purpose != null && !this.purpose.isEmpty();
5146        }
5147
5148        /**
5149         * @param value {@link #purpose} (The use of this additional binding.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5150         */
5151        public ElementDefinitionBindingAdditionalComponent setPurposeElement(Enumeration<AdditionalBindingPurposeVS> value) { 
5152          this.purpose = value;
5153          return this;
5154        }
5155
5156        /**
5157         * @return The use of this additional binding.
5158         */
5159        public AdditionalBindingPurposeVS getPurpose() { 
5160          return this.purpose == null ? null : this.purpose.getValue();
5161        }
5162
5163        /**
5164         * @param value The use of this additional binding.
5165         */
5166        public ElementDefinitionBindingAdditionalComponent setPurpose(AdditionalBindingPurposeVS value) { 
5167            if (this.purpose == null)
5168              this.purpose = new Enumeration<AdditionalBindingPurposeVS>(new AdditionalBindingPurposeVSEnumFactory());
5169            this.purpose.setValue(value);
5170          return this;
5171        }
5172
5173        /**
5174         * @return {@link #valueSet} (The valueSet that is being bound for the purpose.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
5175         */
5176        public CanonicalType getValueSetElement() { 
5177          if (this.valueSet == null)
5178            if (Configuration.errorOnAutoCreate())
5179              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.valueSet");
5180            else if (Configuration.doAutoCreate())
5181              this.valueSet = new CanonicalType(); // bb
5182          return this.valueSet;
5183        }
5184
5185        public boolean hasValueSetElement() { 
5186          return this.valueSet != null && !this.valueSet.isEmpty();
5187        }
5188
5189        public boolean hasValueSet() { 
5190          return this.valueSet != null && !this.valueSet.isEmpty();
5191        }
5192
5193        /**
5194         * @param value {@link #valueSet} (The valueSet that is being bound for the purpose.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
5195         */
5196        public ElementDefinitionBindingAdditionalComponent setValueSetElement(CanonicalType value) { 
5197          this.valueSet = value;
5198          return this;
5199        }
5200
5201        /**
5202         * @return The valueSet that is being bound for the purpose.
5203         */
5204        public String getValueSet() { 
5205          return this.valueSet == null ? null : this.valueSet.getValue();
5206        }
5207
5208        /**
5209         * @param value The valueSet that is being bound for the purpose.
5210         */
5211        public ElementDefinitionBindingAdditionalComponent setValueSet(String value) { 
5212            if (this.valueSet == null)
5213              this.valueSet = new CanonicalType();
5214            this.valueSet.setValue(value);
5215          return this;
5216        }
5217
5218        /**
5219         * @return {@link #documentation} (Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
5220         */
5221        public MarkdownType getDocumentationElement() { 
5222          if (this.documentation == null)
5223            if (Configuration.errorOnAutoCreate())
5224              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.documentation");
5225            else if (Configuration.doAutoCreate())
5226              this.documentation = new MarkdownType(); // bb
5227          return this.documentation;
5228        }
5229
5230        public boolean hasDocumentationElement() { 
5231          return this.documentation != null && !this.documentation.isEmpty();
5232        }
5233
5234        public boolean hasDocumentation() { 
5235          return this.documentation != null && !this.documentation.isEmpty();
5236        }
5237
5238        /**
5239         * @param value {@link #documentation} (Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
5240         */
5241        public ElementDefinitionBindingAdditionalComponent setDocumentationElement(MarkdownType value) { 
5242          this.documentation = value;
5243          return this;
5244        }
5245
5246        /**
5247         * @return Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
5248         */
5249        public String getDocumentation() { 
5250          return this.documentation == null ? null : this.documentation.getValue();
5251        }
5252
5253        /**
5254         * @param value Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
5255         */
5256        public ElementDefinitionBindingAdditionalComponent setDocumentation(String value) { 
5257          if (Utilities.noString(value))
5258            this.documentation = null;
5259          else {
5260            if (this.documentation == null)
5261              this.documentation = new MarkdownType();
5262            this.documentation.setValue(value);
5263          }
5264          return this;
5265        }
5266
5267        /**
5268         * @return {@link #shortDoco} (Concise documentation - for summary tables.). This is the underlying object with id, value and extensions. The accessor "getShortDoco" gives direct access to the value
5269         */
5270        public StringType getShortDocoElement() { 
5271          if (this.shortDoco == null)
5272            if (Configuration.errorOnAutoCreate())
5273              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.shortDoco");
5274            else if (Configuration.doAutoCreate())
5275              this.shortDoco = new StringType(); // bb
5276          return this.shortDoco;
5277        }
5278
5279        public boolean hasShortDocoElement() { 
5280          return this.shortDoco != null && !this.shortDoco.isEmpty();
5281        }
5282
5283        public boolean hasShortDoco() { 
5284          return this.shortDoco != null && !this.shortDoco.isEmpty();
5285        }
5286
5287        /**
5288         * @param value {@link #shortDoco} (Concise documentation - for summary tables.). This is the underlying object with id, value and extensions. The accessor "getShortDoco" gives direct access to the value
5289         */
5290        public ElementDefinitionBindingAdditionalComponent setShortDocoElement(StringType value) { 
5291          this.shortDoco = value;
5292          return this;
5293        }
5294
5295        /**
5296         * @return Concise documentation - for summary tables.
5297         */
5298        public String getShortDoco() { 
5299          return this.shortDoco == null ? null : this.shortDoco.getValue();
5300        }
5301
5302        /**
5303         * @param value Concise documentation - for summary tables.
5304         */
5305        public ElementDefinitionBindingAdditionalComponent setShortDoco(String value) { 
5306          if (Utilities.noString(value))
5307            this.shortDoco = null;
5308          else {
5309            if (this.shortDoco == null)
5310              this.shortDoco = new StringType();
5311            this.shortDoco.setValue(value);
5312          }
5313          return this;
5314        }
5315
5316        /**
5317         * @return {@link #usage} (Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.)
5318         */
5319        public List<UsageContext> getUsage() { 
5320          if (this.usage == null)
5321            this.usage = new ArrayList<UsageContext>();
5322          return this.usage;
5323        }
5324
5325        /**
5326         * @return Returns a reference to <code>this</code> for easy method chaining
5327         */
5328        public ElementDefinitionBindingAdditionalComponent setUsage(List<UsageContext> theUsage) { 
5329          this.usage = theUsage;
5330          return this;
5331        }
5332
5333        public boolean hasUsage() { 
5334          if (this.usage == null)
5335            return false;
5336          for (UsageContext item : this.usage)
5337            if (!item.isEmpty())
5338              return true;
5339          return false;
5340        }
5341
5342        public UsageContext addUsage() { //3
5343          UsageContext t = new UsageContext();
5344          if (this.usage == null)
5345            this.usage = new ArrayList<UsageContext>();
5346          this.usage.add(t);
5347          return t;
5348        }
5349
5350        public ElementDefinitionBindingAdditionalComponent addUsage(UsageContext t) { //3
5351          if (t == null)
5352            return this;
5353          if (this.usage == null)
5354            this.usage = new ArrayList<UsageContext>();
5355          this.usage.add(t);
5356          return this;
5357        }
5358
5359        /**
5360         * @return The first repetition of repeating field {@link #usage}, creating it if it does not already exist {3}
5361         */
5362        public UsageContext getUsageFirstRep() { 
5363          if (getUsage().isEmpty()) {
5364            addUsage();
5365          }
5366          return getUsage().get(0);
5367        }
5368
5369        /**
5370         * @return {@link #any} (Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.). This is the underlying object with id, value and extensions. The accessor "getAny" gives direct access to the value
5371         */
5372        public BooleanType getAnyElement() { 
5373          if (this.any == null)
5374            if (Configuration.errorOnAutoCreate())
5375              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.any");
5376            else if (Configuration.doAutoCreate())
5377              this.any = new BooleanType(); // bb
5378          return this.any;
5379        }
5380
5381        public boolean hasAnyElement() { 
5382          return this.any != null && !this.any.isEmpty();
5383        }
5384
5385        public boolean hasAny() { 
5386          return this.any != null && !this.any.isEmpty();
5387        }
5388
5389        /**
5390         * @param value {@link #any} (Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.). This is the underlying object with id, value and extensions. The accessor "getAny" gives direct access to the value
5391         */
5392        public ElementDefinitionBindingAdditionalComponent setAnyElement(BooleanType value) { 
5393          this.any = value;
5394          return this;
5395        }
5396
5397        /**
5398         * @return Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
5399         */
5400        public boolean getAny() { 
5401          return this.any == null || this.any.isEmpty() ? false : this.any.getValue();
5402        }
5403
5404        /**
5405         * @param value Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
5406         */
5407        public ElementDefinitionBindingAdditionalComponent setAny(boolean value) { 
5408            if (this.any == null)
5409              this.any = new BooleanType();
5410            this.any.setValue(value);
5411          return this;
5412        }
5413
5414        protected void listChildren(List<Property> children) {
5415          super.listChildren(children);
5416          children.add(new Property("purpose", "code", "The use of this additional binding.", 0, 1, purpose));
5417          children.add(new Property("valueSet", "canonical(ValueSet)", "The valueSet that is being bound for the purpose.", 0, 1, valueSet));
5418          children.add(new Property("documentation", "markdown", "Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.", 0, 1, documentation));
5419          children.add(new Property("shortDoco", "string", "Concise documentation - for summary tables.", 0, 1, shortDoco));
5420          children.add(new Property("usage", "UsageContext", "Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.", 0, java.lang.Integer.MAX_VALUE, usage));
5421          children.add(new Property("any", "boolean", "Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.", 0, 1, any));
5422        }
5423
5424        @Override
5425        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5426          switch (_hash) {
5427          case -220463842: /*purpose*/  return new Property("purpose", "code", "The use of this additional binding.", 0, 1, purpose);
5428          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "The valueSet that is being bound for the purpose.", 0, 1, valueSet);
5429          case 1587405498: /*documentation*/  return new Property("documentation", "markdown", "Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.", 0, 1, documentation);
5430          case -2028503853: /*shortDoco*/  return new Property("shortDoco", "string", "Concise documentation - for summary tables.", 0, 1, shortDoco);
5431          case 111574433: /*usage*/  return new Property("usage", "UsageContext", "Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.", 0, java.lang.Integer.MAX_VALUE, usage);
5432          case 96748: /*any*/  return new Property("any", "boolean", "Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.", 0, 1, any);
5433          default: return super.getNamedProperty(_hash, _name, _checkValid);
5434          }
5435
5436        }
5437
5438      @Override
5439      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5440        switch (hash) {
5441        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // Enumeration<AdditionalBindingPurposeVS>
5442        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
5443        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // MarkdownType
5444        case -2028503853: /*shortDoco*/ return this.shortDoco == null ? new Base[0] : new Base[] {this.shortDoco}; // StringType
5445        case 111574433: /*usage*/ return this.usage == null ? new Base[0] : this.usage.toArray(new Base[this.usage.size()]); // UsageContext
5446        case 96748: /*any*/ return this.any == null ? new Base[0] : new Base[] {this.any}; // BooleanType
5447        default: return super.getProperty(hash, name, checkValid);
5448        }
5449
5450      }
5451
5452      @Override
5453      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5454        switch (hash) {
5455        case -220463842: // purpose
5456          value = new AdditionalBindingPurposeVSEnumFactory().fromType(TypeConvertor.castToCode(value));
5457          this.purpose = (Enumeration) value; // Enumeration<AdditionalBindingPurposeVS>
5458          return value;
5459        case -1410174671: // valueSet
5460          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
5461          return value;
5462        case 1587405498: // documentation
5463          this.documentation = TypeConvertor.castToMarkdown(value); // MarkdownType
5464          return value;
5465        case -2028503853: // shortDoco
5466          this.shortDoco = TypeConvertor.castToString(value); // StringType
5467          return value;
5468        case 111574433: // usage
5469          this.getUsage().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5470          return value;
5471        case 96748: // any
5472          this.any = TypeConvertor.castToBoolean(value); // BooleanType
5473          return value;
5474        default: return super.setProperty(hash, name, value);
5475        }
5476
5477      }
5478
5479      @Override
5480      public Base setProperty(String name, Base value) throws FHIRException {
5481        if (name.equals("purpose")) {
5482          value = new AdditionalBindingPurposeVSEnumFactory().fromType(TypeConvertor.castToCode(value));
5483          this.purpose = (Enumeration) value; // Enumeration<AdditionalBindingPurposeVS>
5484        } else if (name.equals("valueSet")) {
5485          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
5486        } else if (name.equals("documentation")) {
5487          this.documentation = TypeConvertor.castToMarkdown(value); // MarkdownType
5488        } else if (name.equals("shortDoco")) {
5489          this.shortDoco = TypeConvertor.castToString(value); // StringType
5490        } else if (name.equals("usage")) {
5491          this.getUsage().add(TypeConvertor.castToUsageContext(value));
5492        } else if (name.equals("any")) {
5493          this.any = TypeConvertor.castToBoolean(value); // BooleanType
5494        } else
5495          return super.setProperty(name, value);
5496        return value;
5497      }
5498
5499  @Override
5500  public void removeChild(String name, Base value) throws FHIRException {
5501        if (name.equals("purpose")) {
5502          value = new AdditionalBindingPurposeVSEnumFactory().fromType(TypeConvertor.castToCode(value));
5503          this.purpose = (Enumeration) value; // Enumeration<AdditionalBindingPurposeVS>
5504        } else if (name.equals("valueSet")) {
5505          this.valueSet = null;
5506        } else if (name.equals("documentation")) {
5507          this.documentation = null;
5508        } else if (name.equals("shortDoco")) {
5509          this.shortDoco = null;
5510        } else if (name.equals("usage")) {
5511          this.getUsage().remove(value);
5512        } else if (name.equals("any")) {
5513          this.any = null;
5514        } else
5515          super.removeChild(name, value);
5516        
5517      }
5518
5519      @Override
5520      public Base makeProperty(int hash, String name) throws FHIRException {
5521        switch (hash) {
5522        case -220463842:  return getPurposeElement();
5523        case -1410174671:  return getValueSetElement();
5524        case 1587405498:  return getDocumentationElement();
5525        case -2028503853:  return getShortDocoElement();
5526        case 111574433:  return addUsage(); 
5527        case 96748:  return getAnyElement();
5528        default: return super.makeProperty(hash, name);
5529        }
5530
5531      }
5532
5533      @Override
5534      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5535        switch (hash) {
5536        case -220463842: /*purpose*/ return new String[] {"code"};
5537        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
5538        case 1587405498: /*documentation*/ return new String[] {"markdown"};
5539        case -2028503853: /*shortDoco*/ return new String[] {"string"};
5540        case 111574433: /*usage*/ return new String[] {"UsageContext"};
5541        case 96748: /*any*/ return new String[] {"boolean"};
5542        default: return super.getTypesForProperty(hash, name);
5543        }
5544
5545      }
5546
5547      @Override
5548      public Base addChild(String name) throws FHIRException {
5549        if (name.equals("purpose")) {
5550          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.purpose");
5551        }
5552        else if (name.equals("valueSet")) {
5553          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.valueSet");
5554        }
5555        else if (name.equals("documentation")) {
5556          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.documentation");
5557        }
5558        else if (name.equals("shortDoco")) {
5559          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.shortDoco");
5560        }
5561        else if (name.equals("usage")) {
5562          return addUsage();
5563        }
5564        else if (name.equals("any")) {
5565          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.any");
5566        }
5567        else
5568          return super.addChild(name);
5569      }
5570
5571      public ElementDefinitionBindingAdditionalComponent copy() {
5572        ElementDefinitionBindingAdditionalComponent dst = new ElementDefinitionBindingAdditionalComponent();
5573        copyValues(dst);
5574        return dst;
5575      }
5576
5577      public void copyValues(ElementDefinitionBindingAdditionalComponent dst) {
5578        super.copyValues(dst);
5579        dst.purpose = purpose == null ? null : purpose.copy();
5580        dst.valueSet = valueSet == null ? null : valueSet.copy();
5581        dst.documentation = documentation == null ? null : documentation.copy();
5582        dst.shortDoco = shortDoco == null ? null : shortDoco.copy();
5583        if (usage != null) {
5584          dst.usage = new ArrayList<UsageContext>();
5585          for (UsageContext i : usage)
5586            dst.usage.add(i.copy());
5587        };
5588        dst.any = any == null ? null : any.copy();
5589      }
5590
5591      @Override
5592      public boolean equalsDeep(Base other_) {
5593        if (!super.equalsDeep(other_))
5594          return false;
5595        if (!(other_ instanceof ElementDefinitionBindingAdditionalComponent))
5596          return false;
5597        ElementDefinitionBindingAdditionalComponent o = (ElementDefinitionBindingAdditionalComponent) other_;
5598        return compareDeep(purpose, o.purpose, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(documentation, o.documentation, true)
5599           && compareDeep(shortDoco, o.shortDoco, true) && compareDeep(usage, o.usage, true) && compareDeep(any, o.any, true)
5600          ;
5601      }
5602
5603      @Override
5604      public boolean equalsShallow(Base other_) {
5605        if (!super.equalsShallow(other_))
5606          return false;
5607        if (!(other_ instanceof ElementDefinitionBindingAdditionalComponent))
5608          return false;
5609        ElementDefinitionBindingAdditionalComponent o = (ElementDefinitionBindingAdditionalComponent) other_;
5610        return compareValues(purpose, o.purpose, true) && compareValues(valueSet, o.valueSet, true) && compareValues(documentation, o.documentation, true)
5611           && compareValues(shortDoco, o.shortDoco, true) && compareValues(any, o.any, true);
5612      }
5613
5614      public boolean isEmpty() {
5615        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(purpose, valueSet, documentation
5616          , shortDoco, usage, any);
5617      }
5618
5619  public String fhirType() {
5620    return "ElementDefinition.binding.additional";
5621
5622  }
5623
5624  }
5625
5626    @Block()
5627    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
5628        @Override
5629      public String toString() {
5630        return identity+"=" + map;
5631      }
5632
5633        /**
5634         * An internal reference to the definition of a mapping.
5635         */
5636        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
5637        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
5638        protected IdType identity;
5639
5640        /**
5641         * Identifies the computable language in which mapping.map is expressed.
5642         */
5643        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5644        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
5645        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
5646        protected CodeType language;
5647
5648        /**
5649         * Expresses what part of the target specification corresponds to this element.
5650         */
5651        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
5652        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
5653        protected StringType map;
5654
5655        /**
5656         * Comments that provide information about the mapping or its use.
5657         */
5658        @Child(name = "comment", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5659        @Description(shortDefinition="Comments about the mapping or its use", formalDefinition="Comments that provide information about the mapping or its use." )
5660        protected MarkdownType comment;
5661
5662        private static final long serialVersionUID = -582458727L;
5663
5664    /**
5665     * Constructor
5666     */
5667      public ElementDefinitionMappingComponent() {
5668        super();
5669      }
5670
5671    /**
5672     * Constructor
5673     */
5674      public ElementDefinitionMappingComponent(String identity, String map) {
5675        super();
5676        this.setIdentity(identity);
5677        this.setMap(map);
5678      }
5679
5680        /**
5681         * @return {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
5682         */
5683        public IdType getIdentityElement() { 
5684          if (this.identity == null)
5685            if (Configuration.errorOnAutoCreate())
5686              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
5687            else if (Configuration.doAutoCreate())
5688              this.identity = new IdType(); // bb
5689          return this.identity;
5690        }
5691
5692        public boolean hasIdentityElement() { 
5693          return this.identity != null && !this.identity.isEmpty();
5694        }
5695
5696        public boolean hasIdentity() { 
5697          return this.identity != null && !this.identity.isEmpty();
5698        }
5699
5700        /**
5701         * @param value {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
5702         */
5703        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
5704          this.identity = value;
5705          return this;
5706        }
5707
5708        /**
5709         * @return An internal reference to the definition of a mapping.
5710         */
5711        public String getIdentity() { 
5712          return this.identity == null ? null : this.identity.getValue();
5713        }
5714
5715        /**
5716         * @param value An internal reference to the definition of a mapping.
5717         */
5718        public ElementDefinitionMappingComponent setIdentity(String value) { 
5719            if (this.identity == null)
5720              this.identity = new IdType();
5721            this.identity.setValue(value);
5722          return this;
5723        }
5724
5725        /**
5726         * @return {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
5727         */
5728        public CodeType getLanguageElement() { 
5729          if (this.language == null)
5730            if (Configuration.errorOnAutoCreate())
5731              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
5732            else if (Configuration.doAutoCreate())
5733              this.language = new CodeType(); // bb
5734          return this.language;
5735        }
5736
5737        public boolean hasLanguageElement() { 
5738          return this.language != null && !this.language.isEmpty();
5739        }
5740
5741        public boolean hasLanguage() { 
5742          return this.language != null && !this.language.isEmpty();
5743        }
5744
5745        /**
5746         * @param value {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
5747         */
5748        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
5749          this.language = value;
5750          return this;
5751        }
5752
5753        /**
5754         * @return Identifies the computable language in which mapping.map is expressed.
5755         */
5756        public String getLanguage() { 
5757          return this.language == null ? null : this.language.getValue();
5758        }
5759
5760        /**
5761         * @param value Identifies the computable language in which mapping.map is expressed.
5762         */
5763        public ElementDefinitionMappingComponent setLanguage(String value) { 
5764          if (Utilities.noString(value))
5765            this.language = null;
5766          else {
5767            if (this.language == null)
5768              this.language = new CodeType();
5769            this.language.setValue(value);
5770          }
5771          return this;
5772        }
5773
5774        /**
5775         * @return {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
5776         */
5777        public StringType getMapElement() { 
5778          if (this.map == null)
5779            if (Configuration.errorOnAutoCreate())
5780              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
5781            else if (Configuration.doAutoCreate())
5782              this.map = new StringType(); // bb
5783          return this.map;
5784        }
5785
5786        public boolean hasMapElement() { 
5787          return this.map != null && !this.map.isEmpty();
5788        }
5789
5790        public boolean hasMap() { 
5791          return this.map != null && !this.map.isEmpty();
5792        }
5793
5794        /**
5795         * @param value {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
5796         */
5797        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
5798          this.map = value;
5799          return this;
5800        }
5801
5802        /**
5803         * @return Expresses what part of the target specification corresponds to this element.
5804         */
5805        public String getMap() { 
5806          return this.map == null ? null : this.map.getValue();
5807        }
5808
5809        /**
5810         * @param value Expresses what part of the target specification corresponds to this element.
5811         */
5812        public ElementDefinitionMappingComponent setMap(String value) { 
5813            if (this.map == null)
5814              this.map = new StringType();
5815            this.map.setValue(value);
5816          return this;
5817        }
5818
5819        /**
5820         * @return {@link #comment} (Comments that provide information about the mapping or its use.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
5821         */
5822        public MarkdownType getCommentElement() { 
5823          if (this.comment == null)
5824            if (Configuration.errorOnAutoCreate())
5825              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.comment");
5826            else if (Configuration.doAutoCreate())
5827              this.comment = new MarkdownType(); // bb
5828          return this.comment;
5829        }
5830
5831        public boolean hasCommentElement() { 
5832          return this.comment != null && !this.comment.isEmpty();
5833        }
5834
5835        public boolean hasComment() { 
5836          return this.comment != null && !this.comment.isEmpty();
5837        }
5838
5839        /**
5840         * @param value {@link #comment} (Comments that provide information about the mapping or its use.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
5841         */
5842        public ElementDefinitionMappingComponent setCommentElement(MarkdownType value) { 
5843          this.comment = value;
5844          return this;
5845        }
5846
5847        /**
5848         * @return Comments that provide information about the mapping or its use.
5849         */
5850        public String getComment() { 
5851          return this.comment == null ? null : this.comment.getValue();
5852        }
5853
5854        /**
5855         * @param value Comments that provide information about the mapping or its use.
5856         */
5857        public ElementDefinitionMappingComponent setComment(String value) { 
5858          if (Utilities.noString(value))
5859            this.comment = null;
5860          else {
5861            if (this.comment == null)
5862              this.comment = new MarkdownType();
5863            this.comment.setValue(value);
5864          }
5865          return this;
5866        }
5867
5868        protected void listChildren(List<Property> children) {
5869          super.listChildren(children);
5870          children.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity));
5871          children.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language));
5872          children.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map));
5873          children.add(new Property("comment", "markdown", "Comments that provide information about the mapping or its use.", 0, 1, comment));
5874        }
5875
5876        @Override
5877        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5878          switch (_hash) {
5879          case -135761730: /*identity*/  return new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity);
5880          case -1613589672: /*language*/  return new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language);
5881          case 107868: /*map*/  return new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map);
5882          case 950398559: /*comment*/  return new Property("comment", "markdown", "Comments that provide information about the mapping or its use.", 0, 1, comment);
5883          default: return super.getNamedProperty(_hash, _name, _checkValid);
5884          }
5885
5886        }
5887
5888      @Override
5889      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5890        switch (hash) {
5891        case -135761730: /*identity*/ return this.identity == null ? new Base[0] : new Base[] {this.identity}; // IdType
5892        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
5893        case 107868: /*map*/ return this.map == null ? new Base[0] : new Base[] {this.map}; // StringType
5894        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // MarkdownType
5895        default: return super.getProperty(hash, name, checkValid);
5896        }
5897
5898      }
5899
5900      @Override
5901      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5902        switch (hash) {
5903        case -135761730: // identity
5904          this.identity = TypeConvertor.castToId(value); // IdType
5905          return value;
5906        case -1613589672: // language
5907          this.language = TypeConvertor.castToCode(value); // CodeType
5908          return value;
5909        case 107868: // map
5910          this.map = TypeConvertor.castToString(value); // StringType
5911          return value;
5912        case 950398559: // comment
5913          this.comment = TypeConvertor.castToMarkdown(value); // MarkdownType
5914          return value;
5915        default: return super.setProperty(hash, name, value);
5916        }
5917
5918      }
5919
5920      @Override
5921      public Base setProperty(String name, Base value) throws FHIRException {
5922        if (name.equals("identity")) {
5923          this.identity = TypeConvertor.castToId(value); // IdType
5924        } else if (name.equals("language")) {
5925          this.language = TypeConvertor.castToCode(value); // CodeType
5926        } else if (name.equals("map")) {
5927          this.map = TypeConvertor.castToString(value); // StringType
5928        } else if (name.equals("comment")) {
5929          this.comment = TypeConvertor.castToMarkdown(value); // MarkdownType
5930        } else
5931          return super.setProperty(name, value);
5932        return value;
5933      }
5934
5935  @Override
5936  public void removeChild(String name, Base value) throws FHIRException {
5937        if (name.equals("identity")) {
5938          this.identity = null;
5939        } else if (name.equals("language")) {
5940          this.language = null;
5941        } else if (name.equals("map")) {
5942          this.map = null;
5943        } else if (name.equals("comment")) {
5944          this.comment = null;
5945        } else
5946          super.removeChild(name, value);
5947        
5948      }
5949
5950      @Override
5951      public Base makeProperty(int hash, String name) throws FHIRException {
5952        switch (hash) {
5953        case -135761730:  return getIdentityElement();
5954        case -1613589672:  return getLanguageElement();
5955        case 107868:  return getMapElement();
5956        case 950398559:  return getCommentElement();
5957        default: return super.makeProperty(hash, name);
5958        }
5959
5960      }
5961
5962      @Override
5963      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5964        switch (hash) {
5965        case -135761730: /*identity*/ return new String[] {"id"};
5966        case -1613589672: /*language*/ return new String[] {"code"};
5967        case 107868: /*map*/ return new String[] {"string"};
5968        case 950398559: /*comment*/ return new String[] {"markdown"};
5969        default: return super.getTypesForProperty(hash, name);
5970        }
5971
5972      }
5973
5974      @Override
5975      public Base addChild(String name) throws FHIRException {
5976        if (name.equals("identity")) {
5977          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.identity");
5978        }
5979        else if (name.equals("language")) {
5980          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.language");
5981        }
5982        else if (name.equals("map")) {
5983          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.map");
5984        }
5985        else if (name.equals("comment")) {
5986          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.comment");
5987        }
5988        else
5989          return super.addChild(name);
5990      }
5991
5992      public ElementDefinitionMappingComponent copy() {
5993        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
5994        copyValues(dst);
5995        return dst;
5996      }
5997
5998      public void copyValues(ElementDefinitionMappingComponent dst) {
5999        super.copyValues(dst);
6000        dst.identity = identity == null ? null : identity.copy();
6001        dst.language = language == null ? null : language.copy();
6002        dst.map = map == null ? null : map.copy();
6003        dst.comment = comment == null ? null : comment.copy();
6004      }
6005
6006      @Override
6007      public boolean equalsDeep(Base other_) {
6008        if (!super.equalsDeep(other_))
6009          return false;
6010        if (!(other_ instanceof ElementDefinitionMappingComponent))
6011          return false;
6012        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
6013        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
6014           && compareDeep(comment, o.comment, true);
6015      }
6016
6017      @Override
6018      public boolean equalsShallow(Base other_) {
6019        if (!super.equalsShallow(other_))
6020          return false;
6021        if (!(other_ instanceof ElementDefinitionMappingComponent))
6022          return false;
6023        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
6024        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
6025           && compareValues(comment, o.comment, true);
6026      }
6027
6028      public boolean isEmpty() {
6029        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identity, language, map
6030          , comment);
6031      }
6032
6033  public String fhirType() {
6034    return "ElementDefinition.mapping";
6035
6036  }
6037
6038  }
6039
6040    /**
6041     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
6042     */
6043    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
6044    @Description(shortDefinition="Path of the element in the hierarchy of elements", formalDefinition="The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension." )
6045    protected StringType path;
6046
6047    /**
6048     * Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.
6049     */
6050    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6051    @Description(shortDefinition="xmlAttr | xmlText | typeAttr | cdaText | xhtml", formalDefinition="Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used." )
6052    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/property-representation")
6053    protected List<Enumeration<PropertyRepresentation>> representation;
6054
6055    /**
6056     * The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
6057     */
6058    @Child(name = "sliceName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
6059    @Description(shortDefinition="Name for this particular element (in a set of slices)", formalDefinition="The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element." )
6060    protected StringType sliceName;
6061
6062    /**
6063     * If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
6064     */
6065    @Child(name = "sliceIsConstraining", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
6066    @Description(shortDefinition="If this slice definition constrains an inherited slice definition (or not)", formalDefinition="If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName." )
6067    protected BooleanType sliceIsConstraining;
6068
6069    /**
6070     * A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
6071     */
6072    @Child(name = "label", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
6073    @Description(shortDefinition="Name for element to display with or prompt for element", formalDefinition="A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form." )
6074    protected StringType label;
6075
6076    /**
6077     * A code that has the same meaning as the element in a particular terminology.
6078     */
6079    @Child(name = "code", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6080    @Description(shortDefinition="Corresponding codes in terminologies", formalDefinition="A code that has the same meaning as the element in a particular terminology." )
6081    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://loinc.org/vs")
6082    protected List<Coding> code;
6083
6084    /**
6085     * Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).
6086     */
6087    @Child(name = "slicing", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
6088    @Description(shortDefinition="This element is sliced - slices follow", formalDefinition="Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set)." )
6089    protected ElementDefinitionSlicingComponent slicing;
6090
6091    /**
6092     * A concise description of what this element means (e.g. for use in autogenerated summaries).
6093     */
6094    @Child(name = "short", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
6095    @Description(shortDefinition="Concise definition for space-constrained presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
6096    protected StringType short_;
6097
6098    /**
6099     * Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
6100     */
6101    @Child(name = "definition", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
6102    @Description(shortDefinition="Full formal definition as narrative text", formalDefinition="Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition)." )
6103    protected MarkdownType definition;
6104
6105    /**
6106     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
6107     */
6108    @Child(name = "comment", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
6109    @Description(shortDefinition="Comments about the use of this element", formalDefinition="Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment)." )
6110    protected MarkdownType comment;
6111
6112    /**
6113     * This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
6114     */
6115    @Child(name = "requirements", type = {MarkdownType.class}, order=10, min=0, max=1, modifier=false, summary=true)
6116    @Description(shortDefinition="Why this resource has been created", formalDefinition="This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element." )
6117    protected MarkdownType requirements;
6118
6119    /**
6120     * Identifies additional names by which this element might also be known.
6121     */
6122    @Child(name = "alias", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6123    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
6124    protected List<StringType> alias;
6125
6126    /**
6127     * The minimum number of times this element SHALL appear in the instance.
6128     */
6129    @Child(name = "min", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
6130    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
6131    protected UnsignedIntType min;
6132
6133    /**
6134     * The maximum number of times this element is permitted to appear in the instance.
6135     */
6136    @Child(name = "max", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=true)
6137    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
6138    protected StringType max;
6139
6140    /**
6141     * Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.
6142     */
6143    @Child(name = "base", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
6144    @Description(shortDefinition="Base definition information for tools", formalDefinition="Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same." )
6145    protected ElementDefinitionBaseComponent base;
6146
6147    /**
6148     * Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
6149     */
6150    @Child(name = "contentReference", type = {UriType.class}, order=15, min=0, max=1, modifier=false, summary=true)
6151    @Description(shortDefinition="Reference to definition of content for the element", formalDefinition="Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc." )
6152    protected UriType contentReference;
6153
6154    /**
6155     * The data type or resource that the value of this element is permitted to be.
6156     */
6157    @Child(name = "type", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6158    @Description(shortDefinition="Data type and Profile for this element", formalDefinition="The data type or resource that the value of this element is permitted to be." )
6159    protected List<TypeRefComponent> type;
6160
6161    /**
6162     * The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').
6163     */
6164    @Child(name = "defaultValue", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=17, min=0, max=1, modifier=false, summary=true)
6165    @Description(shortDefinition="Specified value if missing from instance", formalDefinition="The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false')." )
6166    protected DataType defaultValue;
6167
6168    /**
6169     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
6170     */
6171    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=18, min=0, max=1, modifier=false, summary=true)
6172    @Description(shortDefinition="Implicit meaning when this element is missing", formalDefinition="The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing')." )
6173    protected MarkdownType meaningWhenMissing;
6174
6175    /**
6176     * If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
6177     */
6178    @Child(name = "orderMeaning", type = {StringType.class}, order=19, min=0, max=1, modifier=false, summary=true)
6179    @Description(shortDefinition="What the order of the elements means", formalDefinition="If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning." )
6180    protected StringType orderMeaning;
6181
6182    /**
6183     * Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.
6184     */
6185    @Child(name = "fixed", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=20, min=0, max=1, modifier=false, summary=true)
6186    @Description(shortDefinition="Value must be exactly this", formalDefinition="Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing." )
6187    protected DataType fixed;
6188
6189    /**
6190     * Specifies a value that each occurrence of the element in the instance SHALL follow - that is, any value in the pattern must be found in the instance, if the element has a value. Other additional values may be found too. This is effectively constraint by example.  
6191
6192When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
6193
6194When an element within a pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] must (recursively) match at least one element from the instance array.
6195
6196When pattern[x] is used to constrain a complex object, it means that each property in the pattern must be present in the complex object, and its value must recursively match -- i.e.,
6197
61981. If primitive: it must match exactly the pattern value
61992. If a complex object: it must match (recursively) the pattern value
62003. If an array: it must match (recursively) the pattern value
6201
6202If a pattern[x] is declared on a repeating element, the pattern applies to all repetitions.  If the desire is for a pattern to apply to only one element or a subset of elements, slicing must be used. See [Examples of Patterns](elementdefinition-examples.html#pattern-examples) for examples of pattern usage and the effect it will have.
6203     */
6204    @Child(name = "pattern", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=21, min=0, max=1, modifier=false, summary=true)
6205    @Description(shortDefinition="Value must have at least these property values", formalDefinition="Specifies a value that each occurrence of the element in the instance SHALL follow - that is, any value in the pattern must be found in the instance, if the element has a value. Other additional values may be found too. This is effectively constraint by example.  \n\nWhen pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.\n\nWhen an element within a pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] must (recursively) match at least one element from the instance array.\n\nWhen pattern[x] is used to constrain a complex object, it means that each property in the pattern must be present in the complex object, and its value must recursively match -- i.e.,\n\n1. If primitive: it must match exactly the pattern value\n2. If a complex object: it must match (recursively) the pattern value\n3. If an array: it must match (recursively) the pattern value\n\nIf a pattern[x] is declared on a repeating element, the pattern applies to all repetitions.  If the desire is for a pattern to apply to only one element or a subset of elements, slicing must be used. See [Examples of Patterns](elementdefinition-examples.html#pattern-examples) for examples of pattern usage and the effect it will have." )
6206    protected DataType pattern;
6207
6208    /**
6209     * A sample value for this element demonstrating the type of information that would typically be found in the element.
6210     */
6211    @Child(name = "example", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6212    @Description(shortDefinition="Example value (as defined for type)", formalDefinition="A sample value for this element demonstrating the type of information that would typically be found in the element." )
6213    protected List<ElementDefinitionExampleComponent> example;
6214
6215    /**
6216     * The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
6217     */
6218    @Child(name = "minValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, Integer64Type.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=23, min=0, max=1, modifier=false, summary=true)
6219    @Description(shortDefinition="Minimum Allowed Value (for some types)", formalDefinition="The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
6220    protected DataType minValue;
6221
6222    /**
6223     * The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
6224     */
6225    @Child(name = "maxValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, Integer64Type.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=24, min=0, max=1, modifier=false, summary=true)
6226    @Description(shortDefinition="Maximum Allowed Value (for some types)", formalDefinition="The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
6227    protected DataType maxValue;
6228
6229    /**
6230     * Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element. ```maxLength``` SHOULD only be used on primitive data types that have a string representation (see [http://hl7.org/fhir/StructureDefinition/structuredefinition-type-characteristics](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-structuredefinition-type-characteristics.html)).
6231     */
6232    @Child(name = "maxLength", type = {IntegerType.class}, order=25, min=0, max=1, modifier=false, summary=true)
6233    @Description(shortDefinition="Max length for string type data", formalDefinition="Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element. ```maxLength``` SHOULD only be used on primitive data types that have a string representation (see [http://hl7.org/fhir/StructureDefinition/structuredefinition-type-characteristics](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-structuredefinition-type-characteristics.html))." )
6234    protected IntegerType maxLength;
6235
6236    /**
6237     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
6238     */
6239    @Child(name = "condition", type = {IdType.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6240    @Description(shortDefinition="Reference to invariant about presence", formalDefinition="A reference to an invariant that may make additional statements about the cardinality or value in the instance." )
6241    protected List<IdType> condition;
6242
6243    /**
6244     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
6245     */
6246    @Child(name = "constraint", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6247    @Description(shortDefinition="Condition that must evaluate to true", formalDefinition="Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance." )
6248    protected List<ElementDefinitionConstraintComponent> constraint;
6249
6250    /**
6251     * Specifies for a primitive data type that the value of the data type cannot be replaced by an extension.
6252     */
6253    @Child(name = "mustHaveValue", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
6254    @Description(shortDefinition="For primitives, that a value must be present - not replaced by an extension", formalDefinition="Specifies for a primitive data type that the value of the data type cannot be replaced by an extension." )
6255    protected BooleanType mustHaveValue;
6256
6257    /**
6258     * Specifies a list of extensions that can appear in place of a primitive value.
6259     */
6260    @Child(name = "valueAlternatives", type = {CanonicalType.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6261    @Description(shortDefinition="Extensions that are allowed to replace a primitive value", formalDefinition="Specifies a list of extensions that can appear in place of a primitive value." )
6262    protected List<CanonicalType> valueAlternatives;
6263
6264    /**
6265     * If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way. Note that this is being phased out and replaced by obligations (see below).  If false, the element may be ignored and not supported. If false, whether to populate or use the data element in any way is at the discretion of the implementation.
6266     */
6267    @Child(name = "mustSupport", type = {BooleanType.class}, order=30, min=0, max=1, modifier=false, summary=true)
6268    @Description(shortDefinition="If the element must be supported (discouraged - see obligations)", formalDefinition="If true, implementations that produce or consume resources SHALL provide \"support\" for the element in some meaningful way. Note that this is being phased out and replaced by obligations (see below).  If false, the element may be ignored and not supported. If false, whether to populate or use the data element in any way is at the discretion of the implementation." )
6269    protected BooleanType mustSupport;
6270
6271    /**
6272     * If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. When used on the root element in an extension definition, this indicates whether or not the extension is a modifier extension.
6273     */
6274    @Child(name = "isModifier", type = {BooleanType.class}, order=31, min=0, max=1, modifier=false, summary=true)
6275    @Description(shortDefinition="If this modifies the meaning of other elements", formalDefinition="If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. When used on the root element in an extension definition, this indicates whether or not the extension is a modifier extension." )
6276    protected BooleanType isModifier;
6277
6278    /**
6279     * Explains how that element affects the interpretation of the resource or element that contains it.
6280     */
6281    @Child(name = "isModifierReason", type = {StringType.class}, order=32, min=0, max=1, modifier=false, summary=true)
6282    @Description(shortDefinition="Reason that this element is marked as a modifier", formalDefinition="Explains how that element affects the interpretation of the resource or element that contains it." )
6283    protected StringType isModifierReason;
6284
6285    /**
6286     * Whether the element should be included if a client requests a search with the parameter _summary=true.
6287     */
6288    @Child(name = "isSummary", type = {BooleanType.class}, order=33, min=0, max=1, modifier=false, summary=true)
6289    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
6290    protected BooleanType isSummary;
6291
6292    /**
6293     * Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).
6294     */
6295    @Child(name = "binding", type = {}, order=34, min=0, max=1, modifier=false, summary=true)
6296    @Description(shortDefinition="ValueSet details if this is coded", formalDefinition="Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri)." )
6297    protected ElementDefinitionBindingComponent binding;
6298
6299    /**
6300     * Identifies a concept from an external specification that roughly corresponds to this element.
6301     */
6302    @Child(name = "mapping", type = {}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6303    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
6304    protected List<ElementDefinitionMappingComponent> mapping;
6305
6306    private static final long serialVersionUID = -1474105308L;
6307
6308  /**
6309   * Constructor
6310   */
6311    public ElementDefinition() {
6312      super();
6313    }
6314
6315  /**
6316   * Constructor
6317   */
6318    public ElementDefinition(String path) {
6319      super();
6320      this.setPath(path);
6321    }
6322
6323    /**
6324     * @return {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
6325     */
6326    public StringType getPathElement() { 
6327      if (this.path == null)
6328        if (Configuration.errorOnAutoCreate())
6329          throw new Error("Attempt to auto-create ElementDefinition.path");
6330        else if (Configuration.doAutoCreate())
6331          this.path = new StringType(); // bb
6332      return this.path;
6333    }
6334
6335    public boolean hasPathElement() { 
6336      return this.path != null && !this.path.isEmpty();
6337    }
6338
6339    public boolean hasPath() { 
6340      return this.path != null && !this.path.isEmpty();
6341    }
6342
6343    /**
6344     * @param value {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
6345     */
6346    public ElementDefinition setPathElement(StringType value) { 
6347      this.path = value;
6348      return this;
6349    }
6350
6351    /**
6352     * @return The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
6353     */
6354    public String getPath() { 
6355      return this.path == null ? null : this.path.getValue();
6356    }
6357
6358    /**
6359     * @param value The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
6360     */
6361    public ElementDefinition setPath(String value) { 
6362        if (this.path == null)
6363          this.path = new StringType();
6364        this.path.setValue(value);
6365      return this;
6366    }
6367
6368    /**
6369     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6370     */
6371    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
6372      if (this.representation == null)
6373        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6374      return this.representation;
6375    }
6376
6377    /**
6378     * @return Returns a reference to <code>this</code> for easy method chaining
6379     */
6380    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> theRepresentation) { 
6381      this.representation = theRepresentation;
6382      return this;
6383    }
6384
6385    public boolean hasRepresentation() { 
6386      if (this.representation == null)
6387        return false;
6388      for (Enumeration<PropertyRepresentation> item : this.representation)
6389        if (!item.isEmpty())
6390          return true;
6391      return false;
6392    }
6393
6394    /**
6395     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6396     */
6397    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
6398      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
6399      if (this.representation == null)
6400        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6401      this.representation.add(t);
6402      return t;
6403    }
6404
6405    /**
6406     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6407     */
6408    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
6409      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
6410      t.setValue(value);
6411      if (this.representation == null)
6412        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6413      this.representation.add(t);
6414      return this;
6415    }
6416
6417    /**
6418     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6419     */
6420    public boolean hasRepresentation(PropertyRepresentation value) { 
6421      if (this.representation == null)
6422        return false;
6423      for (Enumeration<PropertyRepresentation> v : this.representation)
6424        if (v.getValue().equals(value)) // code
6425          return true;
6426      return false;
6427    }
6428
6429    /**
6430     * @return {@link #sliceName} (The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
6431     */
6432    public StringType getSliceNameElement() { 
6433      if (this.sliceName == null)
6434        if (Configuration.errorOnAutoCreate())
6435          throw new Error("Attempt to auto-create ElementDefinition.sliceName");
6436        else if (Configuration.doAutoCreate())
6437          this.sliceName = new StringType(); // bb
6438      return this.sliceName;
6439    }
6440
6441    public boolean hasSliceNameElement() { 
6442      return this.sliceName != null && !this.sliceName.isEmpty();
6443    }
6444
6445    public boolean hasSliceName() { 
6446      return this.sliceName != null && !this.sliceName.isEmpty();
6447    }
6448
6449    /**
6450     * @param value {@link #sliceName} (The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
6451     */
6452    public ElementDefinition setSliceNameElement(StringType value) { 
6453      this.sliceName = value;
6454      return this;
6455    }
6456
6457    /**
6458     * @return The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
6459     */
6460    public String getSliceName() { 
6461      return this.sliceName == null ? null : this.sliceName.getValue();
6462    }
6463
6464    /**
6465     * @param value The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
6466     */
6467    public ElementDefinition setSliceName(String value) { 
6468      if (Utilities.noString(value))
6469        this.sliceName = null;
6470      else {
6471        if (this.sliceName == null)
6472          this.sliceName = new StringType();
6473        this.sliceName.setValue(value);
6474      }
6475      return this;
6476    }
6477
6478    /**
6479     * @return {@link #sliceIsConstraining} (If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.). This is the underlying object with id, value and extensions. The accessor "getSliceIsConstraining" gives direct access to the value
6480     */
6481    public BooleanType getSliceIsConstrainingElement() { 
6482      if (this.sliceIsConstraining == null)
6483        if (Configuration.errorOnAutoCreate())
6484          throw new Error("Attempt to auto-create ElementDefinition.sliceIsConstraining");
6485        else if (Configuration.doAutoCreate())
6486          this.sliceIsConstraining = new BooleanType(); // bb
6487      return this.sliceIsConstraining;
6488    }
6489
6490    public boolean hasSliceIsConstrainingElement() { 
6491      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
6492    }
6493
6494    public boolean hasSliceIsConstraining() { 
6495      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
6496    }
6497
6498    /**
6499     * @param value {@link #sliceIsConstraining} (If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.). This is the underlying object with id, value and extensions. The accessor "getSliceIsConstraining" gives direct access to the value
6500     */
6501    public ElementDefinition setSliceIsConstrainingElement(BooleanType value) { 
6502      this.sliceIsConstraining = value;
6503      return this;
6504    }
6505
6506    /**
6507     * @return If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
6508     */
6509    public boolean getSliceIsConstraining() { 
6510      return this.sliceIsConstraining == null || this.sliceIsConstraining.isEmpty() ? false : this.sliceIsConstraining.getValue();
6511    }
6512
6513    /**
6514     * @param value If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
6515     */
6516    public ElementDefinition setSliceIsConstraining(boolean value) { 
6517        if (this.sliceIsConstraining == null)
6518          this.sliceIsConstraining = new BooleanType();
6519        this.sliceIsConstraining.setValue(value);
6520      return this;
6521    }
6522
6523    /**
6524     * @return {@link #label} (A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
6525     */
6526    public StringType getLabelElement() { 
6527      if (this.label == null)
6528        if (Configuration.errorOnAutoCreate())
6529          throw new Error("Attempt to auto-create ElementDefinition.label");
6530        else if (Configuration.doAutoCreate())
6531          this.label = new StringType(); // bb
6532      return this.label;
6533    }
6534
6535    public boolean hasLabelElement() { 
6536      return this.label != null && !this.label.isEmpty();
6537    }
6538
6539    public boolean hasLabel() { 
6540      return this.label != null && !this.label.isEmpty();
6541    }
6542
6543    /**
6544     * @param value {@link #label} (A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
6545     */
6546    public ElementDefinition setLabelElement(StringType value) { 
6547      this.label = value;
6548      return this;
6549    }
6550
6551    /**
6552     * @return A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
6553     */
6554    public String getLabel() { 
6555      return this.label == null ? null : this.label.getValue();
6556    }
6557
6558    /**
6559     * @param value A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
6560     */
6561    public ElementDefinition setLabel(String value) { 
6562      if (Utilities.noString(value))
6563        this.label = null;
6564      else {
6565        if (this.label == null)
6566          this.label = new StringType();
6567        this.label.setValue(value);
6568      }
6569      return this;
6570    }
6571
6572    /**
6573     * @return {@link #code} (A code that has the same meaning as the element in a particular terminology.)
6574     */
6575    public List<Coding> getCode() { 
6576      if (this.code == null)
6577        this.code = new ArrayList<Coding>();
6578      return this.code;
6579    }
6580
6581    /**
6582     * @return Returns a reference to <code>this</code> for easy method chaining
6583     */
6584    public ElementDefinition setCode(List<Coding> theCode) { 
6585      this.code = theCode;
6586      return this;
6587    }
6588
6589    public boolean hasCode() { 
6590      if (this.code == null)
6591        return false;
6592      for (Coding item : this.code)
6593        if (!item.isEmpty())
6594          return true;
6595      return false;
6596    }
6597
6598    public Coding addCode() { //3
6599      Coding t = new Coding();
6600      if (this.code == null)
6601        this.code = new ArrayList<Coding>();
6602      this.code.add(t);
6603      return t;
6604    }
6605
6606    public ElementDefinition addCode(Coding t) { //3
6607      if (t == null)
6608        return this;
6609      if (this.code == null)
6610        this.code = new ArrayList<Coding>();
6611      this.code.add(t);
6612      return this;
6613    }
6614
6615    /**
6616     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
6617     */
6618    public Coding getCodeFirstRep() { 
6619      if (getCode().isEmpty()) {
6620        addCode();
6621      }
6622      return getCode().get(0);
6623    }
6624
6625    /**
6626     * @return {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
6627     */
6628    public ElementDefinitionSlicingComponent getSlicing() { 
6629      if (this.slicing == null)
6630        if (Configuration.errorOnAutoCreate())
6631          throw new Error("Attempt to auto-create ElementDefinition.slicing");
6632        else if (Configuration.doAutoCreate())
6633          this.slicing = new ElementDefinitionSlicingComponent(); // cc
6634      return this.slicing;
6635    }
6636
6637    public boolean hasSlicing() { 
6638      return this.slicing != null && !this.slicing.isEmpty();
6639    }
6640
6641    /**
6642     * @param value {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
6643     */
6644    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
6645      this.slicing = value;
6646      return this;
6647    }
6648
6649    /**
6650     * @return {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
6651     */
6652    public StringType getShortElement() { 
6653      if (this.short_ == null)
6654        if (Configuration.errorOnAutoCreate())
6655          throw new Error("Attempt to auto-create ElementDefinition.short_");
6656        else if (Configuration.doAutoCreate())
6657          this.short_ = new StringType(); // bb
6658      return this.short_;
6659    }
6660
6661    public boolean hasShortElement() { 
6662      return this.short_ != null && !this.short_.isEmpty();
6663    }
6664
6665    public boolean hasShort() { 
6666      return this.short_ != null && !this.short_.isEmpty();
6667    }
6668
6669    /**
6670     * @param value {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
6671     */
6672    public ElementDefinition setShortElement(StringType value) { 
6673      this.short_ = value;
6674      return this;
6675    }
6676
6677    /**
6678     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
6679     */
6680    public String getShort() { 
6681      return this.short_ == null ? null : this.short_.getValue();
6682    }
6683
6684    /**
6685     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
6686     */
6687    public ElementDefinition setShort(String value) { 
6688      if (Utilities.noString(value))
6689        this.short_ = null;
6690      else {
6691        if (this.short_ == null)
6692          this.short_ = new StringType();
6693        this.short_.setValue(value);
6694      }
6695      return this;
6696    }
6697
6698    /**
6699     * @return {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
6700     */
6701    public MarkdownType getDefinitionElement() { 
6702      if (this.definition == null)
6703        if (Configuration.errorOnAutoCreate())
6704          throw new Error("Attempt to auto-create ElementDefinition.definition");
6705        else if (Configuration.doAutoCreate())
6706          this.definition = new MarkdownType(); // bb
6707      return this.definition;
6708    }
6709
6710    public boolean hasDefinitionElement() { 
6711      return this.definition != null && !this.definition.isEmpty();
6712    }
6713
6714    public boolean hasDefinition() { 
6715      return this.definition != null && !this.definition.isEmpty();
6716    }
6717
6718    /**
6719     * @param value {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
6720     */
6721    public ElementDefinition setDefinitionElement(MarkdownType value) { 
6722      this.definition = value;
6723      return this;
6724    }
6725
6726    /**
6727     * @return Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
6728     */
6729    public String getDefinition() { 
6730      return this.definition == null ? null : this.definition.getValue();
6731    }
6732
6733    /**
6734     * @param value Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
6735     */
6736    public ElementDefinition setDefinition(String value) { 
6737      if (Utilities.noString(value))
6738        this.definition = null;
6739      else {
6740        if (this.definition == null)
6741          this.definition = new MarkdownType();
6742        this.definition.setValue(value);
6743      }
6744      return this;
6745    }
6746
6747    /**
6748     * @return {@link #comment} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
6749     */
6750    public MarkdownType getCommentElement() { 
6751      if (this.comment == null)
6752        if (Configuration.errorOnAutoCreate())
6753          throw new Error("Attempt to auto-create ElementDefinition.comment");
6754        else if (Configuration.doAutoCreate())
6755          this.comment = new MarkdownType(); // bb
6756      return this.comment;
6757    }
6758
6759    public boolean hasCommentElement() { 
6760      return this.comment != null && !this.comment.isEmpty();
6761    }
6762
6763    public boolean hasComment() { 
6764      return this.comment != null && !this.comment.isEmpty();
6765    }
6766
6767    /**
6768     * @param value {@link #comment} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
6769     */
6770    public ElementDefinition setCommentElement(MarkdownType value) { 
6771      this.comment = value;
6772      return this;
6773    }
6774
6775    /**
6776     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
6777     */
6778    public String getComment() { 
6779      return this.comment == null ? null : this.comment.getValue();
6780    }
6781
6782    /**
6783     * @param value Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
6784     */
6785    public ElementDefinition setComment(String value) { 
6786      if (Utilities.noString(value))
6787        this.comment = null;
6788      else {
6789        if (this.comment == null)
6790          this.comment = new MarkdownType();
6791        this.comment.setValue(value);
6792      }
6793      return this;
6794    }
6795
6796    /**
6797     * @return {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
6798     */
6799    public MarkdownType getRequirementsElement() { 
6800      if (this.requirements == null)
6801        if (Configuration.errorOnAutoCreate())
6802          throw new Error("Attempt to auto-create ElementDefinition.requirements");
6803        else if (Configuration.doAutoCreate())
6804          this.requirements = new MarkdownType(); // bb
6805      return this.requirements;
6806    }
6807
6808    public boolean hasRequirementsElement() { 
6809      return this.requirements != null && !this.requirements.isEmpty();
6810    }
6811
6812    public boolean hasRequirements() { 
6813      return this.requirements != null && !this.requirements.isEmpty();
6814    }
6815
6816    /**
6817     * @param value {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
6818     */
6819    public ElementDefinition setRequirementsElement(MarkdownType value) { 
6820      this.requirements = value;
6821      return this;
6822    }
6823
6824    /**
6825     * @return This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
6826     */
6827    public String getRequirements() { 
6828      return this.requirements == null ? null : this.requirements.getValue();
6829    }
6830
6831    /**
6832     * @param value This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
6833     */
6834    public ElementDefinition setRequirements(String value) { 
6835      if (Utilities.noString(value))
6836        this.requirements = null;
6837      else {
6838        if (this.requirements == null)
6839          this.requirements = new MarkdownType();
6840        this.requirements.setValue(value);
6841      }
6842      return this;
6843    }
6844
6845    /**
6846     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
6847     */
6848    public List<StringType> getAlias() { 
6849      if (this.alias == null)
6850        this.alias = new ArrayList<StringType>();
6851      return this.alias;
6852    }
6853
6854    /**
6855     * @return Returns a reference to <code>this</code> for easy method chaining
6856     */
6857    public ElementDefinition setAlias(List<StringType> theAlias) { 
6858      this.alias = theAlias;
6859      return this;
6860    }
6861
6862    public boolean hasAlias() { 
6863      if (this.alias == null)
6864        return false;
6865      for (StringType item : this.alias)
6866        if (!item.isEmpty())
6867          return true;
6868      return false;
6869    }
6870
6871    /**
6872     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
6873     */
6874    public StringType addAliasElement() {//2 
6875      StringType t = new StringType();
6876      if (this.alias == null)
6877        this.alias = new ArrayList<StringType>();
6878      this.alias.add(t);
6879      return t;
6880    }
6881
6882    /**
6883     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
6884     */
6885    public ElementDefinition addAlias(String value) { //1
6886      StringType t = new StringType();
6887      t.setValue(value);
6888      if (this.alias == null)
6889        this.alias = new ArrayList<StringType>();
6890      this.alias.add(t);
6891      return this;
6892    }
6893
6894    /**
6895     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
6896     */
6897    public boolean hasAlias(String value) { 
6898      if (this.alias == null)
6899        return false;
6900      for (StringType v : this.alias)
6901        if (v.getValue().equals(value)) // string
6902          return true;
6903      return false;
6904    }
6905
6906    /**
6907     * @return {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
6908     */
6909    public UnsignedIntType getMinElement() { 
6910      if (this.min == null)
6911        if (Configuration.errorOnAutoCreate())
6912          throw new Error("Attempt to auto-create ElementDefinition.min");
6913        else if (Configuration.doAutoCreate())
6914          this.min = new UnsignedIntType(); // bb
6915      return this.min;
6916    }
6917
6918    public boolean hasMinElement() { 
6919      return this.min != null && !this.min.isEmpty();
6920    }
6921
6922    public boolean hasMin() { 
6923      return this.min != null && !this.min.isEmpty();
6924    }
6925
6926    /**
6927     * @param value {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
6928     */
6929    public ElementDefinition setMinElement(UnsignedIntType value) { 
6930      this.min = value;
6931      return this;
6932    }
6933
6934    /**
6935     * @return The minimum number of times this element SHALL appear in the instance.
6936     */
6937    public int getMin() { 
6938      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
6939    }
6940
6941    /**
6942     * @param value The minimum number of times this element SHALL appear in the instance.
6943     */
6944    public ElementDefinition setMin(int value) { 
6945        if (this.min == null)
6946          this.min = new UnsignedIntType();
6947        this.min.setValue(value);
6948      return this;
6949    }
6950
6951    /**
6952     * @return {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
6953     */
6954    public StringType getMaxElement() { 
6955      if (this.max == null)
6956        if (Configuration.errorOnAutoCreate())
6957          throw new Error("Attempt to auto-create ElementDefinition.max");
6958        else if (Configuration.doAutoCreate())
6959          this.max = new StringType(); // bb
6960      return this.max;
6961    }
6962
6963    public boolean hasMaxElement() { 
6964      return this.max != null && !this.max.isEmpty();
6965    }
6966
6967    public boolean hasMax() { 
6968      return this.max != null && !this.max.isEmpty();
6969    }
6970
6971    /**
6972     * @param value {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
6973     */
6974    public ElementDefinition setMaxElement(StringType value) { 
6975      this.max = value;
6976      return this;
6977    }
6978
6979    /**
6980     * @return The maximum number of times this element is permitted to appear in the instance.
6981     */
6982    public String getMax() { 
6983      return this.max == null ? null : this.max.getValue();
6984    }
6985
6986    /**
6987     * @param value The maximum number of times this element is permitted to appear in the instance.
6988     */
6989    public ElementDefinition setMax(String value) { 
6990      if (Utilities.noString(value))
6991        this.max = null;
6992      else {
6993        if (this.max == null)
6994          this.max = new StringType();
6995        this.max.setValue(value);
6996      }
6997      return this;
6998    }
6999
7000    /**
7001     * @return {@link #base} (Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.)
7002     */
7003    public ElementDefinitionBaseComponent getBase() { 
7004      if (this.base == null)
7005        if (Configuration.errorOnAutoCreate())
7006          throw new Error("Attempt to auto-create ElementDefinition.base");
7007        else if (Configuration.doAutoCreate())
7008          this.base = new ElementDefinitionBaseComponent(); // cc
7009      return this.base;
7010    }
7011
7012    public boolean hasBase() { 
7013      return this.base != null && !this.base.isEmpty();
7014    }
7015
7016    /**
7017     * @param value {@link #base} (Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.)
7018     */
7019    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
7020      this.base = value;
7021      return this;
7022    }
7023
7024    /**
7025     * @return {@link #contentReference} (Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
7026     */
7027    public UriType getContentReferenceElement() { 
7028      if (this.contentReference == null)
7029        if (Configuration.errorOnAutoCreate())
7030          throw new Error("Attempt to auto-create ElementDefinition.contentReference");
7031        else if (Configuration.doAutoCreate())
7032          this.contentReference = new UriType(); // bb
7033      return this.contentReference;
7034    }
7035
7036    public boolean hasContentReferenceElement() { 
7037      return this.contentReference != null && !this.contentReference.isEmpty();
7038    }
7039
7040    public boolean hasContentReference() { 
7041      return this.contentReference != null && !this.contentReference.isEmpty();
7042    }
7043
7044    /**
7045     * @param value {@link #contentReference} (Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
7046     */
7047    public ElementDefinition setContentReferenceElement(UriType value) { 
7048      this.contentReference = value;
7049      return this;
7050    }
7051
7052    /**
7053     * @return Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
7054     */
7055    public String getContentReference() { 
7056      return this.contentReference == null ? null : this.contentReference.getValue();
7057    }
7058
7059    /**
7060     * @param value Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
7061     */
7062    public ElementDefinition setContentReference(String value) { 
7063      if (Utilities.noString(value))
7064        this.contentReference = null;
7065      else {
7066        if (this.contentReference == null)
7067          this.contentReference = new UriType();
7068        this.contentReference.setValue(value);
7069      }
7070      return this;
7071    }
7072
7073    /**
7074     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
7075     */
7076    public List<TypeRefComponent> getType() { 
7077      if (this.type == null)
7078        this.type = new ArrayList<TypeRefComponent>();
7079      return this.type;
7080    }
7081
7082    /**
7083     * @return Returns a reference to <code>this</code> for easy method chaining
7084     */
7085    public ElementDefinition setType(List<TypeRefComponent> theType) { 
7086      this.type = theType;
7087      return this;
7088    }
7089
7090    public boolean hasType() { 
7091      if (this.type == null)
7092        return false;
7093      for (TypeRefComponent item : this.type)
7094        if (!item.isEmpty())
7095          return true;
7096      return false;
7097    }
7098
7099    public TypeRefComponent addType() { //3
7100      TypeRefComponent t = new TypeRefComponent();
7101      if (this.type == null)
7102        this.type = new ArrayList<TypeRefComponent>();
7103      this.type.add(t);
7104      return t;
7105    }
7106
7107    public ElementDefinition addType(TypeRefComponent t) { //3
7108      if (t == null)
7109        return this;
7110      if (this.type == null)
7111        this.type = new ArrayList<TypeRefComponent>();
7112      this.type.add(t);
7113      return this;
7114    }
7115
7116    /**
7117     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
7118     */
7119    public TypeRefComponent getTypeFirstRep() { 
7120      if (getType().isEmpty()) {
7121        addType();
7122      }
7123      return getType().get(0);
7124    }
7125
7126    /**
7127     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7128     */
7129    public DataType getDefaultValue() { 
7130      return this.defaultValue;
7131    }
7132
7133    /**
7134     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7135     */
7136    public Base64BinaryType getDefaultValueBase64BinaryType() throws FHIRException { 
7137      if (this.defaultValue == null)
7138        this.defaultValue = new Base64BinaryType();
7139      if (!(this.defaultValue instanceof Base64BinaryType))
7140        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7141      return (Base64BinaryType) this.defaultValue;
7142    }
7143
7144    public boolean hasDefaultValueBase64BinaryType() { 
7145      return this != null && this.defaultValue instanceof Base64BinaryType;
7146    }
7147
7148    /**
7149     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7150     */
7151    public BooleanType getDefaultValueBooleanType() throws FHIRException { 
7152      if (this.defaultValue == null)
7153        this.defaultValue = new BooleanType();
7154      if (!(this.defaultValue instanceof BooleanType))
7155        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7156      return (BooleanType) this.defaultValue;
7157    }
7158
7159    public boolean hasDefaultValueBooleanType() { 
7160      return this != null && this.defaultValue instanceof BooleanType;
7161    }
7162
7163    /**
7164     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7165     */
7166    public CanonicalType getDefaultValueCanonicalType() throws FHIRException { 
7167      if (this.defaultValue == null)
7168        this.defaultValue = new CanonicalType();
7169      if (!(this.defaultValue instanceof CanonicalType))
7170        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7171      return (CanonicalType) this.defaultValue;
7172    }
7173
7174    public boolean hasDefaultValueCanonicalType() { 
7175      return this != null && this.defaultValue instanceof CanonicalType;
7176    }
7177
7178    /**
7179     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7180     */
7181    public CodeType getDefaultValueCodeType() throws FHIRException { 
7182      if (this.defaultValue == null)
7183        this.defaultValue = new CodeType();
7184      if (!(this.defaultValue instanceof CodeType))
7185        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7186      return (CodeType) this.defaultValue;
7187    }
7188
7189    public boolean hasDefaultValueCodeType() { 
7190      return this != null && this.defaultValue instanceof CodeType;
7191    }
7192
7193    /**
7194     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7195     */
7196    public DateType getDefaultValueDateType() throws FHIRException { 
7197      if (this.defaultValue == null)
7198        this.defaultValue = new DateType();
7199      if (!(this.defaultValue instanceof DateType))
7200        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7201      return (DateType) this.defaultValue;
7202    }
7203
7204    public boolean hasDefaultValueDateType() { 
7205      return this != null && this.defaultValue instanceof DateType;
7206    }
7207
7208    /**
7209     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7210     */
7211    public DateTimeType getDefaultValueDateTimeType() throws FHIRException { 
7212      if (this.defaultValue == null)
7213        this.defaultValue = new DateTimeType();
7214      if (!(this.defaultValue instanceof DateTimeType))
7215        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7216      return (DateTimeType) this.defaultValue;
7217    }
7218
7219    public boolean hasDefaultValueDateTimeType() { 
7220      return this != null && this.defaultValue instanceof DateTimeType;
7221    }
7222
7223    /**
7224     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7225     */
7226    public DecimalType getDefaultValueDecimalType() throws FHIRException { 
7227      if (this.defaultValue == null)
7228        this.defaultValue = new DecimalType();
7229      if (!(this.defaultValue instanceof DecimalType))
7230        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7231      return (DecimalType) this.defaultValue;
7232    }
7233
7234    public boolean hasDefaultValueDecimalType() { 
7235      return this != null && this.defaultValue instanceof DecimalType;
7236    }
7237
7238    /**
7239     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7240     */
7241    public IdType getDefaultValueIdType() throws FHIRException { 
7242      if (this.defaultValue == null)
7243        this.defaultValue = new IdType();
7244      if (!(this.defaultValue instanceof IdType))
7245        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7246      return (IdType) this.defaultValue;
7247    }
7248
7249    public boolean hasDefaultValueIdType() { 
7250      return this != null && this.defaultValue instanceof IdType;
7251    }
7252
7253    /**
7254     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7255     */
7256    public InstantType getDefaultValueInstantType() throws FHIRException { 
7257      if (this.defaultValue == null)
7258        this.defaultValue = new InstantType();
7259      if (!(this.defaultValue instanceof InstantType))
7260        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7261      return (InstantType) this.defaultValue;
7262    }
7263
7264    public boolean hasDefaultValueInstantType() { 
7265      return this != null && this.defaultValue instanceof InstantType;
7266    }
7267
7268    /**
7269     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7270     */
7271    public IntegerType getDefaultValueIntegerType() throws FHIRException { 
7272      if (this.defaultValue == null)
7273        this.defaultValue = new IntegerType();
7274      if (!(this.defaultValue instanceof IntegerType))
7275        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7276      return (IntegerType) this.defaultValue;
7277    }
7278
7279    public boolean hasDefaultValueIntegerType() { 
7280      return this != null && this.defaultValue instanceof IntegerType;
7281    }
7282
7283    /**
7284     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7285     */
7286    public Integer64Type getDefaultValueInteger64Type() throws FHIRException { 
7287      if (this.defaultValue == null)
7288        this.defaultValue = new Integer64Type();
7289      if (!(this.defaultValue instanceof Integer64Type))
7290        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7291      return (Integer64Type) this.defaultValue;
7292    }
7293
7294    public boolean hasDefaultValueInteger64Type() { 
7295      return this != null && this.defaultValue instanceof Integer64Type;
7296    }
7297
7298    /**
7299     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7300     */
7301    public MarkdownType getDefaultValueMarkdownType() throws FHIRException { 
7302      if (this.defaultValue == null)
7303        this.defaultValue = new MarkdownType();
7304      if (!(this.defaultValue instanceof MarkdownType))
7305        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7306      return (MarkdownType) this.defaultValue;
7307    }
7308
7309    public boolean hasDefaultValueMarkdownType() { 
7310      return this != null && this.defaultValue instanceof MarkdownType;
7311    }
7312
7313    /**
7314     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7315     */
7316    public OidType getDefaultValueOidType() throws FHIRException { 
7317      if (this.defaultValue == null)
7318        this.defaultValue = new OidType();
7319      if (!(this.defaultValue instanceof OidType))
7320        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7321      return (OidType) this.defaultValue;
7322    }
7323
7324    public boolean hasDefaultValueOidType() { 
7325      return this != null && this.defaultValue instanceof OidType;
7326    }
7327
7328    /**
7329     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7330     */
7331    public PositiveIntType getDefaultValuePositiveIntType() throws FHIRException { 
7332      if (this.defaultValue == null)
7333        this.defaultValue = new PositiveIntType();
7334      if (!(this.defaultValue instanceof PositiveIntType))
7335        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7336      return (PositiveIntType) this.defaultValue;
7337    }
7338
7339    public boolean hasDefaultValuePositiveIntType() { 
7340      return this != null && this.defaultValue instanceof PositiveIntType;
7341    }
7342
7343    /**
7344     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7345     */
7346    public StringType getDefaultValueStringType() throws FHIRException { 
7347      if (this.defaultValue == null)
7348        this.defaultValue = new StringType();
7349      if (!(this.defaultValue instanceof StringType))
7350        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7351      return (StringType) this.defaultValue;
7352    }
7353
7354    public boolean hasDefaultValueStringType() { 
7355      return this != null && this.defaultValue instanceof StringType;
7356    }
7357
7358    /**
7359     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7360     */
7361    public TimeType getDefaultValueTimeType() throws FHIRException { 
7362      if (this.defaultValue == null)
7363        this.defaultValue = new TimeType();
7364      if (!(this.defaultValue instanceof TimeType))
7365        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7366      return (TimeType) this.defaultValue;
7367    }
7368
7369    public boolean hasDefaultValueTimeType() { 
7370      return this != null && this.defaultValue instanceof TimeType;
7371    }
7372
7373    /**
7374     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7375     */
7376    public UnsignedIntType getDefaultValueUnsignedIntType() throws FHIRException { 
7377      if (this.defaultValue == null)
7378        this.defaultValue = new UnsignedIntType();
7379      if (!(this.defaultValue instanceof UnsignedIntType))
7380        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7381      return (UnsignedIntType) this.defaultValue;
7382    }
7383
7384    public boolean hasDefaultValueUnsignedIntType() { 
7385      return this != null && this.defaultValue instanceof UnsignedIntType;
7386    }
7387
7388    /**
7389     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7390     */
7391    public UriType getDefaultValueUriType() throws FHIRException { 
7392      if (this.defaultValue == null)
7393        this.defaultValue = new UriType();
7394      if (!(this.defaultValue instanceof UriType))
7395        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7396      return (UriType) this.defaultValue;
7397    }
7398
7399    public boolean hasDefaultValueUriType() { 
7400      return this != null && this.defaultValue instanceof UriType;
7401    }
7402
7403    /**
7404     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7405     */
7406    public UrlType getDefaultValueUrlType() throws FHIRException { 
7407      if (this.defaultValue == null)
7408        this.defaultValue = new UrlType();
7409      if (!(this.defaultValue instanceof UrlType))
7410        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7411      return (UrlType) this.defaultValue;
7412    }
7413
7414    public boolean hasDefaultValueUrlType() { 
7415      return this != null && this.defaultValue instanceof UrlType;
7416    }
7417
7418    /**
7419     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7420     */
7421    public UuidType getDefaultValueUuidType() throws FHIRException { 
7422      if (this.defaultValue == null)
7423        this.defaultValue = new UuidType();
7424      if (!(this.defaultValue instanceof UuidType))
7425        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7426      return (UuidType) this.defaultValue;
7427    }
7428
7429    public boolean hasDefaultValueUuidType() { 
7430      return this != null && this.defaultValue instanceof UuidType;
7431    }
7432
7433    /**
7434     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7435     */
7436    public Address getDefaultValueAddress() throws FHIRException { 
7437      if (this.defaultValue == null)
7438        this.defaultValue = new Address();
7439      if (!(this.defaultValue instanceof Address))
7440        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7441      return (Address) this.defaultValue;
7442    }
7443
7444    public boolean hasDefaultValueAddress() { 
7445      return this != null && this.defaultValue instanceof Address;
7446    }
7447
7448    /**
7449     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7450     */
7451    public Age getDefaultValueAge() throws FHIRException { 
7452      if (this.defaultValue == null)
7453        this.defaultValue = new Age();
7454      if (!(this.defaultValue instanceof Age))
7455        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7456      return (Age) this.defaultValue;
7457    }
7458
7459    public boolean hasDefaultValueAge() { 
7460      return this != null && this.defaultValue instanceof Age;
7461    }
7462
7463    /**
7464     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7465     */
7466    public Annotation getDefaultValueAnnotation() throws FHIRException { 
7467      if (this.defaultValue == null)
7468        this.defaultValue = new Annotation();
7469      if (!(this.defaultValue instanceof Annotation))
7470        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7471      return (Annotation) this.defaultValue;
7472    }
7473
7474    public boolean hasDefaultValueAnnotation() { 
7475      return this != null && this.defaultValue instanceof Annotation;
7476    }
7477
7478    /**
7479     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7480     */
7481    public Attachment getDefaultValueAttachment() throws FHIRException { 
7482      if (this.defaultValue == null)
7483        this.defaultValue = new Attachment();
7484      if (!(this.defaultValue instanceof Attachment))
7485        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7486      return (Attachment) this.defaultValue;
7487    }
7488
7489    public boolean hasDefaultValueAttachment() { 
7490      return this != null && this.defaultValue instanceof Attachment;
7491    }
7492
7493    /**
7494     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7495     */
7496    public CodeableConcept getDefaultValueCodeableConcept() throws FHIRException { 
7497      if (this.defaultValue == null)
7498        this.defaultValue = new CodeableConcept();
7499      if (!(this.defaultValue instanceof CodeableConcept))
7500        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7501      return (CodeableConcept) this.defaultValue;
7502    }
7503
7504    public boolean hasDefaultValueCodeableConcept() { 
7505      return this != null && this.defaultValue instanceof CodeableConcept;
7506    }
7507
7508    /**
7509     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7510     */
7511    public CodeableReference getDefaultValueCodeableReference() throws FHIRException { 
7512      if (this.defaultValue == null)
7513        this.defaultValue = new CodeableReference();
7514      if (!(this.defaultValue instanceof CodeableReference))
7515        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7516      return (CodeableReference) this.defaultValue;
7517    }
7518
7519    public boolean hasDefaultValueCodeableReference() { 
7520      return this != null && this.defaultValue instanceof CodeableReference;
7521    }
7522
7523    /**
7524     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7525     */
7526    public Coding getDefaultValueCoding() throws FHIRException { 
7527      if (this.defaultValue == null)
7528        this.defaultValue = new Coding();
7529      if (!(this.defaultValue instanceof Coding))
7530        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7531      return (Coding) this.defaultValue;
7532    }
7533
7534    public boolean hasDefaultValueCoding() { 
7535      return this != null && this.defaultValue instanceof Coding;
7536    }
7537
7538    /**
7539     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7540     */
7541    public ContactPoint getDefaultValueContactPoint() throws FHIRException { 
7542      if (this.defaultValue == null)
7543        this.defaultValue = new ContactPoint();
7544      if (!(this.defaultValue instanceof ContactPoint))
7545        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7546      return (ContactPoint) this.defaultValue;
7547    }
7548
7549    public boolean hasDefaultValueContactPoint() { 
7550      return this != null && this.defaultValue instanceof ContactPoint;
7551    }
7552
7553    /**
7554     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7555     */
7556    public Count getDefaultValueCount() throws FHIRException { 
7557      if (this.defaultValue == null)
7558        this.defaultValue = new Count();
7559      if (!(this.defaultValue instanceof Count))
7560        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7561      return (Count) this.defaultValue;
7562    }
7563
7564    public boolean hasDefaultValueCount() { 
7565      return this != null && this.defaultValue instanceof Count;
7566    }
7567
7568    /**
7569     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7570     */
7571    public Distance getDefaultValueDistance() throws FHIRException { 
7572      if (this.defaultValue == null)
7573        this.defaultValue = new Distance();
7574      if (!(this.defaultValue instanceof Distance))
7575        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7576      return (Distance) this.defaultValue;
7577    }
7578
7579    public boolean hasDefaultValueDistance() { 
7580      return this != null && this.defaultValue instanceof Distance;
7581    }
7582
7583    /**
7584     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7585     */
7586    public Duration getDefaultValueDuration() throws FHIRException { 
7587      if (this.defaultValue == null)
7588        this.defaultValue = new Duration();
7589      if (!(this.defaultValue instanceof Duration))
7590        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7591      return (Duration) this.defaultValue;
7592    }
7593
7594    public boolean hasDefaultValueDuration() { 
7595      return this != null && this.defaultValue instanceof Duration;
7596    }
7597
7598    /**
7599     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7600     */
7601    public HumanName getDefaultValueHumanName() throws FHIRException { 
7602      if (this.defaultValue == null)
7603        this.defaultValue = new HumanName();
7604      if (!(this.defaultValue instanceof HumanName))
7605        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7606      return (HumanName) this.defaultValue;
7607    }
7608
7609    public boolean hasDefaultValueHumanName() { 
7610      return this != null && this.defaultValue instanceof HumanName;
7611    }
7612
7613    /**
7614     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7615     */
7616    public Identifier getDefaultValueIdentifier() throws FHIRException { 
7617      if (this.defaultValue == null)
7618        this.defaultValue = new Identifier();
7619      if (!(this.defaultValue instanceof Identifier))
7620        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7621      return (Identifier) this.defaultValue;
7622    }
7623
7624    public boolean hasDefaultValueIdentifier() { 
7625      return this != null && this.defaultValue instanceof Identifier;
7626    }
7627
7628    /**
7629     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7630     */
7631    public Money getDefaultValueMoney() throws FHIRException { 
7632      if (this.defaultValue == null)
7633        this.defaultValue = new Money();
7634      if (!(this.defaultValue instanceof Money))
7635        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7636      return (Money) this.defaultValue;
7637    }
7638
7639    public boolean hasDefaultValueMoney() { 
7640      return this != null && this.defaultValue instanceof Money;
7641    }
7642
7643    /**
7644     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7645     */
7646    public Period getDefaultValuePeriod() throws FHIRException { 
7647      if (this.defaultValue == null)
7648        this.defaultValue = new Period();
7649      if (!(this.defaultValue instanceof Period))
7650        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7651      return (Period) this.defaultValue;
7652    }
7653
7654    public boolean hasDefaultValuePeriod() { 
7655      return this != null && this.defaultValue instanceof Period;
7656    }
7657
7658    /**
7659     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7660     */
7661    public Quantity getDefaultValueQuantity() throws FHIRException { 
7662      if (this.defaultValue == null)
7663        this.defaultValue = new Quantity();
7664      if (!(this.defaultValue instanceof Quantity))
7665        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7666      return (Quantity) this.defaultValue;
7667    }
7668
7669    public boolean hasDefaultValueQuantity() { 
7670      return this != null && this.defaultValue instanceof Quantity;
7671    }
7672
7673    /**
7674     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7675     */
7676    public Range getDefaultValueRange() throws FHIRException { 
7677      if (this.defaultValue == null)
7678        this.defaultValue = new Range();
7679      if (!(this.defaultValue instanceof Range))
7680        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7681      return (Range) this.defaultValue;
7682    }
7683
7684    public boolean hasDefaultValueRange() { 
7685      return this != null && this.defaultValue instanceof Range;
7686    }
7687
7688    /**
7689     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7690     */
7691    public Ratio getDefaultValueRatio() throws FHIRException { 
7692      if (this.defaultValue == null)
7693        this.defaultValue = new Ratio();
7694      if (!(this.defaultValue instanceof Ratio))
7695        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7696      return (Ratio) this.defaultValue;
7697    }
7698
7699    public boolean hasDefaultValueRatio() { 
7700      return this != null && this.defaultValue instanceof Ratio;
7701    }
7702
7703    /**
7704     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7705     */
7706    public RatioRange getDefaultValueRatioRange() throws FHIRException { 
7707      if (this.defaultValue == null)
7708        this.defaultValue = new RatioRange();
7709      if (!(this.defaultValue instanceof RatioRange))
7710        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7711      return (RatioRange) this.defaultValue;
7712    }
7713
7714    public boolean hasDefaultValueRatioRange() { 
7715      return this != null && this.defaultValue instanceof RatioRange;
7716    }
7717
7718    /**
7719     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7720     */
7721    public Reference getDefaultValueReference() throws FHIRException { 
7722      if (this.defaultValue == null)
7723        this.defaultValue = new Reference();
7724      if (!(this.defaultValue instanceof Reference))
7725        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7726      return (Reference) this.defaultValue;
7727    }
7728
7729    public boolean hasDefaultValueReference() { 
7730      return this != null && this.defaultValue instanceof Reference;
7731    }
7732
7733    /**
7734     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7735     */
7736    public SampledData getDefaultValueSampledData() throws FHIRException { 
7737      if (this.defaultValue == null)
7738        this.defaultValue = new SampledData();
7739      if (!(this.defaultValue instanceof SampledData))
7740        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7741      return (SampledData) this.defaultValue;
7742    }
7743
7744    public boolean hasDefaultValueSampledData() { 
7745      return this != null && this.defaultValue instanceof SampledData;
7746    }
7747
7748    /**
7749     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7750     */
7751    public Signature getDefaultValueSignature() throws FHIRException { 
7752      if (this.defaultValue == null)
7753        this.defaultValue = new Signature();
7754      if (!(this.defaultValue instanceof Signature))
7755        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7756      return (Signature) this.defaultValue;
7757    }
7758
7759    public boolean hasDefaultValueSignature() { 
7760      return this != null && this.defaultValue instanceof Signature;
7761    }
7762
7763    /**
7764     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7765     */
7766    public Timing getDefaultValueTiming() throws FHIRException { 
7767      if (this.defaultValue == null)
7768        this.defaultValue = new Timing();
7769      if (!(this.defaultValue instanceof Timing))
7770        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7771      return (Timing) this.defaultValue;
7772    }
7773
7774    public boolean hasDefaultValueTiming() { 
7775      return this != null && this.defaultValue instanceof Timing;
7776    }
7777
7778    /**
7779     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7780     */
7781    public ContactDetail getDefaultValueContactDetail() throws FHIRException { 
7782      if (this.defaultValue == null)
7783        this.defaultValue = new ContactDetail();
7784      if (!(this.defaultValue instanceof ContactDetail))
7785        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7786      return (ContactDetail) this.defaultValue;
7787    }
7788
7789    public boolean hasDefaultValueContactDetail() { 
7790      return this != null && this.defaultValue instanceof ContactDetail;
7791    }
7792
7793    /**
7794     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7795     */
7796    public DataRequirement getDefaultValueDataRequirement() throws FHIRException { 
7797      if (this.defaultValue == null)
7798        this.defaultValue = new DataRequirement();
7799      if (!(this.defaultValue instanceof DataRequirement))
7800        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7801      return (DataRequirement) this.defaultValue;
7802    }
7803
7804    public boolean hasDefaultValueDataRequirement() { 
7805      return this != null && this.defaultValue instanceof DataRequirement;
7806    }
7807
7808    /**
7809     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7810     */
7811    public Expression getDefaultValueExpression() throws FHIRException { 
7812      if (this.defaultValue == null)
7813        this.defaultValue = new Expression();
7814      if (!(this.defaultValue instanceof Expression))
7815        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7816      return (Expression) this.defaultValue;
7817    }
7818
7819    public boolean hasDefaultValueExpression() { 
7820      return this != null && this.defaultValue instanceof Expression;
7821    }
7822
7823    /**
7824     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7825     */
7826    public ParameterDefinition getDefaultValueParameterDefinition() throws FHIRException { 
7827      if (this.defaultValue == null)
7828        this.defaultValue = new ParameterDefinition();
7829      if (!(this.defaultValue instanceof ParameterDefinition))
7830        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7831      return (ParameterDefinition) this.defaultValue;
7832    }
7833
7834    public boolean hasDefaultValueParameterDefinition() { 
7835      return this != null && this.defaultValue instanceof ParameterDefinition;
7836    }
7837
7838    /**
7839     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7840     */
7841    public RelatedArtifact getDefaultValueRelatedArtifact() throws FHIRException { 
7842      if (this.defaultValue == null)
7843        this.defaultValue = new RelatedArtifact();
7844      if (!(this.defaultValue instanceof RelatedArtifact))
7845        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7846      return (RelatedArtifact) this.defaultValue;
7847    }
7848
7849    public boolean hasDefaultValueRelatedArtifact() { 
7850      return this != null && this.defaultValue instanceof RelatedArtifact;
7851    }
7852
7853    /**
7854     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7855     */
7856    public TriggerDefinition getDefaultValueTriggerDefinition() throws FHIRException { 
7857      if (this.defaultValue == null)
7858        this.defaultValue = new TriggerDefinition();
7859      if (!(this.defaultValue instanceof TriggerDefinition))
7860        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7861      return (TriggerDefinition) this.defaultValue;
7862    }
7863
7864    public boolean hasDefaultValueTriggerDefinition() { 
7865      return this != null && this.defaultValue instanceof TriggerDefinition;
7866    }
7867
7868    /**
7869     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7870     */
7871    public UsageContext getDefaultValueUsageContext() throws FHIRException { 
7872      if (this.defaultValue == null)
7873        this.defaultValue = new UsageContext();
7874      if (!(this.defaultValue instanceof UsageContext))
7875        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7876      return (UsageContext) this.defaultValue;
7877    }
7878
7879    public boolean hasDefaultValueUsageContext() { 
7880      return this != null && this.defaultValue instanceof UsageContext;
7881    }
7882
7883    /**
7884     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7885     */
7886    public Availability getDefaultValueAvailability() throws FHIRException { 
7887      if (this.defaultValue == null)
7888        this.defaultValue = new Availability();
7889      if (!(this.defaultValue instanceof Availability))
7890        throw new FHIRException("Type mismatch: the type Availability was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7891      return (Availability) this.defaultValue;
7892    }
7893
7894    public boolean hasDefaultValueAvailability() { 
7895      return this != null && this.defaultValue instanceof Availability;
7896    }
7897
7898    /**
7899     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7900     */
7901    public ExtendedContactDetail getDefaultValueExtendedContactDetail() throws FHIRException { 
7902      if (this.defaultValue == null)
7903        this.defaultValue = new ExtendedContactDetail();
7904      if (!(this.defaultValue instanceof ExtendedContactDetail))
7905        throw new FHIRException("Type mismatch: the type ExtendedContactDetail was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7906      return (ExtendedContactDetail) this.defaultValue;
7907    }
7908
7909    public boolean hasDefaultValueExtendedContactDetail() { 
7910      return this != null && this.defaultValue instanceof ExtendedContactDetail;
7911    }
7912
7913    /**
7914     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7915     */
7916    public Dosage getDefaultValueDosage() throws FHIRException { 
7917      if (this.defaultValue == null)
7918        this.defaultValue = new Dosage();
7919      if (!(this.defaultValue instanceof Dosage))
7920        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7921      return (Dosage) this.defaultValue;
7922    }
7923
7924    public boolean hasDefaultValueDosage() { 
7925      return this != null && this.defaultValue instanceof Dosage;
7926    }
7927
7928    /**
7929     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7930     */
7931    public Meta getDefaultValueMeta() throws FHIRException { 
7932      if (this.defaultValue == null)
7933        this.defaultValue = new Meta();
7934      if (!(this.defaultValue instanceof Meta))
7935        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7936      return (Meta) this.defaultValue;
7937    }
7938
7939    public boolean hasDefaultValueMeta() { 
7940      return this != null && this.defaultValue instanceof Meta;
7941    }
7942
7943    public boolean hasDefaultValue() { 
7944      return this.defaultValue != null && !this.defaultValue.isEmpty();
7945    }
7946
7947    /**
7948     * @param value {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7949     */
7950    public ElementDefinition setDefaultValue(DataType value) { 
7951      if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || value instanceof Quantity || value instanceof Range || value instanceof Ratio || value instanceof RatioRange || value instanceof Reference || value instanceof SampledData || value instanceof Signature || value instanceof Timing || value instanceof ContactDetail || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Availability || value instanceof ExtendedContactDetail || value instanceof Dosage || value instanceof Meta))
7952        throw new FHIRException("Not the right type for ElementDefinition.defaultValue[x]: "+value.fhirType());
7953      this.defaultValue = value;
7954      return this;
7955    }
7956
7957    /**
7958     * @return {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
7959     */
7960    public MarkdownType getMeaningWhenMissingElement() { 
7961      if (this.meaningWhenMissing == null)
7962        if (Configuration.errorOnAutoCreate())
7963          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
7964        else if (Configuration.doAutoCreate())
7965          this.meaningWhenMissing = new MarkdownType(); // bb
7966      return this.meaningWhenMissing;
7967    }
7968
7969    public boolean hasMeaningWhenMissingElement() { 
7970      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
7971    }
7972
7973    public boolean hasMeaningWhenMissing() { 
7974      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
7975    }
7976
7977    /**
7978     * @param value {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
7979     */
7980    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
7981      this.meaningWhenMissing = value;
7982      return this;
7983    }
7984
7985    /**
7986     * @return The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
7987     */
7988    public String getMeaningWhenMissing() { 
7989      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
7990    }
7991
7992    /**
7993     * @param value The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
7994     */
7995    public ElementDefinition setMeaningWhenMissing(String value) { 
7996      if (Utilities.noString(value))
7997        this.meaningWhenMissing = null;
7998      else {
7999        if (this.meaningWhenMissing == null)
8000          this.meaningWhenMissing = new MarkdownType();
8001        this.meaningWhenMissing.setValue(value);
8002      }
8003      return this;
8004    }
8005
8006    /**
8007     * @return {@link #orderMeaning} (If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.). This is the underlying object with id, value and extensions. The accessor "getOrderMeaning" gives direct access to the value
8008     */
8009    public StringType getOrderMeaningElement() { 
8010      if (this.orderMeaning == null)
8011        if (Configuration.errorOnAutoCreate())
8012          throw new Error("Attempt to auto-create ElementDefinition.orderMeaning");
8013        else if (Configuration.doAutoCreate())
8014          this.orderMeaning = new StringType(); // bb
8015      return this.orderMeaning;
8016    }
8017
8018    public boolean hasOrderMeaningElement() { 
8019      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
8020    }
8021
8022    public boolean hasOrderMeaning() { 
8023      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
8024    }
8025
8026    /**
8027     * @param value {@link #orderMeaning} (If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.). This is the underlying object with id, value and extensions. The accessor "getOrderMeaning" gives direct access to the value
8028     */
8029    public ElementDefinition setOrderMeaningElement(StringType value) { 
8030      this.orderMeaning = value;
8031      return this;
8032    }
8033
8034    /**
8035     * @return If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
8036     */
8037    public String getOrderMeaning() { 
8038      return this.orderMeaning == null ? null : this.orderMeaning.getValue();
8039    }
8040
8041    /**
8042     * @param value If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
8043     */
8044    public ElementDefinition setOrderMeaning(String value) { 
8045      if (Utilities.noString(value))
8046        this.orderMeaning = null;
8047      else {
8048        if (this.orderMeaning == null)
8049          this.orderMeaning = new StringType();
8050        this.orderMeaning.setValue(value);
8051      }
8052      return this;
8053    }
8054
8055    /**
8056     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8057     */
8058    public DataType getFixed() { 
8059      return this.fixed;
8060    }
8061
8062    /**
8063     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8064     */
8065    public Base64BinaryType getFixedBase64BinaryType() throws FHIRException { 
8066      if (this.fixed == null)
8067        this.fixed = new Base64BinaryType();
8068      if (!(this.fixed instanceof Base64BinaryType))
8069        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8070      return (Base64BinaryType) this.fixed;
8071    }
8072
8073    public boolean hasFixedBase64BinaryType() { 
8074      return this != null && this.fixed instanceof Base64BinaryType;
8075    }
8076
8077    /**
8078     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8079     */
8080    public BooleanType getFixedBooleanType() throws FHIRException { 
8081      if (this.fixed == null)
8082        this.fixed = new BooleanType();
8083      if (!(this.fixed instanceof BooleanType))
8084        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8085      return (BooleanType) this.fixed;
8086    }
8087
8088    public boolean hasFixedBooleanType() { 
8089      return this != null && this.fixed instanceof BooleanType;
8090    }
8091
8092    /**
8093     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8094     */
8095    public CanonicalType getFixedCanonicalType() throws FHIRException { 
8096      if (this.fixed == null)
8097        this.fixed = new CanonicalType();
8098      if (!(this.fixed instanceof CanonicalType))
8099        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8100      return (CanonicalType) this.fixed;
8101    }
8102
8103    public boolean hasFixedCanonicalType() { 
8104      return this != null && this.fixed instanceof CanonicalType;
8105    }
8106
8107    /**
8108     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8109     */
8110    public CodeType getFixedCodeType() throws FHIRException { 
8111      if (this.fixed == null)
8112        this.fixed = new CodeType();
8113      if (!(this.fixed instanceof CodeType))
8114        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8115      return (CodeType) this.fixed;
8116    }
8117
8118    public boolean hasFixedCodeType() { 
8119      return this != null && this.fixed instanceof CodeType;
8120    }
8121
8122    /**
8123     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8124     */
8125    public DateType getFixedDateType() throws FHIRException { 
8126      if (this.fixed == null)
8127        this.fixed = new DateType();
8128      if (!(this.fixed instanceof DateType))
8129        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8130      return (DateType) this.fixed;
8131    }
8132
8133    public boolean hasFixedDateType() { 
8134      return this != null && this.fixed instanceof DateType;
8135    }
8136
8137    /**
8138     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8139     */
8140    public DateTimeType getFixedDateTimeType() throws FHIRException { 
8141      if (this.fixed == null)
8142        this.fixed = new DateTimeType();
8143      if (!(this.fixed instanceof DateTimeType))
8144        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8145      return (DateTimeType) this.fixed;
8146    }
8147
8148    public boolean hasFixedDateTimeType() { 
8149      return this != null && this.fixed instanceof DateTimeType;
8150    }
8151
8152    /**
8153     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8154     */
8155    public DecimalType getFixedDecimalType() throws FHIRException { 
8156      if (this.fixed == null)
8157        this.fixed = new DecimalType();
8158      if (!(this.fixed instanceof DecimalType))
8159        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8160      return (DecimalType) this.fixed;
8161    }
8162
8163    public boolean hasFixedDecimalType() { 
8164      return this != null && this.fixed instanceof DecimalType;
8165    }
8166
8167    /**
8168     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8169     */
8170    public IdType getFixedIdType() throws FHIRException { 
8171      if (this.fixed == null)
8172        this.fixed = new IdType();
8173      if (!(this.fixed instanceof IdType))
8174        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8175      return (IdType) this.fixed;
8176    }
8177
8178    public boolean hasFixedIdType() { 
8179      return this != null && this.fixed instanceof IdType;
8180    }
8181
8182    /**
8183     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8184     */
8185    public InstantType getFixedInstantType() throws FHIRException { 
8186      if (this.fixed == null)
8187        this.fixed = new InstantType();
8188      if (!(this.fixed instanceof InstantType))
8189        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8190      return (InstantType) this.fixed;
8191    }
8192
8193    public boolean hasFixedInstantType() { 
8194      return this != null && this.fixed instanceof InstantType;
8195    }
8196
8197    /**
8198     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8199     */
8200    public IntegerType getFixedIntegerType() throws FHIRException { 
8201      if (this.fixed == null)
8202        this.fixed = new IntegerType();
8203      if (!(this.fixed instanceof IntegerType))
8204        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8205      return (IntegerType) this.fixed;
8206    }
8207
8208    public boolean hasFixedIntegerType() { 
8209      return this != null && this.fixed instanceof IntegerType;
8210    }
8211
8212    /**
8213     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8214     */
8215    public Integer64Type getFixedInteger64Type() throws FHIRException { 
8216      if (this.fixed == null)
8217        this.fixed = new Integer64Type();
8218      if (!(this.fixed instanceof Integer64Type))
8219        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.fixed.getClass().getName()+" was encountered");
8220      return (Integer64Type) this.fixed;
8221    }
8222
8223    public boolean hasFixedInteger64Type() { 
8224      return this != null && this.fixed instanceof Integer64Type;
8225    }
8226
8227    /**
8228     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8229     */
8230    public MarkdownType getFixedMarkdownType() throws FHIRException { 
8231      if (this.fixed == null)
8232        this.fixed = new MarkdownType();
8233      if (!(this.fixed instanceof MarkdownType))
8234        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8235      return (MarkdownType) this.fixed;
8236    }
8237
8238    public boolean hasFixedMarkdownType() { 
8239      return this != null && this.fixed instanceof MarkdownType;
8240    }
8241
8242    /**
8243     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8244     */
8245    public OidType getFixedOidType() throws FHIRException { 
8246      if (this.fixed == null)
8247        this.fixed = new OidType();
8248      if (!(this.fixed instanceof OidType))
8249        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8250      return (OidType) this.fixed;
8251    }
8252
8253    public boolean hasFixedOidType() { 
8254      return this != null && this.fixed instanceof OidType;
8255    }
8256
8257    /**
8258     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8259     */
8260    public PositiveIntType getFixedPositiveIntType() throws FHIRException { 
8261      if (this.fixed == null)
8262        this.fixed = new PositiveIntType();
8263      if (!(this.fixed instanceof PositiveIntType))
8264        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8265      return (PositiveIntType) this.fixed;
8266    }
8267
8268    public boolean hasFixedPositiveIntType() { 
8269      return this != null && this.fixed instanceof PositiveIntType;
8270    }
8271
8272    /**
8273     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8274     */
8275    public StringType getFixedStringType() throws FHIRException { 
8276      if (this.fixed == null)
8277        this.fixed = new StringType();
8278      if (!(this.fixed instanceof StringType))
8279        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8280      return (StringType) this.fixed;
8281    }
8282
8283    public boolean hasFixedStringType() { 
8284      return this != null && this.fixed instanceof StringType;
8285    }
8286
8287    /**
8288     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8289     */
8290    public TimeType getFixedTimeType() throws FHIRException { 
8291      if (this.fixed == null)
8292        this.fixed = new TimeType();
8293      if (!(this.fixed instanceof TimeType))
8294        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8295      return (TimeType) this.fixed;
8296    }
8297
8298    public boolean hasFixedTimeType() { 
8299      return this != null && this.fixed instanceof TimeType;
8300    }
8301
8302    /**
8303     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8304     */
8305    public UnsignedIntType getFixedUnsignedIntType() throws FHIRException { 
8306      if (this.fixed == null)
8307        this.fixed = new UnsignedIntType();
8308      if (!(this.fixed instanceof UnsignedIntType))
8309        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8310      return (UnsignedIntType) this.fixed;
8311    }
8312
8313    public boolean hasFixedUnsignedIntType() { 
8314      return this != null && this.fixed instanceof UnsignedIntType;
8315    }
8316
8317    /**
8318     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8319     */
8320    public UriType getFixedUriType() throws FHIRException { 
8321      if (this.fixed == null)
8322        this.fixed = new UriType();
8323      if (!(this.fixed instanceof UriType))
8324        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8325      return (UriType) this.fixed;
8326    }
8327
8328    public boolean hasFixedUriType() { 
8329      return this != null && this.fixed instanceof UriType;
8330    }
8331
8332    /**
8333     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8334     */
8335    public UrlType getFixedUrlType() throws FHIRException { 
8336      if (this.fixed == null)
8337        this.fixed = new UrlType();
8338      if (!(this.fixed instanceof UrlType))
8339        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8340      return (UrlType) this.fixed;
8341    }
8342
8343    public boolean hasFixedUrlType() { 
8344      return this != null && this.fixed instanceof UrlType;
8345    }
8346
8347    /**
8348     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8349     */
8350    public UuidType getFixedUuidType() throws FHIRException { 
8351      if (this.fixed == null)
8352        this.fixed = new UuidType();
8353      if (!(this.fixed instanceof UuidType))
8354        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8355      return (UuidType) this.fixed;
8356    }
8357
8358    public boolean hasFixedUuidType() { 
8359      return this != null && this.fixed instanceof UuidType;
8360    }
8361
8362    /**
8363     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8364     */
8365    public Address getFixedAddress() throws FHIRException { 
8366      if (this.fixed == null)
8367        this.fixed = new Address();
8368      if (!(this.fixed instanceof Address))
8369        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.fixed.getClass().getName()+" was encountered");
8370      return (Address) this.fixed;
8371    }
8372
8373    public boolean hasFixedAddress() { 
8374      return this != null && this.fixed instanceof Address;
8375    }
8376
8377    /**
8378     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8379     */
8380    public Age getFixedAge() throws FHIRException { 
8381      if (this.fixed == null)
8382        this.fixed = new Age();
8383      if (!(this.fixed instanceof Age))
8384        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.fixed.getClass().getName()+" was encountered");
8385      return (Age) this.fixed;
8386    }
8387
8388    public boolean hasFixedAge() { 
8389      return this != null && this.fixed instanceof Age;
8390    }
8391
8392    /**
8393     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8394     */
8395    public Annotation getFixedAnnotation() throws FHIRException { 
8396      if (this.fixed == null)
8397        this.fixed = new Annotation();
8398      if (!(this.fixed instanceof Annotation))
8399        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.fixed.getClass().getName()+" was encountered");
8400      return (Annotation) this.fixed;
8401    }
8402
8403    public boolean hasFixedAnnotation() { 
8404      return this != null && this.fixed instanceof Annotation;
8405    }
8406
8407    /**
8408     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8409     */
8410    public Attachment getFixedAttachment() throws FHIRException { 
8411      if (this.fixed == null)
8412        this.fixed = new Attachment();
8413      if (!(this.fixed instanceof Attachment))
8414        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.fixed.getClass().getName()+" was encountered");
8415      return (Attachment) this.fixed;
8416    }
8417
8418    public boolean hasFixedAttachment() { 
8419      return this != null && this.fixed instanceof Attachment;
8420    }
8421
8422    /**
8423     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8424     */
8425    public CodeableConcept getFixedCodeableConcept() throws FHIRException { 
8426      if (this.fixed == null)
8427        this.fixed = new CodeableConcept();
8428      if (!(this.fixed instanceof CodeableConcept))
8429        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.fixed.getClass().getName()+" was encountered");
8430      return (CodeableConcept) this.fixed;
8431    }
8432
8433    public boolean hasFixedCodeableConcept() { 
8434      return this != null && this.fixed instanceof CodeableConcept;
8435    }
8436
8437    /**
8438     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8439     */
8440    public CodeableReference getFixedCodeableReference() throws FHIRException { 
8441      if (this.fixed == null)
8442        this.fixed = new CodeableReference();
8443      if (!(this.fixed instanceof CodeableReference))
8444        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.fixed.getClass().getName()+" was encountered");
8445      return (CodeableReference) this.fixed;
8446    }
8447
8448    public boolean hasFixedCodeableReference() { 
8449      return this != null && this.fixed instanceof CodeableReference;
8450    }
8451
8452    /**
8453     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8454     */
8455    public Coding getFixedCoding() throws FHIRException { 
8456      if (this.fixed == null)
8457        this.fixed = new Coding();
8458      if (!(this.fixed instanceof Coding))
8459        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.fixed.getClass().getName()+" was encountered");
8460      return (Coding) this.fixed;
8461    }
8462
8463    public boolean hasFixedCoding() { 
8464      return this != null && this.fixed instanceof Coding;
8465    }
8466
8467    /**
8468     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8469     */
8470    public ContactPoint getFixedContactPoint() throws FHIRException { 
8471      if (this.fixed == null)
8472        this.fixed = new ContactPoint();
8473      if (!(this.fixed instanceof ContactPoint))
8474        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.fixed.getClass().getName()+" was encountered");
8475      return (ContactPoint) this.fixed;
8476    }
8477
8478    public boolean hasFixedContactPoint() { 
8479      return this != null && this.fixed instanceof ContactPoint;
8480    }
8481
8482    /**
8483     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8484     */
8485    public Count getFixedCount() throws FHIRException { 
8486      if (this.fixed == null)
8487        this.fixed = new Count();
8488      if (!(this.fixed instanceof Count))
8489        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.fixed.getClass().getName()+" was encountered");
8490      return (Count) this.fixed;
8491    }
8492
8493    public boolean hasFixedCount() { 
8494      return this != null && this.fixed instanceof Count;
8495    }
8496
8497    /**
8498     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8499     */
8500    public Distance getFixedDistance() throws FHIRException { 
8501      if (this.fixed == null)
8502        this.fixed = new Distance();
8503      if (!(this.fixed instanceof Distance))
8504        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.fixed.getClass().getName()+" was encountered");
8505      return (Distance) this.fixed;
8506    }
8507
8508    public boolean hasFixedDistance() { 
8509      return this != null && this.fixed instanceof Distance;
8510    }
8511
8512    /**
8513     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8514     */
8515    public Duration getFixedDuration() throws FHIRException { 
8516      if (this.fixed == null)
8517        this.fixed = new Duration();
8518      if (!(this.fixed instanceof Duration))
8519        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.fixed.getClass().getName()+" was encountered");
8520      return (Duration) this.fixed;
8521    }
8522
8523    public boolean hasFixedDuration() { 
8524      return this != null && this.fixed instanceof Duration;
8525    }
8526
8527    /**
8528     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8529     */
8530    public HumanName getFixedHumanName() throws FHIRException { 
8531      if (this.fixed == null)
8532        this.fixed = new HumanName();
8533      if (!(this.fixed instanceof HumanName))
8534        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.fixed.getClass().getName()+" was encountered");
8535      return (HumanName) this.fixed;
8536    }
8537
8538    public boolean hasFixedHumanName() { 
8539      return this != null && this.fixed instanceof HumanName;
8540    }
8541
8542    /**
8543     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8544     */
8545    public Identifier getFixedIdentifier() throws FHIRException { 
8546      if (this.fixed == null)
8547        this.fixed = new Identifier();
8548      if (!(this.fixed instanceof Identifier))
8549        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.fixed.getClass().getName()+" was encountered");
8550      return (Identifier) this.fixed;
8551    }
8552
8553    public boolean hasFixedIdentifier() { 
8554      return this != null && this.fixed instanceof Identifier;
8555    }
8556
8557    /**
8558     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8559     */
8560    public Money getFixedMoney() throws FHIRException { 
8561      if (this.fixed == null)
8562        this.fixed = new Money();
8563      if (!(this.fixed instanceof Money))
8564        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.fixed.getClass().getName()+" was encountered");
8565      return (Money) this.fixed;
8566    }
8567
8568    public boolean hasFixedMoney() { 
8569      return this != null && this.fixed instanceof Money;
8570    }
8571
8572    /**
8573     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8574     */
8575    public Period getFixedPeriod() throws FHIRException { 
8576      if (this.fixed == null)
8577        this.fixed = new Period();
8578      if (!(this.fixed instanceof Period))
8579        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.fixed.getClass().getName()+" was encountered");
8580      return (Period) this.fixed;
8581    }
8582
8583    public boolean hasFixedPeriod() { 
8584      return this != null && this.fixed instanceof Period;
8585    }
8586
8587    /**
8588     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8589     */
8590    public Quantity getFixedQuantity() throws FHIRException { 
8591      if (this.fixed == null)
8592        this.fixed = new Quantity();
8593      if (!(this.fixed instanceof Quantity))
8594        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.fixed.getClass().getName()+" was encountered");
8595      return (Quantity) this.fixed;
8596    }
8597
8598    public boolean hasFixedQuantity() { 
8599      return this != null && this.fixed instanceof Quantity;
8600    }
8601
8602    /**
8603     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8604     */
8605    public Range getFixedRange() throws FHIRException { 
8606      if (this.fixed == null)
8607        this.fixed = new Range();
8608      if (!(this.fixed instanceof Range))
8609        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.fixed.getClass().getName()+" was encountered");
8610      return (Range) this.fixed;
8611    }
8612
8613    public boolean hasFixedRange() { 
8614      return this != null && this.fixed instanceof Range;
8615    }
8616
8617    /**
8618     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8619     */
8620    public Ratio getFixedRatio() throws FHIRException { 
8621      if (this.fixed == null)
8622        this.fixed = new Ratio();
8623      if (!(this.fixed instanceof Ratio))
8624        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.fixed.getClass().getName()+" was encountered");
8625      return (Ratio) this.fixed;
8626    }
8627
8628    public boolean hasFixedRatio() { 
8629      return this != null && this.fixed instanceof Ratio;
8630    }
8631
8632    /**
8633     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8634     */
8635    public RatioRange getFixedRatioRange() throws FHIRException { 
8636      if (this.fixed == null)
8637        this.fixed = new RatioRange();
8638      if (!(this.fixed instanceof RatioRange))
8639        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.fixed.getClass().getName()+" was encountered");
8640      return (RatioRange) this.fixed;
8641    }
8642
8643    public boolean hasFixedRatioRange() { 
8644      return this != null && this.fixed instanceof RatioRange;
8645    }
8646
8647    /**
8648     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8649     */
8650    public Reference getFixedReference() throws FHIRException { 
8651      if (this.fixed == null)
8652        this.fixed = new Reference();
8653      if (!(this.fixed instanceof Reference))
8654        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.fixed.getClass().getName()+" was encountered");
8655      return (Reference) this.fixed;
8656    }
8657
8658    public boolean hasFixedReference() { 
8659      return this != null && this.fixed instanceof Reference;
8660    }
8661
8662    /**
8663     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8664     */
8665    public SampledData getFixedSampledData() throws FHIRException { 
8666      if (this.fixed == null)
8667        this.fixed = new SampledData();
8668      if (!(this.fixed instanceof SampledData))
8669        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.fixed.getClass().getName()+" was encountered");
8670      return (SampledData) this.fixed;
8671    }
8672
8673    public boolean hasFixedSampledData() { 
8674      return this != null && this.fixed instanceof SampledData;
8675    }
8676
8677    /**
8678     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8679     */
8680    public Signature getFixedSignature() throws FHIRException { 
8681      if (this.fixed == null)
8682        this.fixed = new Signature();
8683      if (!(this.fixed instanceof Signature))
8684        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.fixed.getClass().getName()+" was encountered");
8685      return (Signature) this.fixed;
8686    }
8687
8688    public boolean hasFixedSignature() { 
8689      return this != null && this.fixed instanceof Signature;
8690    }
8691
8692    /**
8693     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8694     */
8695    public Timing getFixedTiming() throws FHIRException { 
8696      if (this.fixed == null)
8697        this.fixed = new Timing();
8698      if (!(this.fixed instanceof Timing))
8699        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.fixed.getClass().getName()+" was encountered");
8700      return (Timing) this.fixed;
8701    }
8702
8703    public boolean hasFixedTiming() { 
8704      return this != null && this.fixed instanceof Timing;
8705    }
8706
8707    /**
8708     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8709     */
8710    public ContactDetail getFixedContactDetail() throws FHIRException { 
8711      if (this.fixed == null)
8712        this.fixed = new ContactDetail();
8713      if (!(this.fixed instanceof ContactDetail))
8714        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.fixed.getClass().getName()+" was encountered");
8715      return (ContactDetail) this.fixed;
8716    }
8717
8718    public boolean hasFixedContactDetail() { 
8719      return this != null && this.fixed instanceof ContactDetail;
8720    }
8721
8722    /**
8723     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8724     */
8725    public DataRequirement getFixedDataRequirement() throws FHIRException { 
8726      if (this.fixed == null)
8727        this.fixed = new DataRequirement();
8728      if (!(this.fixed instanceof DataRequirement))
8729        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.fixed.getClass().getName()+" was encountered");
8730      return (DataRequirement) this.fixed;
8731    }
8732
8733    public boolean hasFixedDataRequirement() { 
8734      return this != null && this.fixed instanceof DataRequirement;
8735    }
8736
8737    /**
8738     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8739     */
8740    public Expression getFixedExpression() throws FHIRException { 
8741      if (this.fixed == null)
8742        this.fixed = new Expression();
8743      if (!(this.fixed instanceof Expression))
8744        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.fixed.getClass().getName()+" was encountered");
8745</