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