001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength;
040import org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrengthEnumFactory;
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
043import org.hl7.fhir.instance.model.api.ICompositeType;
044import org.hl7.fhir.utilities.Utilities;
045
046import ca.uhn.fhir.model.api.annotation.Block;
047import ca.uhn.fhir.model.api.annotation.Child;
048import ca.uhn.fhir.model.api.annotation.DatatypeDef;
049import ca.uhn.fhir.model.api.annotation.Description;
050/**
051 * Captures constraints on each element within the resource, profile, or extension.
052 */
053@DatatypeDef(name="ElementDefinition")
054public class ElementDefinition extends Type implements ICompositeType {
055
056    public enum PropertyRepresentation {
057        /**
058         * In XML, this property is represented as an attribute not an element.
059         */
060        XMLATTR, 
061        /**
062         * This element is represented using the XML text attribute (primitives only)
063         */
064        XMLTEXT, 
065        /**
066         * The type of this element is indicated using xsi:type
067         */
068        TYPEATTR, 
069        /**
070         * Use CDA narrative instead of XHTML
071         */
072        CDATEXT, 
073        /**
074         * added to help the parsers
075         */
076        NULL;
077        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("xmlAttr".equals(codeString))
081          return XMLATTR;
082        if ("xmlText".equals(codeString))
083          return XMLTEXT;
084        if ("typeAttr".equals(codeString))
085          return TYPEATTR;
086        if ("cdaText".equals(codeString))
087          return CDATEXT;
088        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case XMLATTR: return "xmlAttr";
093            case XMLTEXT: return "xmlText";
094            case TYPEATTR: return "typeAttr";
095            case CDATEXT: return "cdaText";
096            case NULL: return null;
097            default: return "?";
098          }
099        }
100        public String getSystem() {
101          switch (this) {
102            case XMLATTR: return "http://hl7.org/fhir/property-representation";
103            case XMLTEXT: return "http://hl7.org/fhir/property-representation";
104            case TYPEATTR: return "http://hl7.org/fhir/property-representation";
105            case CDATEXT: return "http://hl7.org/fhir/property-representation";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getDefinition() {
111          switch (this) {
112            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
113            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only)";
114            case TYPEATTR: return "The type of this element is indicated using xsi:type";
115            case CDATEXT: return "Use CDA narrative instead of XHTML";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120        public String getDisplay() {
121          switch (this) {
122            case XMLATTR: return "XML Attribute";
123            case XMLTEXT: return "XML Text";
124            case TYPEATTR: return "Type Attribute";
125            case CDATEXT: return "CDA Text Format";
126            case NULL: return null;
127            default: return "?";
128          }
129        }
130    }
131
132  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
133    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
134      if (codeString == null || "".equals(codeString))
135            if (codeString == null || "".equals(codeString))
136                return null;
137        if ("xmlAttr".equals(codeString))
138          return PropertyRepresentation.XMLATTR;
139        if ("xmlText".equals(codeString))
140          return PropertyRepresentation.XMLTEXT;
141        if ("typeAttr".equals(codeString))
142          return PropertyRepresentation.TYPEATTR;
143        if ("cdaText".equals(codeString))
144          return PropertyRepresentation.CDATEXT;
145        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
146        }
147        public Enumeration<PropertyRepresentation> fromType(Base code) throws FHIRException {
148          if (code == null || code.isEmpty())
149            return null;
150          String codeString = ((PrimitiveType) code).asStringValue();
151          if (codeString == null || "".equals(codeString))
152            return null;
153        if ("xmlAttr".equals(codeString))
154          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR);
155        if ("xmlText".equals(codeString))
156          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLTEXT);
157        if ("typeAttr".equals(codeString))
158          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.TYPEATTR);
159        if ("cdaText".equals(codeString))
160          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.CDATEXT);
161        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
162        }
163    public String toCode(PropertyRepresentation code) {
164      if (code == PropertyRepresentation.XMLATTR)
165        return "xmlAttr";
166      if (code == PropertyRepresentation.XMLTEXT)
167        return "xmlText";
168      if (code == PropertyRepresentation.TYPEATTR)
169        return "typeAttr";
170      if (code == PropertyRepresentation.CDATEXT)
171        return "cdaText";
172      return "?";
173      }
174    public String toSystem(PropertyRepresentation code) {
175      return code.getSystem();
176      }
177    }
178
179    public enum SlicingRules {
180        /**
181         * No additional content is allowed other than that described by the slices in this profile.
182         */
183        CLOSED, 
184        /**
185         * Additional content is allowed anywhere in the list.
186         */
187        OPEN, 
188        /**
189         * 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.
190         */
191        OPENATEND, 
192        /**
193         * added to help the parsers
194         */
195        NULL;
196        public static SlicingRules fromCode(String codeString) throws FHIRException {
197            if (codeString == null || "".equals(codeString))
198                return null;
199        if ("closed".equals(codeString))
200          return CLOSED;
201        if ("open".equals(codeString))
202          return OPEN;
203        if ("openAtEnd".equals(codeString))
204          return OPENATEND;
205        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
206        }
207        public String toCode() {
208          switch (this) {
209            case CLOSED: return "closed";
210            case OPEN: return "open";
211            case OPENATEND: return "openAtEnd";
212            case NULL: return null;
213            default: return "?";
214          }
215        }
216        public String getSystem() {
217          switch (this) {
218            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
219            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
220            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
221            case NULL: return null;
222            default: return "?";
223          }
224        }
225        public String getDefinition() {
226          switch (this) {
227            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
228            case OPEN: return "Additional content is allowed anywhere in the list.";
229            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.";
230            case NULL: return null;
231            default: return "?";
232          }
233        }
234        public String getDisplay() {
235          switch (this) {
236            case CLOSED: return "Closed";
237            case OPEN: return "Open";
238            case OPENATEND: return "Open at End";
239            case NULL: return null;
240            default: return "?";
241          }
242        }
243    }
244
245  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
246    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
247      if (codeString == null || "".equals(codeString))
248            if (codeString == null || "".equals(codeString))
249                return null;
250        if ("closed".equals(codeString))
251          return SlicingRules.CLOSED;
252        if ("open".equals(codeString))
253          return SlicingRules.OPEN;
254        if ("openAtEnd".equals(codeString))
255          return SlicingRules.OPENATEND;
256        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
257        }
258        public Enumeration<SlicingRules> fromType(Base code) throws FHIRException {
259          if (code == null || code.isEmpty())
260            return null;
261          String codeString = ((PrimitiveType) code).asStringValue();
262          if (codeString == null || "".equals(codeString))
263            return null;
264        if ("closed".equals(codeString))
265          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED);
266        if ("open".equals(codeString))
267          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN);
268        if ("openAtEnd".equals(codeString))
269          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND);
270        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
271        }
272    public String toCode(SlicingRules code) {
273      if (code == SlicingRules.CLOSED)
274        return "closed";
275      if (code == SlicingRules.OPEN)
276        return "open";
277      if (code == SlicingRules.OPENATEND)
278        return "openAtEnd";
279      return "?";
280      }
281    public String toSystem(SlicingRules code) {
282      return code.getSystem();
283      }
284    }
285
286    public enum AggregationMode {
287        /**
288         * The reference is a local reference to a contained resource.
289         */
290        CONTAINED, 
291        /**
292         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
293         */
294        REFERENCED, 
295        /**
296         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
297         */
298        BUNDLED, 
299        /**
300         * added to help the parsers
301         */
302        NULL;
303        public static AggregationMode fromCode(String codeString) throws FHIRException {
304            if (codeString == null || "".equals(codeString))
305                return null;
306        if ("contained".equals(codeString))
307          return CONTAINED;
308        if ("referenced".equals(codeString))
309          return REFERENCED;
310        if ("bundled".equals(codeString))
311          return BUNDLED;
312        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
313        }
314        public String toCode() {
315          switch (this) {
316            case CONTAINED: return "contained";
317            case REFERENCED: return "referenced";
318            case BUNDLED: return "bundled";
319            case NULL: return null;
320            default: return "?";
321          }
322        }
323        public String getSystem() {
324          switch (this) {
325            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
326            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
327            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
328            case NULL: return null;
329            default: return "?";
330          }
331        }
332        public String getDefinition() {
333          switch (this) {
334            case CONTAINED: return "The reference is a local reference to a contained resource.";
335            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
336            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
337            case NULL: return null;
338            default: return "?";
339          }
340        }
341        public String getDisplay() {
342          switch (this) {
343            case CONTAINED: return "Contained";
344            case REFERENCED: return "Referenced";
345            case BUNDLED: return "Bundled";
346            case NULL: return null;
347            default: return "?";
348          }
349        }
350    }
351
352  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
353    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
354      if (codeString == null || "".equals(codeString))
355            if (codeString == null || "".equals(codeString))
356                return null;
357        if ("contained".equals(codeString))
358          return AggregationMode.CONTAINED;
359        if ("referenced".equals(codeString))
360          return AggregationMode.REFERENCED;
361        if ("bundled".equals(codeString))
362          return AggregationMode.BUNDLED;
363        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
364        }
365        public Enumeration<AggregationMode> fromType(Base code) throws FHIRException {
366          if (code == null || code.isEmpty())
367            return null;
368          String codeString = ((PrimitiveType) code).asStringValue();
369          if (codeString == null || "".equals(codeString))
370            return null;
371        if ("contained".equals(codeString))
372          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED);
373        if ("referenced".equals(codeString))
374          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED);
375        if ("bundled".equals(codeString))
376          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED);
377        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
378        }
379    public String toCode(AggregationMode code) {
380      if (code == AggregationMode.CONTAINED)
381        return "contained";
382      if (code == AggregationMode.REFERENCED)
383        return "referenced";
384      if (code == AggregationMode.BUNDLED)
385        return "bundled";
386      return "?";
387      }
388    public String toSystem(AggregationMode code) {
389      return code.getSystem();
390      }
391    }
392
393    public enum ReferenceVersionRules {
394        /**
395         * The reference may be either version independent or version specific
396         */
397        EITHER, 
398        /**
399         * The reference must be version independent
400         */
401        INDEPENDENT, 
402        /**
403         * The reference must be version specific
404         */
405        SPECIFIC, 
406        /**
407         * added to help the parsers
408         */
409        NULL;
410        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
411            if (codeString == null || "".equals(codeString))
412                return null;
413        if ("either".equals(codeString))
414          return EITHER;
415        if ("independent".equals(codeString))
416          return INDEPENDENT;
417        if ("specific".equals(codeString))
418          return SPECIFIC;
419        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
420        }
421        public String toCode() {
422          switch (this) {
423            case EITHER: return "either";
424            case INDEPENDENT: return "independent";
425            case SPECIFIC: return "specific";
426            case NULL: return null;
427            default: return "?";
428          }
429        }
430        public String getSystem() {
431          switch (this) {
432            case EITHER: return "http://hl7.org/fhir/reference-version-rules";
433            case INDEPENDENT: return "http://hl7.org/fhir/reference-version-rules";
434            case SPECIFIC: return "http://hl7.org/fhir/reference-version-rules";
435            case NULL: return null;
436            default: return "?";
437          }
438        }
439        public String getDefinition() {
440          switch (this) {
441            case EITHER: return "The reference may be either version independent or version specific";
442            case INDEPENDENT: return "The reference must be version independent";
443            case SPECIFIC: return "The reference must be version specific";
444            case NULL: return null;
445            default: return "?";
446          }
447        }
448        public String getDisplay() {
449          switch (this) {
450            case EITHER: return "Either Specific or independent";
451            case INDEPENDENT: return "Version independent";
452            case SPECIFIC: return "Version Specific";
453            case NULL: return null;
454            default: return "?";
455          }
456        }
457    }
458
459  public static class ReferenceVersionRulesEnumFactory implements EnumFactory<ReferenceVersionRules> {
460    public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
461      if (codeString == null || "".equals(codeString))
462            if (codeString == null || "".equals(codeString))
463                return null;
464        if ("either".equals(codeString))
465          return ReferenceVersionRules.EITHER;
466        if ("independent".equals(codeString))
467          return ReferenceVersionRules.INDEPENDENT;
468        if ("specific".equals(codeString))
469          return ReferenceVersionRules.SPECIFIC;
470        throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
471        }
472        public Enumeration<ReferenceVersionRules> fromType(Base code) throws FHIRException {
473          if (code == null || code.isEmpty())
474            return null;
475          String codeString = ((PrimitiveType) code).asStringValue();
476          if (codeString == null || "".equals(codeString))
477            return null;
478        if ("either".equals(codeString))
479          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.EITHER);
480        if ("independent".equals(codeString))
481          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.INDEPENDENT);
482        if ("specific".equals(codeString))
483          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.SPECIFIC);
484        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
485        }
486    public String toCode(ReferenceVersionRules code) {
487      if (code == ReferenceVersionRules.EITHER)
488        return "either";
489      if (code == ReferenceVersionRules.INDEPENDENT)
490        return "independent";
491      if (code == ReferenceVersionRules.SPECIFIC)
492        return "specific";
493      return "?";
494      }
495    public String toSystem(ReferenceVersionRules code) {
496      return code.getSystem();
497      }
498    }
499
500    public enum ConstraintSeverity {
501        /**
502         * If the constraint is violated, the resource is not conformant.
503         */
504        ERROR, 
505        /**
506         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
507         */
508        WARNING, 
509        /**
510         * added to help the parsers
511         */
512        NULL;
513        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
514            if (codeString == null || "".equals(codeString))
515                return null;
516        if ("error".equals(codeString))
517          return ERROR;
518        if ("warning".equals(codeString))
519          return WARNING;
520        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
521        }
522        public String toCode() {
523          switch (this) {
524            case ERROR: return "error";
525            case WARNING: return "warning";
526            case NULL: return null;
527            default: return "?";
528          }
529        }
530        public String getSystem() {
531          switch (this) {
532            case ERROR: return "http://hl7.org/fhir/constraint-severity";
533            case WARNING: return "http://hl7.org/fhir/constraint-severity";
534            case NULL: return null;
535            default: return "?";
536          }
537        }
538        public String getDefinition() {
539          switch (this) {
540            case ERROR: return "If the constraint is violated, the resource is not conformant.";
541            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
542            case NULL: return null;
543            default: return "?";
544          }
545        }
546        public String getDisplay() {
547          switch (this) {
548            case ERROR: return "Error";
549            case WARNING: return "Warning";
550            case NULL: return null;
551            default: return "?";
552          }
553        }
554    }
555
556  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
557    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
558      if (codeString == null || "".equals(codeString))
559            if (codeString == null || "".equals(codeString))
560                return null;
561        if ("error".equals(codeString))
562          return ConstraintSeverity.ERROR;
563        if ("warning".equals(codeString))
564          return ConstraintSeverity.WARNING;
565        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
566        }
567        public Enumeration<ConstraintSeverity> fromType(Base code) throws FHIRException {
568          if (code == null || code.isEmpty())
569            return null;
570          String codeString = ((PrimitiveType) code).asStringValue();
571          if (codeString == null || "".equals(codeString))
572            return null;
573        if ("error".equals(codeString))
574          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR);
575        if ("warning".equals(codeString))
576          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING);
577        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
578        }
579    public String toCode(ConstraintSeverity code) {
580      if (code == ConstraintSeverity.ERROR)
581        return "error";
582      if (code == ConstraintSeverity.WARNING)
583        return "warning";
584      return "?";
585      }
586    public String toSystem(ConstraintSeverity code) {
587      return code.getSystem();
588      }
589    }
590
591    @Block()
592    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
593        /**
594         * 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.
595         */
596        @Child(name = "discriminator", type = {StringType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
597        @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." )
598        protected List<StringType> discriminator;
599
600        /**
601         * 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.
602         */
603        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
604        @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." )
605        protected StringType description;
606
607        /**
608         * If the matching elements have to occur in the same order as defined in the profile.
609         */
610        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
611        @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." )
612        protected BooleanType ordered;
613
614        /**
615         * 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.
616         */
617        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
618        @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." )
619        protected Enumeration<SlicingRules> rules;
620
621        private static final long serialVersionUID = 233544215L;
622
623    /**
624     * Constructor
625     */
626      public ElementDefinitionSlicingComponent() {
627        super();
628      }
629
630    /**
631     * Constructor
632     */
633      public ElementDefinitionSlicingComponent(Enumeration<SlicingRules> rules) {
634        super();
635        this.rules = rules;
636      }
637
638        /**
639         * @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.)
640         */
641        public List<StringType> getDiscriminator() { 
642          if (this.discriminator == null)
643            this.discriminator = new ArrayList<StringType>();
644          return this.discriminator;
645        }
646
647        public boolean hasDiscriminator() { 
648          if (this.discriminator == null)
649            return false;
650          for (StringType item : this.discriminator)
651            if (!item.isEmpty())
652              return true;
653          return false;
654        }
655
656        /**
657         * @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.)
658         */
659    // syntactic sugar
660        public StringType addDiscriminatorElement() {//2 
661          StringType t = new StringType();
662          if (this.discriminator == null)
663            this.discriminator = new ArrayList<StringType>();
664          this.discriminator.add(t);
665          return t;
666        }
667
668        /**
669         * @param value {@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.)
670         */
671        public ElementDefinitionSlicingComponent addDiscriminator(String value) { //1
672          StringType t = new StringType();
673          t.setValue(value);
674          if (this.discriminator == null)
675            this.discriminator = new ArrayList<StringType>();
676          this.discriminator.add(t);
677          return this;
678        }
679
680        /**
681         * @param value {@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.)
682         */
683        public boolean hasDiscriminator(String value) { 
684          if (this.discriminator == null)
685            return false;
686          for (StringType v : this.discriminator)
687            if (v.equals(value)) // string
688              return true;
689          return false;
690        }
691
692        /**
693         * @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
694         */
695        public StringType getDescriptionElement() { 
696          if (this.description == null)
697            if (Configuration.errorOnAutoCreate())
698              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
699            else if (Configuration.doAutoCreate())
700              this.description = new StringType(); // bb
701          return this.description;
702        }
703
704        public boolean hasDescriptionElement() { 
705          return this.description != null && !this.description.isEmpty();
706        }
707
708        public boolean hasDescription() { 
709          return this.description != null && !this.description.isEmpty();
710        }
711
712        /**
713         * @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
714         */
715        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
716          this.description = value;
717          return this;
718        }
719
720        /**
721         * @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.
722         */
723        public String getDescription() { 
724          return this.description == null ? null : this.description.getValue();
725        }
726
727        /**
728         * @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.
729         */
730        public ElementDefinitionSlicingComponent setDescription(String value) { 
731          if (Utilities.noString(value))
732            this.description = null;
733          else {
734            if (this.description == null)
735              this.description = new StringType();
736            this.description.setValue(value);
737          }
738          return this;
739        }
740
741        /**
742         * @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
743         */
744        public BooleanType getOrderedElement() { 
745          if (this.ordered == null)
746            if (Configuration.errorOnAutoCreate())
747              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
748            else if (Configuration.doAutoCreate())
749              this.ordered = new BooleanType(); // bb
750          return this.ordered;
751        }
752
753        public boolean hasOrderedElement() { 
754          return this.ordered != null && !this.ordered.isEmpty();
755        }
756
757        public boolean hasOrdered() { 
758          return this.ordered != null && !this.ordered.isEmpty();
759        }
760
761        /**
762         * @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
763         */
764        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
765          this.ordered = value;
766          return this;
767        }
768
769        /**
770         * @return If the matching elements have to occur in the same order as defined in the profile.
771         */
772        public boolean getOrdered() { 
773          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
774        }
775
776        /**
777         * @param value If the matching elements have to occur in the same order as defined in the profile.
778         */
779        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
780            if (this.ordered == null)
781              this.ordered = new BooleanType();
782            this.ordered.setValue(value);
783          return this;
784        }
785
786        /**
787         * @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
788         */
789        public Enumeration<SlicingRules> getRulesElement() { 
790          if (this.rules == null)
791            if (Configuration.errorOnAutoCreate())
792              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
793            else if (Configuration.doAutoCreate())
794              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
795          return this.rules;
796        }
797
798        public boolean hasRulesElement() { 
799          return this.rules != null && !this.rules.isEmpty();
800        }
801
802        public boolean hasRules() { 
803          return this.rules != null && !this.rules.isEmpty();
804        }
805
806        /**
807         * @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
808         */
809        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
810          this.rules = value;
811          return this;
812        }
813
814        /**
815         * @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.
816         */
817        public SlicingRules getRules() { 
818          return this.rules == null ? null : this.rules.getValue();
819        }
820
821        /**
822         * @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.
823         */
824        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
825            if (this.rules == null)
826              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
827            this.rules.setValue(value);
828          return this;
829        }
830
831        protected void listChildren(List<Property> childrenList) {
832          super.listChildren(childrenList);
833          childrenList.add(new Property("discriminator", "string", "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));
834          childrenList.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, java.lang.Integer.MAX_VALUE, description));
835          childrenList.add(new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, java.lang.Integer.MAX_VALUE, ordered));
836          childrenList.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, java.lang.Integer.MAX_VALUE, rules));
837        }
838
839      @Override
840      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
841        switch (hash) {
842        case -1888270692: /*discriminator*/ return this.discriminator == null ? new Base[0] : this.discriminator.toArray(new Base[this.discriminator.size()]); // StringType
843        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
844        case -1207109523: /*ordered*/ return this.ordered == null ? new Base[0] : new Base[] {this.ordered}; // BooleanType
845        case 108873975: /*rules*/ return this.rules == null ? new Base[0] : new Base[] {this.rules}; // Enumeration<SlicingRules>
846        default: return super.getProperty(hash, name, checkValid);
847        }
848
849      }
850
851      @Override
852      public void setProperty(int hash, String name, Base value) throws FHIRException {
853        switch (hash) {
854        case -1888270692: // discriminator
855          this.getDiscriminator().add(castToString(value)); // StringType
856          break;
857        case -1724546052: // description
858          this.description = castToString(value); // StringType
859          break;
860        case -1207109523: // ordered
861          this.ordered = castToBoolean(value); // BooleanType
862          break;
863        case 108873975: // rules
864          this.rules = new SlicingRulesEnumFactory().fromType(value); // Enumeration<SlicingRules>
865          break;
866        default: super.setProperty(hash, name, value);
867        }
868
869      }
870
871      @Override
872      public void setProperty(String name, Base value) throws FHIRException {
873        if (name.equals("discriminator"))
874          this.getDiscriminator().add(castToString(value));
875        else if (name.equals("description"))
876          this.description = castToString(value); // StringType
877        else if (name.equals("ordered"))
878          this.ordered = castToBoolean(value); // BooleanType
879        else if (name.equals("rules"))
880          this.rules = new SlicingRulesEnumFactory().fromType(value); // Enumeration<SlicingRules>
881        else
882          super.setProperty(name, value);
883      }
884
885      @Override
886      public Base makeProperty(int hash, String name) throws FHIRException {
887        switch (hash) {
888        case -1888270692: throw new FHIRException("Cannot make property discriminator as it is not a complex type"); // StringType
889        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
890        case -1207109523: throw new FHIRException("Cannot make property ordered as it is not a complex type"); // BooleanType
891        case 108873975: throw new FHIRException("Cannot make property rules as it is not a complex type"); // Enumeration<SlicingRules>
892        default: return super.makeProperty(hash, name);
893        }
894
895      }
896
897      @Override
898      public Base addChild(String name) throws FHIRException {
899        if (name.equals("discriminator")) {
900          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.discriminator");
901        }
902        else if (name.equals("description")) {
903          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
904        }
905        else if (name.equals("ordered")) {
906          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.ordered");
907        }
908        else if (name.equals("rules")) {
909          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.rules");
910        }
911        else
912          return super.addChild(name);
913      }
914
915      public ElementDefinitionSlicingComponent copy() {
916        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
917        copyValues(dst);
918        if (discriminator != null) {
919          dst.discriminator = new ArrayList<StringType>();
920          for (StringType i : discriminator)
921            dst.discriminator.add(i.copy());
922        };
923        dst.description = description == null ? null : description.copy();
924        dst.ordered = ordered == null ? null : ordered.copy();
925        dst.rules = rules == null ? null : rules.copy();
926        return dst;
927      }
928
929      @Override
930      public boolean equalsDeep(Base other) {
931        if (!super.equalsDeep(other))
932          return false;
933        if (!(other instanceof ElementDefinitionSlicingComponent))
934          return false;
935        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
936        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
937           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
938      }
939
940      @Override
941      public boolean equalsShallow(Base other) {
942        if (!super.equalsShallow(other))
943          return false;
944        if (!(other instanceof ElementDefinitionSlicingComponent))
945          return false;
946        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
947        return compareValues(discriminator, o.discriminator, true) && compareValues(description, o.description, true)
948           && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true);
949      }
950
951      public boolean isEmpty() {
952        return super.isEmpty() && (discriminator == null || discriminator.isEmpty()) && (description == null || description.isEmpty())
953           && (ordered == null || ordered.isEmpty()) && (rules == null || rules.isEmpty());
954      }
955
956  public String fhirType() {
957    return "ElementDefinition.slicing";
958
959  }
960
961  }
962
963    @Block()
964    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
965        /**
966         * 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]]] without a StructureDefinition.base.
967         */
968        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
969        @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]]] without a StructureDefinition.base." )
970        protected StringType path;
971
972        /**
973         * Minimum cardinality of the base element identified by the path.
974         */
975        @Child(name = "min", type = {IntegerType.class}, order=2, min=1, max=1, modifier=false, summary=true)
976        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
977        protected IntegerType min;
978
979        /**
980         * Maximum cardinality of the base element identified by the path.
981         */
982        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
983        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
984        protected StringType max;
985
986        private static final long serialVersionUID = 232204455L;
987
988    /**
989     * Constructor
990     */
991      public ElementDefinitionBaseComponent() {
992        super();
993      }
994
995    /**
996     * Constructor
997     */
998      public ElementDefinitionBaseComponent(StringType path, IntegerType min, StringType max) {
999        super();
1000        this.path = path;
1001        this.min = min;
1002        this.max = max;
1003      }
1004
1005        /**
1006         * @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]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1007         */
1008        public StringType getPathElement() { 
1009          if (this.path == null)
1010            if (Configuration.errorOnAutoCreate())
1011              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
1012            else if (Configuration.doAutoCreate())
1013              this.path = new StringType(); // bb
1014          return this.path;
1015        }
1016
1017        public boolean hasPathElement() { 
1018          return this.path != null && !this.path.isEmpty();
1019        }
1020
1021        public boolean hasPath() { 
1022          return this.path != null && !this.path.isEmpty();
1023        }
1024
1025        /**
1026         * @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]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1027         */
1028        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
1029          this.path = value;
1030          return this;
1031        }
1032
1033        /**
1034         * @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]]] without a StructureDefinition.base.
1035         */
1036        public String getPath() { 
1037          return this.path == null ? null : this.path.getValue();
1038        }
1039
1040        /**
1041         * @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]]] without a StructureDefinition.base.
1042         */
1043        public ElementDefinitionBaseComponent setPath(String value) { 
1044            if (this.path == null)
1045              this.path = new StringType();
1046            this.path.setValue(value);
1047          return this;
1048        }
1049
1050        /**
1051         * @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
1052         */
1053        public IntegerType getMinElement() { 
1054          if (this.min == null)
1055            if (Configuration.errorOnAutoCreate())
1056              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
1057            else if (Configuration.doAutoCreate())
1058              this.min = new IntegerType(); // bb
1059          return this.min;
1060        }
1061
1062        public boolean hasMinElement() { 
1063          return this.min != null && !this.min.isEmpty();
1064        }
1065
1066        public boolean hasMin() { 
1067          return this.min != null && !this.min.isEmpty();
1068        }
1069
1070        /**
1071         * @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
1072         */
1073        public ElementDefinitionBaseComponent setMinElement(IntegerType value) { 
1074          this.min = value;
1075          return this;
1076        }
1077
1078        /**
1079         * @return Minimum cardinality of the base element identified by the path.
1080         */
1081        public int getMin() { 
1082          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
1083        }
1084
1085        /**
1086         * @param value Minimum cardinality of the base element identified by the path.
1087         */
1088        public ElementDefinitionBaseComponent setMin(int value) { 
1089            if (this.min == null)
1090              this.min = new IntegerType();
1091            this.min.setValue(value);
1092          return this;
1093        }
1094
1095        /**
1096         * @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
1097         */
1098        public StringType getMaxElement() { 
1099          if (this.max == null)
1100            if (Configuration.errorOnAutoCreate())
1101              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
1102            else if (Configuration.doAutoCreate())
1103              this.max = new StringType(); // bb
1104          return this.max;
1105        }
1106
1107        public boolean hasMaxElement() { 
1108          return this.max != null && !this.max.isEmpty();
1109        }
1110
1111        public boolean hasMax() { 
1112          return this.max != null && !this.max.isEmpty();
1113        }
1114
1115        /**
1116         * @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
1117         */
1118        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
1119          this.max = value;
1120          return this;
1121        }
1122
1123        /**
1124         * @return Maximum cardinality of the base element identified by the path.
1125         */
1126        public String getMax() { 
1127          return this.max == null ? null : this.max.getValue();
1128        }
1129
1130        /**
1131         * @param value Maximum cardinality of the base element identified by the path.
1132         */
1133        public ElementDefinitionBaseComponent setMax(String value) { 
1134            if (this.max == null)
1135              this.max = new StringType();
1136            this.max.setValue(value);
1137          return this;
1138        }
1139
1140        protected void listChildren(List<Property> childrenList) {
1141          super.listChildren(childrenList);
1142          childrenList.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]]] without a StructureDefinition.base.", 0, java.lang.Integer.MAX_VALUE, path));
1143          childrenList.add(new Property("min", "integer", "Minimum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, min));
1144          childrenList.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, max));
1145        }
1146
1147      @Override
1148      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1149        switch (hash) {
1150        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1151        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
1152        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
1153        default: return super.getProperty(hash, name, checkValid);
1154        }
1155
1156      }
1157
1158      @Override
1159      public void setProperty(int hash, String name, Base value) throws FHIRException {
1160        switch (hash) {
1161        case 3433509: // path
1162          this.path = castToString(value); // StringType
1163          break;
1164        case 108114: // min
1165          this.min = castToInteger(value); // IntegerType
1166          break;
1167        case 107876: // max
1168          this.max = castToString(value); // StringType
1169          break;
1170        default: super.setProperty(hash, name, value);
1171        }
1172
1173      }
1174
1175      @Override
1176      public void setProperty(String name, Base value) throws FHIRException {
1177        if (name.equals("path"))
1178          this.path = castToString(value); // StringType
1179        else if (name.equals("min"))
1180          this.min = castToInteger(value); // IntegerType
1181        else if (name.equals("max"))
1182          this.max = castToString(value); // StringType
1183        else
1184          super.setProperty(name, value);
1185      }
1186
1187      @Override
1188      public Base makeProperty(int hash, String name) throws FHIRException {
1189        switch (hash) {
1190        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
1191        case 108114: throw new FHIRException("Cannot make property min as it is not a complex type"); // IntegerType
1192        case 107876: throw new FHIRException("Cannot make property max as it is not a complex type"); // StringType
1193        default: return super.makeProperty(hash, name);
1194        }
1195
1196      }
1197
1198      @Override
1199      public Base addChild(String name) throws FHIRException {
1200        if (name.equals("path")) {
1201          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
1202        }
1203        else if (name.equals("min")) {
1204          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
1205        }
1206        else if (name.equals("max")) {
1207          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
1208        }
1209        else
1210          return super.addChild(name);
1211      }
1212
1213      public ElementDefinitionBaseComponent copy() {
1214        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
1215        copyValues(dst);
1216        dst.path = path == null ? null : path.copy();
1217        dst.min = min == null ? null : min.copy();
1218        dst.max = max == null ? null : max.copy();
1219        return dst;
1220      }
1221
1222      @Override
1223      public boolean equalsDeep(Base other) {
1224        if (!super.equalsDeep(other))
1225          return false;
1226        if (!(other instanceof ElementDefinitionBaseComponent))
1227          return false;
1228        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
1229        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
1230          ;
1231      }
1232
1233      @Override
1234      public boolean equalsShallow(Base other) {
1235        if (!super.equalsShallow(other))
1236          return false;
1237        if (!(other instanceof ElementDefinitionBaseComponent))
1238          return false;
1239        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
1240        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
1241          ;
1242      }
1243
1244      public boolean isEmpty() {
1245        return super.isEmpty() && (path == null || path.isEmpty()) && (min == null || min.isEmpty())
1246           && (max == null || max.isEmpty());
1247      }
1248
1249  public String fhirType() {
1250    return "ElementDefinition.base";
1251
1252  }
1253
1254  }
1255
1256    @Block()
1257    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
1258        /**
1259         * Name of Data type or Resource that is a(or the) type used for this element.
1260         */
1261        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1262        @Description(shortDefinition="Name of Data type or Resource", formalDefinition="Name of Data type or Resource that is a(or the) type used for this element." )
1263        protected CodeType code;
1264
1265        /**
1266         * Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.
1267         */
1268        @Child(name = "profile", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1269        @Description(shortDefinition="Profile (StructureDefinition) to apply (or IG)", formalDefinition="Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide." )
1270        protected List<UriType> profile;
1271
1272        /**
1273         * 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.
1274         */
1275        @Child(name = "aggregation", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1276        @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." )
1277        protected List<Enumeration<AggregationMode>> aggregation;
1278
1279        /**
1280         * Whether this reference needs to be version specific or version independent, or whetehr either can be used.
1281         */
1282        @Child(name = "versioning", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1283        @Description(shortDefinition="either | independent | specific", formalDefinition="Whether this reference needs to be version specific or version independent, or whetehr either can be used." )
1284        protected Enumeration<ReferenceVersionRules> versioning;
1285
1286        private static final long serialVersionUID = -829583924L;
1287
1288    /**
1289     * Constructor
1290     */
1291      public TypeRefComponent() {
1292        super();
1293      }
1294
1295    /**
1296     * Constructor
1297     */
1298      public TypeRefComponent(CodeType code) {
1299        super();
1300        this.code = code;
1301      }
1302
1303        /**
1304         * @return {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1305         */
1306        public CodeType getCodeElement() { 
1307          if (this.code == null)
1308            if (Configuration.errorOnAutoCreate())
1309              throw new Error("Attempt to auto-create TypeRefComponent.code");
1310            else if (Configuration.doAutoCreate())
1311              this.code = new CodeType(); // bb
1312          return this.code;
1313        }
1314
1315        public boolean hasCodeElement() { 
1316          return this.code != null && !this.code.isEmpty();
1317        }
1318
1319        public boolean hasCode() { 
1320          return this.code != null && !this.code.isEmpty();
1321        }
1322
1323        /**
1324         * @param value {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1325         */
1326        public TypeRefComponent setCodeElement(CodeType value) { 
1327          this.code = value;
1328          return this;
1329        }
1330
1331        /**
1332         * @return Name of Data type or Resource that is a(or the) type used for this element.
1333         */
1334        public String getCode() { 
1335          return this.code == null ? null : this.code.getValue();
1336        }
1337
1338        /**
1339         * @param value Name of Data type or Resource that is a(or the) type used for this element.
1340         */
1341        public TypeRefComponent setCode(String value) { 
1342            if (this.code == null)
1343              this.code = new CodeType();
1344            this.code.setValue(value);
1345          return this;
1346        }
1347
1348        /**
1349         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1350         */
1351        public List<UriType> getProfile() { 
1352          if (this.profile == null)
1353            this.profile = new ArrayList<UriType>();
1354          return this.profile;
1355        }
1356
1357        public boolean hasProfile() { 
1358          if (this.profile == null)
1359            return false;
1360          for (UriType item : this.profile)
1361            if (!item.isEmpty())
1362              return true;
1363          return false;
1364        }
1365
1366        /**
1367         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1368         */
1369    // syntactic sugar
1370        public UriType addProfileElement() {//2 
1371          UriType t = new UriType();
1372          if (this.profile == null)
1373            this.profile = new ArrayList<UriType>();
1374          this.profile.add(t);
1375          return t;
1376        }
1377
1378        /**
1379         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1380         */
1381        public TypeRefComponent addProfile(String value) { //1
1382          UriType t = new UriType();
1383          t.setValue(value);
1384          if (this.profile == null)
1385            this.profile = new ArrayList<UriType>();
1386          this.profile.add(t);
1387          return this;
1388        }
1389
1390        /**
1391         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1392         */
1393        public boolean hasProfile(String value) { 
1394          if (this.profile == null)
1395            return false;
1396          for (UriType v : this.profile)
1397            if (v.equals(value)) // uri
1398              return true;
1399          return false;
1400        }
1401
1402        /**
1403         * @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.)
1404         */
1405        public List<Enumeration<AggregationMode>> getAggregation() { 
1406          if (this.aggregation == null)
1407            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1408          return this.aggregation;
1409        }
1410
1411        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> aggregation) {
1412            this.aggregation = aggregation;
1413            return this;
1414        }
1415
1416        public boolean hasAggregation() {
1417          if (this.aggregation == null)
1418            return false;
1419          for (Enumeration<AggregationMode> item : this.aggregation)
1420            if (!item.isEmpty())
1421              return true;
1422          return false;
1423        }
1424
1425        /**
1426         * @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.)
1427         */
1428    // syntactic sugar
1429        public Enumeration<AggregationMode> addAggregationElement() {//2 
1430          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1431          if (this.aggregation == null)
1432            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1433          this.aggregation.add(t);
1434          return t;
1435        }
1436
1437        /**
1438         * @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.)
1439         */
1440        public TypeRefComponent addAggregation(AggregationMode value) { //1
1441          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1442          t.setValue(value);
1443          if (this.aggregation == null)
1444            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1445          this.aggregation.add(t);
1446          return this;
1447        }
1448
1449        /**
1450         * @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.)
1451         */
1452        public boolean hasAggregation(AggregationMode value) { 
1453          if (this.aggregation == null)
1454            return false;
1455          for (Enumeration<AggregationMode> v : this.aggregation)
1456            if (v.getValue().equals(value)) // code
1457              return true;
1458          return false;
1459        }
1460
1461        /**
1462         * @return {@link #versioning} (Whether this reference needs to be version specific or version independent, or whetehr either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
1463         */
1464        public Enumeration<ReferenceVersionRules> getVersioningElement() { 
1465          if (this.versioning == null)
1466            if (Configuration.errorOnAutoCreate())
1467              throw new Error("Attempt to auto-create TypeRefComponent.versioning");
1468            else if (Configuration.doAutoCreate())
1469              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory()); // bb
1470          return this.versioning;
1471        }
1472
1473        public boolean hasVersioningElement() { 
1474          return this.versioning != null && !this.versioning.isEmpty();
1475        }
1476
1477        public boolean hasVersioning() { 
1478          return this.versioning != null && !this.versioning.isEmpty();
1479        }
1480
1481        /**
1482         * @param value {@link #versioning} (Whether this reference needs to be version specific or version independent, or whetehr either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
1483         */
1484        public TypeRefComponent setVersioningElement(Enumeration<ReferenceVersionRules> value) { 
1485          this.versioning = value;
1486          return this;
1487        }
1488
1489        /**
1490         * @return Whether this reference needs to be version specific or version independent, or whetehr either can be used.
1491         */
1492        public ReferenceVersionRules getVersioning() { 
1493          return this.versioning == null ? null : this.versioning.getValue();
1494        }
1495
1496        /**
1497         * @param value Whether this reference needs to be version specific or version independent, or whetehr either can be used.
1498         */
1499        public TypeRefComponent setVersioning(ReferenceVersionRules value) { 
1500          if (value == null)
1501            this.versioning = null;
1502          else {
1503            if (this.versioning == null)
1504              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory());
1505            this.versioning.setValue(value);
1506          }
1507          return this;
1508        }
1509
1510        protected void listChildren(List<Property> childrenList) {
1511          super.listChildren(childrenList);
1512          childrenList.add(new Property("code", "code", "Name of Data type or Resource that is a(or the) type used for this element.", 0, java.lang.Integer.MAX_VALUE, code));
1513          childrenList.add(new Property("profile", "uri", "Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile));
1514          childrenList.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));
1515          childrenList.add(new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whetehr either can be used.", 0, java.lang.Integer.MAX_VALUE, versioning));
1516        }
1517
1518      @Override
1519      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1520        switch (hash) {
1521        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
1522        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // UriType
1523        case 841524962: /*aggregation*/ return this.aggregation == null ? new Base[0] : this.aggregation.toArray(new Base[this.aggregation.size()]); // Enumeration<AggregationMode>
1524        case -670487542: /*versioning*/ return this.versioning == null ? new Base[0] : new Base[] {this.versioning}; // Enumeration<ReferenceVersionRules>
1525        default: return super.getProperty(hash, name, checkValid);
1526        }
1527
1528      }
1529
1530      @Override
1531      public void setProperty(int hash, String name, Base value) throws FHIRException {
1532        switch (hash) {
1533        case 3059181: // code
1534          this.code = castToCode(value); // CodeType
1535          break;
1536        case -309425751: // profile
1537          this.getProfile().add(castToUri(value)); // UriType
1538          break;
1539        case 841524962: // aggregation
1540          this.getAggregation().add(new AggregationModeEnumFactory().fromType(value)); // Enumeration<AggregationMode>
1541          break;
1542        case -670487542: // versioning
1543          this.versioning = new ReferenceVersionRulesEnumFactory().fromType(value); // Enumeration<ReferenceVersionRules>
1544          break;
1545        default: super.setProperty(hash, name, value);
1546        }
1547
1548      }
1549
1550      @Override
1551      public void setProperty(String name, Base value) throws FHIRException {
1552        if (name.equals("code"))
1553          this.code = castToCode(value); // CodeType
1554        else if (name.equals("profile"))
1555          this.getProfile().add(castToUri(value));
1556        else if (name.equals("aggregation"))
1557          this.getAggregation().add(new AggregationModeEnumFactory().fromType(value));
1558        else if (name.equals("versioning"))
1559          this.versioning = new ReferenceVersionRulesEnumFactory().fromType(value); // Enumeration<ReferenceVersionRules>
1560        else
1561          super.setProperty(name, value);
1562      }
1563
1564      @Override
1565      public Base makeProperty(int hash, String name) throws FHIRException {
1566        switch (hash) {
1567        case 3059181: throw new FHIRException("Cannot make property code as it is not a complex type"); // CodeType
1568        case -309425751: throw new FHIRException("Cannot make property profile as it is not a complex type"); // UriType
1569        case 841524962: throw new FHIRException("Cannot make property aggregation as it is not a complex type"); // Enumeration<AggregationMode>
1570        case -670487542: throw new FHIRException("Cannot make property versioning as it is not a complex type"); // Enumeration<ReferenceVersionRules>
1571        default: return super.makeProperty(hash, name);
1572        }
1573
1574      }
1575
1576      @Override
1577      public Base addChild(String name) throws FHIRException {
1578        if (name.equals("code")) {
1579          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.code");
1580        }
1581        else if (name.equals("profile")) {
1582          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.profile");
1583        }
1584        else if (name.equals("aggregation")) {
1585          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.aggregation");
1586        }
1587        else if (name.equals("versioning")) {
1588          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.versioning");
1589        }
1590        else
1591          return super.addChild(name);
1592      }
1593
1594      public TypeRefComponent copy() {
1595        TypeRefComponent dst = new TypeRefComponent();
1596        copyValues(dst);
1597        dst.code = code == null ? null : code.copy();
1598        if (profile != null) {
1599          dst.profile = new ArrayList<UriType>();
1600          for (UriType i : profile)
1601            dst.profile.add(i.copy());
1602        };
1603        if (aggregation != null) {
1604          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1605          for (Enumeration<AggregationMode> i : aggregation)
1606            dst.aggregation.add(i.copy());
1607        };
1608        dst.versioning = versioning == null ? null : versioning.copy();
1609        return dst;
1610      }
1611
1612      @Override
1613      public boolean equalsDeep(Base other) {
1614        if (!super.equalsDeep(other))
1615          return false;
1616        if (!(other instanceof TypeRefComponent))
1617          return false;
1618        TypeRefComponent o = (TypeRefComponent) other;
1619        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(aggregation, o.aggregation, true)
1620           && compareDeep(versioning, o.versioning, true);
1621      }
1622
1623      @Override
1624      public boolean equalsShallow(Base other) {
1625        if (!super.equalsShallow(other))
1626          return false;
1627        if (!(other instanceof TypeRefComponent))
1628          return false;
1629        TypeRefComponent o = (TypeRefComponent) other;
1630        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(aggregation, o.aggregation, true)
1631           && compareValues(versioning, o.versioning, true);
1632      }
1633
1634      public boolean isEmpty() {
1635        return super.isEmpty() && (code == null || code.isEmpty()) && (profile == null || profile.isEmpty())
1636           && (aggregation == null || aggregation.isEmpty()) && (versioning == null || versioning.isEmpty())
1637          ;
1638      }
1639
1640  public String fhirType() {
1641    return "ElementDefinition.type";
1642
1643  }
1644
1645  public boolean hasTarget() {
1646    return Utilities.existsInList(getCode(), "Reference");
1647  }
1648
1649  }
1650
1651    @Block()
1652    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
1653        /**
1654         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1655         */
1656        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1657        @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." )
1658        protected IdType key;
1659
1660        /**
1661         * Description of why this constraint is necessary or appropriate.
1662         */
1663        @Child(name = "requirements", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1664        @Description(shortDefinition="Why this constraint is necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
1665        protected StringType requirements;
1666
1667        /**
1668         * Identifies the impact constraint violation has on the conformance of the instance.
1669         */
1670        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1671        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
1672        protected Enumeration<ConstraintSeverity> severity;
1673
1674        /**
1675         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1676         */
1677        @Child(name = "human", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1678        @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." )
1679        protected StringType human;
1680
1681        /**
1682         * A [FluentPath](fluentpath.html) expression of constraint that can be executed to see if this constraint is met.
1683         */
1684        @Child(name = "expression", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1685        @Description(shortDefinition="FluentPath expression of constraint", formalDefinition="A [FluentPath](fluentpath.html) expression of constraint that can be executed to see if this constraint is met." )
1686        protected StringType expression;
1687
1688        /**
1689         * An XPath expression of constraint that can be executed to see if this constraint is met.
1690         */
1691        @Child(name = "xpath", type = {StringType.class}, order=6, min=1, max=1, modifier=false, summary=true)
1692        @Description(shortDefinition="XPath expression of constraint", formalDefinition="An XPath expression of constraint that can be executed to see if this constraint is met." )
1693        protected StringType xpath;
1694
1695        private static final long serialVersionUID = -1412249932L;
1696
1697    /**
1698     * Constructor
1699     */
1700      public ElementDefinitionConstraintComponent() {
1701        super();
1702      }
1703
1704    /**
1705     * Constructor
1706     */
1707      public ElementDefinitionConstraintComponent(IdType key, Enumeration<ConstraintSeverity> severity, StringType human, StringType xpath) {
1708        super();
1709        this.key = key;
1710        this.severity = severity;
1711        this.human = human;
1712        this.xpath = xpath;
1713      }
1714
1715        /**
1716         * @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
1717         */
1718        public IdType getKeyElement() { 
1719          if (this.key == null)
1720            if (Configuration.errorOnAutoCreate())
1721              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
1722            else if (Configuration.doAutoCreate())
1723              this.key = new IdType(); // bb
1724          return this.key;
1725        }
1726
1727        public boolean hasKeyElement() { 
1728          return this.key != null && !this.key.isEmpty();
1729        }
1730
1731        public boolean hasKey() { 
1732          return this.key != null && !this.key.isEmpty();
1733        }
1734
1735        /**
1736         * @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
1737         */
1738        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
1739          this.key = value;
1740          return this;
1741        }
1742
1743        /**
1744         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1745         */
1746        public String getKey() { 
1747          return this.key == null ? null : this.key.getValue();
1748        }
1749
1750        /**
1751         * @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.
1752         */
1753        public ElementDefinitionConstraintComponent setKey(String value) { 
1754            if (this.key == null)
1755              this.key = new IdType();
1756            this.key.setValue(value);
1757          return this;
1758        }
1759
1760        /**
1761         * @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
1762         */
1763        public StringType getRequirementsElement() { 
1764          if (this.requirements == null)
1765            if (Configuration.errorOnAutoCreate())
1766              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
1767            else if (Configuration.doAutoCreate())
1768              this.requirements = new StringType(); // bb
1769          return this.requirements;
1770        }
1771
1772        public boolean hasRequirementsElement() { 
1773          return this.requirements != null && !this.requirements.isEmpty();
1774        }
1775
1776        public boolean hasRequirements() { 
1777          return this.requirements != null && !this.requirements.isEmpty();
1778        }
1779
1780        /**
1781         * @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
1782         */
1783        public ElementDefinitionConstraintComponent setRequirementsElement(StringType value) { 
1784          this.requirements = value;
1785          return this;
1786        }
1787
1788        /**
1789         * @return Description of why this constraint is necessary or appropriate.
1790         */
1791        public String getRequirements() { 
1792          return this.requirements == null ? null : this.requirements.getValue();
1793        }
1794
1795        /**
1796         * @param value Description of why this constraint is necessary or appropriate.
1797         */
1798        public ElementDefinitionConstraintComponent setRequirements(String value) { 
1799          if (Utilities.noString(value))
1800            this.requirements = null;
1801          else {
1802            if (this.requirements == null)
1803              this.requirements = new StringType();
1804            this.requirements.setValue(value);
1805          }
1806          return this;
1807        }
1808
1809        /**
1810         * @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
1811         */
1812        public Enumeration<ConstraintSeverity> getSeverityElement() { 
1813          if (this.severity == null)
1814            if (Configuration.errorOnAutoCreate())
1815              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
1816            else if (Configuration.doAutoCreate())
1817              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
1818          return this.severity;
1819        }
1820
1821        public boolean hasSeverityElement() { 
1822          return this.severity != null && !this.severity.isEmpty();
1823        }
1824
1825        public boolean hasSeverity() { 
1826          return this.severity != null && !this.severity.isEmpty();
1827        }
1828
1829        /**
1830         * @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
1831         */
1832        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
1833          this.severity = value;
1834          return this;
1835        }
1836
1837        /**
1838         * @return Identifies the impact constraint violation has on the conformance of the instance.
1839         */
1840        public ConstraintSeverity getSeverity() { 
1841          return this.severity == null ? null : this.severity.getValue();
1842        }
1843
1844        /**
1845         * @param value Identifies the impact constraint violation has on the conformance of the instance.
1846         */
1847        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
1848            if (this.severity == null)
1849              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
1850            this.severity.setValue(value);
1851          return this;
1852        }
1853
1854        /**
1855         * @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
1856         */
1857        public StringType getHumanElement() { 
1858          if (this.human == null)
1859            if (Configuration.errorOnAutoCreate())
1860              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
1861            else if (Configuration.doAutoCreate())
1862              this.human = new StringType(); // bb
1863          return this.human;
1864        }
1865
1866        public boolean hasHumanElement() { 
1867          return this.human != null && !this.human.isEmpty();
1868        }
1869
1870        public boolean hasHuman() { 
1871          return this.human != null && !this.human.isEmpty();
1872        }
1873
1874        /**
1875         * @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
1876         */
1877        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
1878          this.human = value;
1879          return this;
1880        }
1881
1882        /**
1883         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1884         */
1885        public String getHuman() { 
1886          return this.human == null ? null : this.human.getValue();
1887        }
1888
1889        /**
1890         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1891         */
1892        public ElementDefinitionConstraintComponent setHuman(String value) { 
1893            if (this.human == null)
1894              this.human = new StringType();
1895            this.human.setValue(value);
1896          return this;
1897        }
1898
1899        /**
1900         * @return {@link #expression} (A [FluentPath](fluentpath.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
1901         */
1902        public StringType getExpressionElement() { 
1903          if (this.expression == null)
1904            if (Configuration.errorOnAutoCreate())
1905              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.expression");
1906            else if (Configuration.doAutoCreate())
1907              this.expression = new StringType(); // bb
1908          return this.expression;
1909        }
1910
1911        public boolean hasExpressionElement() { 
1912          return this.expression != null && !this.expression.isEmpty();
1913        }
1914
1915        public boolean hasExpression() { 
1916          return this.expression != null && !this.expression.isEmpty();
1917        }
1918
1919        /**
1920         * @param value {@link #expression} (A [FluentPath](fluentpath.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
1921         */
1922        public ElementDefinitionConstraintComponent setExpressionElement(StringType value) { 
1923          this.expression = value;
1924          return this;
1925        }
1926
1927        /**
1928         * @return A [FluentPath](fluentpath.html) expression of constraint that can be executed to see if this constraint is met.
1929         */
1930        public String getExpression() { 
1931          return this.expression == null ? null : this.expression.getValue();
1932        }
1933
1934        /**
1935         * @param value A [FluentPath](fluentpath.html) expression of constraint that can be executed to see if this constraint is met.
1936         */
1937        public ElementDefinitionConstraintComponent setExpression(String value) { 
1938          if (Utilities.noString(value))
1939            this.expression = null;
1940          else {
1941            if (this.expression == null)
1942              this.expression = new StringType();
1943            this.expression.setValue(value);
1944          }
1945          return this;
1946        }
1947
1948        /**
1949         * @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
1950         */
1951        public StringType getXpathElement() { 
1952          if (this.xpath == null)
1953            if (Configuration.errorOnAutoCreate())
1954              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.xpath");
1955            else if (Configuration.doAutoCreate())
1956              this.xpath = new StringType(); // bb
1957          return this.xpath;
1958        }
1959
1960        public boolean hasXpathElement() { 
1961          return this.xpath != null && !this.xpath.isEmpty();
1962        }
1963
1964        public boolean hasXpath() { 
1965          return this.xpath != null && !this.xpath.isEmpty();
1966        }
1967
1968        /**
1969         * @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
1970         */
1971        public ElementDefinitionConstraintComponent setXpathElement(StringType value) { 
1972          this.xpath = value;
1973          return this;
1974        }
1975
1976        /**
1977         * @return An XPath expression of constraint that can be executed to see if this constraint is met.
1978         */
1979        public String getXpath() { 
1980          return this.xpath == null ? null : this.xpath.getValue();
1981        }
1982
1983        /**
1984         * @param value An XPath expression of constraint that can be executed to see if this constraint is met.
1985         */
1986        public ElementDefinitionConstraintComponent setXpath(String value) { 
1987            if (this.xpath == null)
1988              this.xpath = new StringType();
1989            this.xpath.setValue(value);
1990          return this;
1991        }
1992
1993        protected void listChildren(List<Property> childrenList) {
1994          super.listChildren(childrenList);
1995          childrenList.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, java.lang.Integer.MAX_VALUE, key));
1996          childrenList.add(new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, requirements));
1997          childrenList.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, java.lang.Integer.MAX_VALUE, severity));
1998          childrenList.add(new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, java.lang.Integer.MAX_VALUE, human));
1999          childrenList.add(new Property("expression", "string", "A [FluentPath](fluentpath.html) expression of constraint that can be executed to see if this constraint is met.", 0, java.lang.Integer.MAX_VALUE, expression));
2000          childrenList.add(new Property("xpath", "string", "An XPath expression of constraint that can be executed to see if this constraint is met.", 0, java.lang.Integer.MAX_VALUE, xpath));
2001        }
2002
2003      @Override
2004      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2005        switch (hash) {
2006        case 106079: /*key*/ return this.key == null ? new Base[0] : new Base[] {this.key}; // IdType
2007        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // StringType
2008        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<ConstraintSeverity>
2009        case 99639597: /*human*/ return this.human == null ? new Base[0] : new Base[] {this.human}; // StringType
2010        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
2011        case 114256029: /*xpath*/ return this.xpath == null ? new Base[0] : new Base[] {this.xpath}; // StringType
2012        default: return super.getProperty(hash, name, checkValid);
2013        }
2014
2015      }
2016
2017      @Override
2018      public void setProperty(int hash, String name, Base value) throws FHIRException {
2019        switch (hash) {
2020        case 106079: // key
2021          this.key = castToId(value); // IdType
2022          break;
2023        case -1619874672: // requirements
2024          this.requirements = castToString(value); // StringType
2025          break;
2026        case 1478300413: // severity
2027          this.severity = new ConstraintSeverityEnumFactory().fromType(value); // Enumeration<ConstraintSeverity>
2028          break;
2029        case 99639597: // human
2030          this.human = castToString(value); // StringType
2031          break;
2032        case -1795452264: // expression
2033          this.expression = castToString(value); // StringType
2034          break;
2035        case 114256029: // xpath
2036          this.xpath = castToString(value); // StringType
2037          break;
2038        default: super.setProperty(hash, name, value);
2039        }
2040
2041      }
2042
2043      @Override
2044      public void setProperty(String name, Base value) throws FHIRException {
2045        if (name.equals("key"))
2046          this.key = castToId(value); // IdType
2047        else if (name.equals("requirements"))
2048          this.requirements = castToString(value); // StringType
2049        else if (name.equals("severity"))
2050          this.severity = new ConstraintSeverityEnumFactory().fromType(value); // Enumeration<ConstraintSeverity>
2051        else if (name.equals("human"))
2052          this.human = castToString(value); // StringType
2053        else if (name.equals("expression"))
2054          this.expression = castToString(value); // StringType
2055        else if (name.equals("xpath"))
2056          this.xpath = castToString(value); // StringType
2057        else
2058          super.setProperty(name, value);
2059      }
2060
2061      @Override
2062      public Base makeProperty(int hash, String name) throws FHIRException {
2063        switch (hash) {
2064        case 106079: throw new FHIRException("Cannot make property key as it is not a complex type"); // IdType
2065        case -1619874672: throw new FHIRException("Cannot make property requirements as it is not a complex type"); // StringType
2066        case 1478300413: throw new FHIRException("Cannot make property severity as it is not a complex type"); // Enumeration<ConstraintSeverity>
2067        case 99639597: throw new FHIRException("Cannot make property human as it is not a complex type"); // StringType
2068        case -1795452264: throw new FHIRException("Cannot make property expression as it is not a complex type"); // StringType
2069        case 114256029: throw new FHIRException("Cannot make property xpath as it is not a complex type"); // StringType
2070        default: return super.makeProperty(hash, name);
2071        }
2072
2073      }
2074
2075      @Override
2076      public Base addChild(String name) throws FHIRException {
2077        if (name.equals("key")) {
2078          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.key");
2079        }
2080        else if (name.equals("requirements")) {
2081          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
2082        }
2083        else if (name.equals("severity")) {
2084          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.severity");
2085        }
2086        else if (name.equals("human")) {
2087          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.human");
2088        }
2089        else if (name.equals("expression")) {
2090          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.expression");
2091        }
2092        else if (name.equals("xpath")) {
2093          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.xpath");
2094        }
2095        else
2096          return super.addChild(name);
2097      }
2098
2099      public ElementDefinitionConstraintComponent copy() {
2100        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
2101        copyValues(dst);
2102        dst.key = key == null ? null : key.copy();
2103        dst.requirements = requirements == null ? null : requirements.copy();
2104        dst.severity = severity == null ? null : severity.copy();
2105        dst.human = human == null ? null : human.copy();
2106        dst.expression = expression == null ? null : expression.copy();
2107        dst.xpath = xpath == null ? null : xpath.copy();
2108        return dst;
2109      }
2110
2111      @Override
2112      public boolean equalsDeep(Base other) {
2113        if (!super.equalsDeep(other))
2114          return false;
2115        if (!(other instanceof ElementDefinitionConstraintComponent))
2116          return false;
2117        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
2118        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
2119           && compareDeep(human, o.human, true) && compareDeep(expression, o.expression, true) && compareDeep(xpath, o.xpath, true)
2120          ;
2121      }
2122
2123      @Override
2124      public boolean equalsShallow(Base other) {
2125        if (!super.equalsShallow(other))
2126          return false;
2127        if (!(other instanceof ElementDefinitionConstraintComponent))
2128          return false;
2129        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
2130        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
2131           && compareValues(human, o.human, true) && compareValues(expression, o.expression, true) && compareValues(xpath, o.xpath, true)
2132          ;
2133      }
2134
2135      public boolean isEmpty() {
2136        return super.isEmpty() && (key == null || key.isEmpty()) && (requirements == null || requirements.isEmpty())
2137           && (severity == null || severity.isEmpty()) && (human == null || human.isEmpty()) && (expression == null || expression.isEmpty())
2138           && (xpath == null || xpath.isEmpty());
2139      }
2140
2141  public String fhirType() {
2142    return "ElementDefinition.constraint";
2143
2144  }
2145
2146  }
2147
2148    @Block()
2149    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
2150        /**
2151         * 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.
2152         */
2153        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2154        @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." )
2155        protected Enumeration<BindingStrength> strength;
2156
2157        /**
2158         * Describes the intended use of this particular set of codes.
2159         */
2160        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2161        @Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
2162        protected StringType description;
2163
2164        /**
2165         * Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.
2166         */
2167        @Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1, modifier=false, summary=true)
2168        @Description(shortDefinition="Source of value set", formalDefinition="Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used." )
2169        protected Type valueSet;
2170
2171        private static final long serialVersionUID = 1355538460L;
2172
2173    /**
2174     * Constructor
2175     */
2176      public ElementDefinitionBindingComponent() {
2177        super();
2178      }
2179
2180    /**
2181     * Constructor
2182     */
2183      public ElementDefinitionBindingComponent(Enumeration<BindingStrength> strength) {
2184        super();
2185        this.strength = strength;
2186      }
2187
2188        /**
2189         * @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
2190         */
2191        public Enumeration<BindingStrength> getStrengthElement() { 
2192          if (this.strength == null)
2193            if (Configuration.errorOnAutoCreate())
2194              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
2195            else if (Configuration.doAutoCreate())
2196              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
2197          return this.strength;
2198        }
2199
2200        public boolean hasStrengthElement() { 
2201          return this.strength != null && !this.strength.isEmpty();
2202        }
2203
2204        public boolean hasStrength() { 
2205          return this.strength != null && !this.strength.isEmpty();
2206        }
2207
2208        /**
2209         * @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
2210         */
2211        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
2212          this.strength = value;
2213          return this;
2214        }
2215
2216        /**
2217         * @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.
2218         */
2219        public BindingStrength getStrength() { 
2220          return this.strength == null ? null : this.strength.getValue();
2221        }
2222
2223        /**
2224         * @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.
2225         */
2226        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
2227            if (this.strength == null)
2228              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
2229            this.strength.setValue(value);
2230          return this;
2231        }
2232
2233        /**
2234         * @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
2235         */
2236        public StringType getDescriptionElement() { 
2237          if (this.description == null)
2238            if (Configuration.errorOnAutoCreate())
2239              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
2240            else if (Configuration.doAutoCreate())
2241              this.description = new StringType(); // bb
2242          return this.description;
2243        }
2244
2245        public boolean hasDescriptionElement() { 
2246          return this.description != null && !this.description.isEmpty();
2247        }
2248
2249        public boolean hasDescription() { 
2250          return this.description != null && !this.description.isEmpty();
2251        }
2252
2253        /**
2254         * @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
2255         */
2256        public ElementDefinitionBindingComponent setDescriptionElement(StringType value) { 
2257          this.description = value;
2258          return this;
2259        }
2260
2261        /**
2262         * @return Describes the intended use of this particular set of codes.
2263         */
2264        public String getDescription() { 
2265          return this.description == null ? null : this.description.getValue();
2266        }
2267
2268        /**
2269         * @param value Describes the intended use of this particular set of codes.
2270         */
2271        public ElementDefinitionBindingComponent setDescription(String value) { 
2272          if (Utilities.noString(value))
2273            this.description = null;
2274          else {
2275            if (this.description == null)
2276              this.description = new StringType();
2277            this.description.setValue(value);
2278          }
2279          return this;
2280        }
2281
2282        /**
2283         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
2284         */
2285        public Type getValueSet() { 
2286          return this.valueSet;
2287        }
2288
2289        /**
2290         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
2291         */
2292        public UriType getValueSetUriType() throws FHIRException { 
2293          if (!(this.valueSet instanceof UriType))
2294            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
2295          return (UriType) this.valueSet;
2296        }
2297
2298        public boolean hasValueSetUriType() { 
2299          return this.valueSet instanceof UriType;
2300        }
2301
2302        /**
2303         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
2304         */
2305        public Reference getValueSetReference() throws FHIRException { 
2306          if (!(this.valueSet instanceof Reference))
2307            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
2308          return (Reference) this.valueSet;
2309        }
2310
2311        public boolean hasValueSetReference() { 
2312          return this.valueSet instanceof Reference;
2313        }
2314
2315        public boolean hasValueSet() { 
2316          return this.valueSet != null && !this.valueSet.isEmpty();
2317        }
2318
2319        /**
2320         * @param value {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
2321         */
2322        public ElementDefinitionBindingComponent setValueSet(Type value) { 
2323          this.valueSet = value;
2324          return this;
2325        }
2326
2327        protected void listChildren(List<Property> childrenList) {
2328          super.listChildren(childrenList);
2329          childrenList.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, java.lang.Integer.MAX_VALUE, strength));
2330          childrenList.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, java.lang.Integer.MAX_VALUE, description));
2331          childrenList.add(new Property("valueSet[x]", "uri|Reference(ValueSet)", "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.", 0, java.lang.Integer.MAX_VALUE, valueSet));
2332        }
2333
2334      @Override
2335      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2336        switch (hash) {
2337        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Enumeration<BindingStrength>
2338        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2339        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type
2340        default: return super.getProperty(hash, name, checkValid);
2341        }
2342
2343      }
2344
2345      @Override
2346      public void setProperty(int hash, String name, Base value) throws FHIRException {
2347        switch (hash) {
2348        case 1791316033: // strength
2349          this.strength = new BindingStrengthEnumFactory().fromType(value); // Enumeration<BindingStrength>
2350          break;
2351        case -1724546052: // description
2352          this.description = castToString(value); // StringType
2353          break;
2354        case -1410174671: // valueSet
2355          this.valueSet = (Type) value; // Type
2356          break;
2357        default: super.setProperty(hash, name, value);
2358        }
2359
2360      }
2361
2362      @Override
2363      public void setProperty(String name, Base value) throws FHIRException {
2364        if (name.equals("strength"))
2365          this.strength = new BindingStrengthEnumFactory().fromType(value); // Enumeration<BindingStrength>
2366        else if (name.equals("description"))
2367          this.description = castToString(value); // StringType
2368        else if (name.equals("valueSet[x]"))
2369          this.valueSet = (Type) value; // Type
2370        else
2371          super.setProperty(name, value);
2372      }
2373
2374      @Override
2375      public Base makeProperty(int hash, String name) throws FHIRException {
2376        switch (hash) {
2377        case 1791316033: throw new FHIRException("Cannot make property strength as it is not a complex type"); // Enumeration<BindingStrength>
2378        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
2379        case -1438410321:  return getValueSet(); // Type
2380        default: return super.makeProperty(hash, name);
2381        }
2382
2383      }
2384
2385      @Override
2386      public Base addChild(String name) throws FHIRException {
2387        if (name.equals("strength")) {
2388          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.strength");
2389        }
2390        else if (name.equals("description")) {
2391          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
2392        }
2393        else if (name.equals("valueSetUri")) {
2394          this.valueSet = new UriType();
2395          return this.valueSet;
2396        }
2397        else if (name.equals("valueSetReference")) {
2398          this.valueSet = new Reference();
2399          return this.valueSet;
2400        }
2401        else
2402          return super.addChild(name);
2403      }
2404
2405      public ElementDefinitionBindingComponent copy() {
2406        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
2407        copyValues(dst);
2408        dst.strength = strength == null ? null : strength.copy();
2409        dst.description = description == null ? null : description.copy();
2410        dst.valueSet = valueSet == null ? null : valueSet.copy();
2411        return dst;
2412      }
2413
2414      @Override
2415      public boolean equalsDeep(Base other) {
2416        if (!super.equalsDeep(other))
2417          return false;
2418        if (!(other instanceof ElementDefinitionBindingComponent))
2419          return false;
2420        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
2421        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
2422           && compareDeep(valueSet, o.valueSet, true);
2423      }
2424
2425      @Override
2426      public boolean equalsShallow(Base other) {
2427        if (!super.equalsShallow(other))
2428          return false;
2429        if (!(other instanceof ElementDefinitionBindingComponent))
2430          return false;
2431        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
2432        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
2433          ;
2434      }
2435
2436      public boolean isEmpty() {
2437        return super.isEmpty() && (strength == null || strength.isEmpty()) && (description == null || description.isEmpty())
2438           && (valueSet == null || valueSet.isEmpty());
2439      }
2440
2441  public String fhirType() {
2442    return "ElementDefinition.binding";
2443
2444  }
2445
2446  }
2447
2448    @Block()
2449    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
2450        /**
2451         * An internal reference to the definition of a mapping.
2452         */
2453        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2454        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
2455        protected IdType identity;
2456
2457        /**
2458         * Identifies the computable language in which mapping.map is expressed.
2459         */
2460        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2461        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
2462        protected CodeType language;
2463
2464        /**
2465         * Expresses what part of the target specification corresponds to this element.
2466         */
2467        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2468        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
2469        protected StringType map;
2470
2471        private static final long serialVersionUID = -669205371L;
2472
2473    /**
2474     * Constructor
2475     */
2476      public ElementDefinitionMappingComponent() {
2477        super();
2478      }
2479
2480    /**
2481     * Constructor
2482     */
2483      public ElementDefinitionMappingComponent(IdType identity, StringType map) {
2484        super();
2485        this.identity = identity;
2486        this.map = map;
2487      }
2488
2489        /**
2490         * @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
2491         */
2492        public IdType getIdentityElement() { 
2493          if (this.identity == null)
2494            if (Configuration.errorOnAutoCreate())
2495              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
2496            else if (Configuration.doAutoCreate())
2497              this.identity = new IdType(); // bb
2498          return this.identity;
2499        }
2500
2501        public boolean hasIdentityElement() { 
2502          return this.identity != null && !this.identity.isEmpty();
2503        }
2504
2505        public boolean hasIdentity() { 
2506          return this.identity != null && !this.identity.isEmpty();
2507        }
2508
2509        /**
2510         * @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
2511         */
2512        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
2513          this.identity = value;
2514          return this;
2515        }
2516
2517        /**
2518         * @return An internal reference to the definition of a mapping.
2519         */
2520        public String getIdentity() { 
2521          return this.identity == null ? null : this.identity.getValue();
2522        }
2523
2524        /**
2525         * @param value An internal reference to the definition of a mapping.
2526         */
2527        public ElementDefinitionMappingComponent setIdentity(String value) { 
2528            if (this.identity == null)
2529              this.identity = new IdType();
2530            this.identity.setValue(value);
2531          return this;
2532        }
2533
2534        /**
2535         * @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
2536         */
2537        public CodeType getLanguageElement() { 
2538          if (this.language == null)
2539            if (Configuration.errorOnAutoCreate())
2540              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
2541            else if (Configuration.doAutoCreate())
2542              this.language = new CodeType(); // bb
2543          return this.language;
2544        }
2545
2546        public boolean hasLanguageElement() { 
2547          return this.language != null && !this.language.isEmpty();
2548        }
2549
2550        public boolean hasLanguage() { 
2551          return this.language != null && !this.language.isEmpty();
2552        }
2553
2554        /**
2555         * @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
2556         */
2557        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
2558          this.language = value;
2559          return this;
2560        }
2561
2562        /**
2563         * @return Identifies the computable language in which mapping.map is expressed.
2564         */
2565        public String getLanguage() { 
2566          return this.language == null ? null : this.language.getValue();
2567        }
2568
2569        /**
2570         * @param value Identifies the computable language in which mapping.map is expressed.
2571         */
2572        public ElementDefinitionMappingComponent setLanguage(String value) { 
2573          if (Utilities.noString(value))
2574            this.language = null;
2575          else {
2576            if (this.language == null)
2577              this.language = new CodeType();
2578            this.language.setValue(value);
2579          }
2580          return this;
2581        }
2582
2583        /**
2584         * @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
2585         */
2586        public StringType getMapElement() { 
2587          if (this.map == null)
2588            if (Configuration.errorOnAutoCreate())
2589              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
2590            else if (Configuration.doAutoCreate())
2591              this.map = new StringType(); // bb
2592          return this.map;
2593        }
2594
2595        public boolean hasMapElement() { 
2596          return this.map != null && !this.map.isEmpty();
2597        }
2598
2599        public boolean hasMap() { 
2600          return this.map != null && !this.map.isEmpty();
2601        }
2602
2603        /**
2604         * @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
2605         */
2606        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
2607          this.map = value;
2608          return this;
2609        }
2610
2611        /**
2612         * @return Expresses what part of the target specification corresponds to this element.
2613         */
2614        public String getMap() { 
2615          return this.map == null ? null : this.map.getValue();
2616        }
2617
2618        /**
2619         * @param value Expresses what part of the target specification corresponds to this element.
2620         */
2621        public ElementDefinitionMappingComponent setMap(String value) { 
2622            if (this.map == null)
2623              this.map = new StringType();
2624            this.map.setValue(value);
2625          return this;
2626        }
2627
2628        protected void listChildren(List<Property> childrenList) {
2629          super.listChildren(childrenList);
2630          childrenList.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, java.lang.Integer.MAX_VALUE, identity));
2631          childrenList.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, java.lang.Integer.MAX_VALUE, language));
2632          childrenList.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, map));
2633        }
2634
2635      @Override
2636      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2637        switch (hash) {
2638        case -135761730: /*identity*/ return this.identity == null ? new Base[0] : new Base[] {this.identity}; // IdType
2639        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
2640        case 107868: /*map*/ return this.map == null ? new Base[0] : new Base[] {this.map}; // StringType
2641        default: return super.getProperty(hash, name, checkValid);
2642        }
2643
2644      }
2645
2646      @Override
2647      public void setProperty(int hash, String name, Base value) throws FHIRException {
2648        switch (hash) {
2649        case -135761730: // identity
2650          this.identity = castToId(value); // IdType
2651          break;
2652        case -1613589672: // language
2653          this.language = castToCode(value); // CodeType
2654          break;
2655        case 107868: // map
2656          this.map = castToString(value); // StringType
2657          break;
2658        default: super.setProperty(hash, name, value);
2659        }
2660
2661      }
2662
2663      @Override
2664      public void setProperty(String name, Base value) throws FHIRException {
2665        if (name.equals("identity"))
2666          this.identity = castToId(value); // IdType
2667        else if (name.equals("language"))
2668          this.language = castToCode(value); // CodeType
2669        else if (name.equals("map"))
2670          this.map = castToString(value); // StringType
2671        else
2672          super.setProperty(name, value);
2673      }
2674
2675      @Override
2676      public Base makeProperty(int hash, String name) throws FHIRException {
2677        switch (hash) {
2678        case -135761730: throw new FHIRException("Cannot make property identity as it is not a complex type"); // IdType
2679        case -1613589672: throw new FHIRException("Cannot make property language as it is not a complex type"); // CodeType
2680        case 107868: throw new FHIRException("Cannot make property map as it is not a complex type"); // StringType
2681        default: return super.makeProperty(hash, name);
2682        }
2683
2684      }
2685
2686      @Override
2687      public Base addChild(String name) throws FHIRException {
2688        if (name.equals("identity")) {
2689          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.identity");
2690        }
2691        else if (name.equals("language")) {
2692          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.language");
2693        }
2694        else if (name.equals("map")) {
2695          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.map");
2696        }
2697        else
2698          return super.addChild(name);
2699      }
2700
2701      public ElementDefinitionMappingComponent copy() {
2702        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
2703        copyValues(dst);
2704        dst.identity = identity == null ? null : identity.copy();
2705        dst.language = language == null ? null : language.copy();
2706        dst.map = map == null ? null : map.copy();
2707        return dst;
2708      }
2709
2710      @Override
2711      public boolean equalsDeep(Base other) {
2712        if (!super.equalsDeep(other))
2713          return false;
2714        if (!(other instanceof ElementDefinitionMappingComponent))
2715          return false;
2716        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2717        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
2718          ;
2719      }
2720
2721      @Override
2722      public boolean equalsShallow(Base other) {
2723        if (!super.equalsShallow(other))
2724          return false;
2725        if (!(other instanceof ElementDefinitionMappingComponent))
2726          return false;
2727        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2728        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
2729          ;
2730      }
2731
2732      public boolean isEmpty() {
2733        return super.isEmpty() && (identity == null || identity.isEmpty()) && (language == null || language.isEmpty())
2734           && (map == null || map.isEmpty());
2735      }
2736
2737  public String fhirType() {
2738    return "ElementDefinition.mapping";
2739
2740  }
2741
2742  }
2743
2744    /**
2745     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
2746     */
2747    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
2748    @Description(shortDefinition="The path of the element (see the Detailed Descriptions)", 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." )
2749    protected StringType path;
2750
2751    /**
2752     * Codes that define how this element is represented in instances, when the deviation varies from the normal case.
2753     */
2754    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2755    @Description(shortDefinition="xmlAttr | xmlText | typeAttr | cdaText", formalDefinition="Codes that define how this element is represented in instances, when the deviation varies from the normal case." )
2756    protected List<Enumeration<PropertyRepresentation>> representation;
2757
2758    /**
2759     * The name of this element definition. 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.
2760     */
2761    @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2762    @Description(shortDefinition="Name for this particular element definition (reference target)", formalDefinition="The name of this element definition. 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." )
2763    protected StringType name;
2764
2765    /**
2766     * The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2767     */
2768    @Child(name = "label", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2769    @Description(shortDefinition="Name for element to display with or prompt for element", formalDefinition="The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form." )
2770    protected StringType label;
2771
2772    /**
2773     * A code that provides the meaning for the element according to a particular terminology.
2774     */
2775    @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2776    @Description(shortDefinition="Defining code", formalDefinition="A code that provides the meaning for the element according to a particular terminology." )
2777    protected List<Coding> code;
2778
2779    /**
2780     * 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).
2781     */
2782    @Child(name = "slicing", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
2783    @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)." )
2784    protected ElementDefinitionSlicingComponent slicing;
2785
2786    /**
2787     * A concise description of what this element means (e.g. for use in autogenerated summaries).
2788     */
2789    @Child(name = "short", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2790    @Description(shortDefinition="Concise definition for xml presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
2791    protected StringType short_;
2792
2793    /**
2794     * 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.
2795     */
2796    @Child(name = "definition", type = {MarkdownType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2797    @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." )
2798    protected MarkdownType definition;
2799
2800    /**
2801     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2802     */
2803    @Child(name = "comments", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
2804    @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." )
2805    protected MarkdownType comments;
2806
2807    /**
2808     * 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.
2809     */
2810    @Child(name = "requirements", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2811    @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." )
2812    protected MarkdownType requirements;
2813
2814    /**
2815     * Identifies additional names by which this element might also be known.
2816     */
2817    @Child(name = "alias", type = {StringType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2818    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
2819    protected List<StringType> alias;
2820
2821    /**
2822     * The minimum number of times this element SHALL appear in the instance.
2823     */
2824    @Child(name = "min", type = {IntegerType.class}, order=11, min=0, max=1, modifier=false, summary=true)
2825    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
2826    protected IntegerType min;
2827
2828    /**
2829     * The maximum number of times this element is permitted to appear in the instance.
2830     */
2831    @Child(name = "max", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
2832    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
2833    protected StringType max;
2834
2835    /**
2836     * 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. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.
2837     */
2838    @Child(name = "base", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
2839    @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. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition." )
2840    protected ElementDefinitionBaseComponent base;
2841
2842    /**
2843     * Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
2844     */
2845    @Child(name = "contentReference", type = {UriType.class}, order=14, min=0, max=1, modifier=false, summary=true)
2846    @Description(shortDefinition="Reference to definition of content for the element", formalDefinition="Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element." )
2847    protected UriType contentReference;
2848
2849    /**
2850     * The data type or resource that the value of this element is permitted to be.
2851     */
2852    @Child(name = "type", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2853    @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." )
2854    protected List<TypeRefComponent> type;
2855
2856    /**
2857     * 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').
2858     */
2859    @Child(name = "defaultValue", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
2860    @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')." )
2861    protected org.hl7.fhir.dstu2016may.model.Type defaultValue;
2862
2863    /**
2864     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
2865     */
2866    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=17, min=0, max=1, modifier=false, summary=true)
2867    @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'." )
2868    protected MarkdownType meaningWhenMissing;
2869
2870    /**
2871     * 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.
2872     */
2873    @Child(name = "fixed", type = {}, order=18, min=0, max=1, modifier=false, summary=true)
2874    @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." )
2875    protected org.hl7.fhir.dstu2016may.model.Type fixed;
2876
2877    /**
2878     * 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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).
2879     */
2880    @Child(name = "pattern", type = {}, order=19, min=0, max=1, modifier=false, summary=true)
2881    @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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.)." )
2882    protected org.hl7.fhir.dstu2016may.model.Type pattern;
2883
2884    /**
2885     * A sample value for this element demonstrating the type of information that would typically be captured.
2886     */
2887    @Child(name = "example", type = {}, order=20, min=0, max=1, modifier=false, summary=true)
2888    @Description(shortDefinition="Example value (as defined for type)", formalDefinition="A sample value for this element demonstrating the type of information that would typically be captured." )
2889    protected org.hl7.fhir.dstu2016may.model.Type example;
2890
2891    /**
2892     * 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.
2893     */
2894    @Child(name = "minValue", type = {}, order=21, min=0, max=1, modifier=false, summary=true)
2895    @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." )
2896    protected org.hl7.fhir.dstu2016may.model.Type minValue;
2897
2898    /**
2899     * 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.
2900     */
2901    @Child(name = "maxValue", type = {}, order=22, min=0, max=1, modifier=false, summary=true)
2902    @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." )
2903    protected org.hl7.fhir.dstu2016may.model.Type maxValue;
2904
2905    /**
2906     * 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.
2907     */
2908    @Child(name = "maxLength", type = {IntegerType.class}, order=23, min=0, max=1, modifier=false, summary=true)
2909    @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." )
2910    protected IntegerType maxLength;
2911
2912    /**
2913     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
2914     */
2915    @Child(name = "condition", type = {IdType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2916    @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." )
2917    protected List<IdType> condition;
2918
2919    /**
2920     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
2921     */
2922    @Child(name = "constraint", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2923    @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." )
2924    protected List<ElementDefinitionConstraintComponent> constraint;
2925
2926    /**
2927     * 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.
2928     */
2929    @Child(name = "mustSupport", type = {BooleanType.class}, order=26, min=0, max=1, modifier=false, summary=true)
2930    @Description(shortDefinition="If the element must 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." )
2931    protected BooleanType mustSupport;
2932
2933    /**
2934     * 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.
2935     */
2936    @Child(name = "isModifier", type = {BooleanType.class}, order=27, min=0, max=1, modifier=false, summary=true)
2937    @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." )
2938    protected BooleanType isModifier;
2939
2940    /**
2941     * Whether the element should be included if a client requests a search with the parameter _summary=true.
2942     */
2943    @Child(name = "isSummary", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
2944    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
2945    protected BooleanType isSummary;
2946
2947    /**
2948     * Binds to a value set if this element is coded (code, Coding, CodeableConcept).
2949     */
2950    @Child(name = "binding", type = {}, order=29, min=0, max=1, modifier=false, summary=true)
2951    @Description(shortDefinition="ValueSet details if this is coded", formalDefinition="Binds to a value set if this element is coded (code, Coding, CodeableConcept)." )
2952    protected ElementDefinitionBindingComponent binding;
2953
2954    /**
2955     * Identifies a concept from an external specification that roughly corresponds to this element.
2956     */
2957    @Child(name = "mapping", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2958    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
2959    protected List<ElementDefinitionMappingComponent> mapping;
2960
2961    private static final long serialVersionUID = -904637873L;
2962
2963  /**
2964   * Constructor
2965   */
2966    public ElementDefinition() {
2967      super();
2968    }
2969
2970  /**
2971   * Constructor
2972   */
2973    public ElementDefinition(StringType path) {
2974      super();
2975      this.path = path;
2976    }
2977
2978    /**
2979     * @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
2980     */
2981    public StringType getPathElement() { 
2982      if (this.path == null)
2983        if (Configuration.errorOnAutoCreate())
2984          throw new Error("Attempt to auto-create ElementDefinition.path");
2985        else if (Configuration.doAutoCreate())
2986          this.path = new StringType(); // bb
2987      return this.path;
2988    }
2989
2990    public boolean hasPathElement() { 
2991      return this.path != null && !this.path.isEmpty();
2992    }
2993
2994    public boolean hasPath() { 
2995      return this.path != null && !this.path.isEmpty();
2996    }
2997
2998    /**
2999     * @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
3000     */
3001    public ElementDefinition setPathElement(StringType value) { 
3002      this.path = value;
3003      return this;
3004    }
3005
3006    /**
3007     * @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.
3008     */
3009    public String getPath() { 
3010      return this.path == null ? null : this.path.getValue();
3011    }
3012
3013    /**
3014     * @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.
3015     */
3016    public ElementDefinition setPath(String value) { 
3017        if (this.path == null)
3018          this.path = new StringType();
3019        this.path.setValue(value);
3020      return this;
3021    }
3022
3023    /**
3024     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
3025     */
3026    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
3027      if (this.representation == null)
3028        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
3029      return this.representation;
3030    }
3031
3032    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> representation) {
3033        this.representation = representation;
3034        return this;
3035    }
3036
3037    public boolean hasRepresentation() {
3038      if (this.representation == null)
3039        return false;
3040      for (Enumeration<PropertyRepresentation> item : this.representation)
3041        if (!item.isEmpty())
3042          return true;
3043      return false;
3044    }
3045
3046    /**
3047     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
3048     */
3049    // syntactic sugar
3050    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
3051      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
3052      if (this.representation == null)
3053        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
3054      this.representation.add(t);
3055      return t;
3056    }
3057
3058    /**
3059     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
3060     */
3061    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
3062      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
3063      t.setValue(value);
3064      if (this.representation == null)
3065        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
3066      this.representation.add(t);
3067      return this;
3068    }
3069
3070    /**
3071     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
3072     */
3073    public boolean hasRepresentation(PropertyRepresentation value) { 
3074      if (this.representation == null)
3075        return false;
3076      for (Enumeration<PropertyRepresentation> v : this.representation)
3077        if (v.getValue().equals(value)) // code
3078          return true;
3079      return false;
3080    }
3081
3082    /**
3083     * @return {@link #name} (The name of this element definition. 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 "getName" gives direct access to the value
3084     */
3085    public StringType getNameElement() { 
3086      if (this.name == null)
3087        if (Configuration.errorOnAutoCreate())
3088          throw new Error("Attempt to auto-create ElementDefinition.name");
3089        else if (Configuration.doAutoCreate())
3090          this.name = new StringType(); // bb
3091      return this.name;
3092    }
3093
3094    public boolean hasNameElement() { 
3095      return this.name != null && !this.name.isEmpty();
3096    }
3097
3098    public boolean hasName() { 
3099      return this.name != null && !this.name.isEmpty();
3100    }
3101
3102    /**
3103     * @param value {@link #name} (The name of this element definition. 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 "getName" gives direct access to the value
3104     */
3105    public ElementDefinition setNameElement(StringType value) { 
3106      this.name = value;
3107      return this;
3108    }
3109
3110    /**
3111     * @return The name of this element definition. 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.
3112     */
3113    public String getName() { 
3114      return this.name == null ? null : this.name.getValue();
3115    }
3116
3117    /**
3118     * @param value The name of this element definition. 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.
3119     */
3120    public ElementDefinition setName(String value) { 
3121      if (Utilities.noString(value))
3122        this.name = null;
3123      else {
3124        if (this.name == null)
3125          this.name = new StringType();
3126        this.name.setValue(value);
3127      }
3128      return this;
3129    }
3130
3131    /**
3132     * @return {@link #label} (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
3133     */
3134    public StringType getLabelElement() { 
3135      if (this.label == null)
3136        if (Configuration.errorOnAutoCreate())
3137          throw new Error("Attempt to auto-create ElementDefinition.label");
3138        else if (Configuration.doAutoCreate())
3139          this.label = new StringType(); // bb
3140      return this.label;
3141    }
3142
3143    public boolean hasLabelElement() { 
3144      return this.label != null && !this.label.isEmpty();
3145    }
3146
3147    public boolean hasLabel() { 
3148      return this.label != null && !this.label.isEmpty();
3149    }
3150
3151    /**
3152     * @param value {@link #label} (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
3153     */
3154    public ElementDefinition setLabelElement(StringType value) { 
3155      this.label = value;
3156      return this;
3157    }
3158
3159    /**
3160     * @return The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
3161     */
3162    public String getLabel() { 
3163      return this.label == null ? null : this.label.getValue();
3164    }
3165
3166    /**
3167     * @param value The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
3168     */
3169    public ElementDefinition setLabel(String value) { 
3170      if (Utilities.noString(value))
3171        this.label = null;
3172      else {
3173        if (this.label == null)
3174          this.label = new StringType();
3175        this.label.setValue(value);
3176      }
3177      return this;
3178    }
3179
3180    /**
3181     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
3182     */
3183    public List<Coding> getCode() { 
3184      if (this.code == null)
3185        this.code = new ArrayList<Coding>();
3186      return this.code;
3187    }
3188
3189    public boolean hasCode() { 
3190      if (this.code == null)
3191        return false;
3192      for (Coding item : this.code)
3193        if (!item.isEmpty())
3194          return true;
3195      return false;
3196    }
3197
3198    /**
3199     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
3200     */
3201    // syntactic sugar
3202    public Coding addCode() { //3
3203      Coding t = new Coding();
3204      if (this.code == null)
3205        this.code = new ArrayList<Coding>();
3206      this.code.add(t);
3207      return t;
3208    }
3209
3210    // syntactic sugar
3211    public ElementDefinition addCode(Coding t) { //3
3212      if (t == null)
3213        return this;
3214      if (this.code == null)
3215        this.code = new ArrayList<Coding>();
3216      this.code.add(t);
3217      return this;
3218    }
3219
3220    /**
3221     * @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).)
3222     */
3223    public ElementDefinitionSlicingComponent getSlicing() { 
3224      if (this.slicing == null)
3225        if (Configuration.errorOnAutoCreate())
3226          throw new Error("Attempt to auto-create ElementDefinition.slicing");
3227        else if (Configuration.doAutoCreate())
3228          this.slicing = new ElementDefinitionSlicingComponent(); // cc
3229      return this.slicing;
3230    }
3231
3232    public boolean hasSlicing() { 
3233      return this.slicing != null && !this.slicing.isEmpty();
3234    }
3235
3236    /**
3237     * @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).)
3238     */
3239    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
3240      this.slicing = value;
3241      return this;
3242    }
3243
3244    /**
3245     * @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
3246     */
3247    public StringType getShortElement() { 
3248      if (this.short_ == null)
3249        if (Configuration.errorOnAutoCreate())
3250          throw new Error("Attempt to auto-create ElementDefinition.short_");
3251        else if (Configuration.doAutoCreate())
3252          this.short_ = new StringType(); // bb
3253      return this.short_;
3254    }
3255
3256    public boolean hasShortElement() { 
3257      return this.short_ != null && !this.short_.isEmpty();
3258    }
3259
3260    public boolean hasShort() { 
3261      return this.short_ != null && !this.short_.isEmpty();
3262    }
3263
3264    /**
3265     * @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
3266     */
3267    public ElementDefinition setShortElement(StringType value) { 
3268      this.short_ = value;
3269      return this;
3270    }
3271
3272    /**
3273     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
3274     */
3275    public String getShort() { 
3276      return this.short_ == null ? null : this.short_.getValue();
3277    }
3278
3279    /**
3280     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
3281     */
3282    public ElementDefinition setShort(String value) { 
3283      if (Utilities.noString(value))
3284        this.short_ = null;
3285      else {
3286        if (this.short_ == null)
3287          this.short_ = new StringType();
3288        this.short_.setValue(value);
3289      }
3290      return this;
3291    }
3292
3293    /**
3294     * @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.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
3295     */
3296    public MarkdownType getDefinitionElement() { 
3297      if (this.definition == null)
3298        if (Configuration.errorOnAutoCreate())
3299          throw new Error("Attempt to auto-create ElementDefinition.definition");
3300        else if (Configuration.doAutoCreate())
3301          this.definition = new MarkdownType(); // bb
3302      return this.definition;
3303    }
3304
3305    public boolean hasDefinitionElement() { 
3306      return this.definition != null && !this.definition.isEmpty();
3307    }
3308
3309    public boolean hasDefinition() { 
3310      return this.definition != null && !this.definition.isEmpty();
3311    }
3312
3313    /**
3314     * @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.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
3315     */
3316    public ElementDefinition setDefinitionElement(MarkdownType value) { 
3317      this.definition = value;
3318      return this;
3319    }
3320
3321    /**
3322     * @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.
3323     */
3324    public String getDefinition() { 
3325      return this.definition == null ? null : this.definition.getValue();
3326    }
3327
3328    /**
3329     * @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.
3330     */
3331    public ElementDefinition setDefinition(String value) { 
3332      if (value == null)
3333        this.definition = null;
3334      else {
3335        if (this.definition == null)
3336          this.definition = new MarkdownType();
3337        this.definition.setValue(value);
3338      }
3339      return this;
3340    }
3341
3342    /**
3343     * @return {@link #comments} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
3344     */
3345    public MarkdownType getCommentsElement() { 
3346      if (this.comments == null)
3347        if (Configuration.errorOnAutoCreate())
3348          throw new Error("Attempt to auto-create ElementDefinition.comments");
3349        else if (Configuration.doAutoCreate())
3350          this.comments = new MarkdownType(); // bb
3351      return this.comments;
3352    }
3353
3354    public boolean hasCommentsElement() { 
3355      return this.comments != null && !this.comments.isEmpty();
3356    }
3357
3358    public boolean hasComments() { 
3359      return this.comments != null && !this.comments.isEmpty();
3360    }
3361
3362    /**
3363     * @param value {@link #comments} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
3364     */
3365    public ElementDefinition setCommentsElement(MarkdownType value) { 
3366      this.comments = value;
3367      return this;
3368    }
3369
3370    /**
3371     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
3372     */
3373    public String getComments() { 
3374      return this.comments == null ? null : this.comments.getValue();
3375    }
3376
3377    /**
3378     * @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.
3379     */
3380    public ElementDefinition setComments(String value) { 
3381      if (value == null)
3382        this.comments = null;
3383      else {
3384        if (this.comments == null)
3385          this.comments = new MarkdownType();
3386        this.comments.setValue(value);
3387      }
3388      return this;
3389    }
3390
3391    /**
3392     * @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
3393     */
3394    public MarkdownType getRequirementsElement() { 
3395      if (this.requirements == null)
3396        if (Configuration.errorOnAutoCreate())
3397          throw new Error("Attempt to auto-create ElementDefinition.requirements");
3398        else if (Configuration.doAutoCreate())
3399          this.requirements = new MarkdownType(); // bb
3400      return this.requirements;
3401    }
3402
3403    public boolean hasRequirementsElement() { 
3404      return this.requirements != null && !this.requirements.isEmpty();
3405    }
3406
3407    public boolean hasRequirements() { 
3408      return this.requirements != null && !this.requirements.isEmpty();
3409    }
3410
3411    /**
3412     * @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
3413     */
3414    public ElementDefinition setRequirementsElement(MarkdownType value) { 
3415      this.requirements = value;
3416      return this;
3417    }
3418
3419    /**
3420     * @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.
3421     */
3422    public String getRequirements() { 
3423      return this.requirements == null ? null : this.requirements.getValue();
3424    }
3425
3426    /**
3427     * @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.
3428     */
3429    public ElementDefinition setRequirements(String value) { 
3430      if (value == null)
3431        this.requirements = null;
3432      else {
3433        if (this.requirements == null)
3434          this.requirements = new MarkdownType();
3435        this.requirements.setValue(value);
3436      }
3437      return this;
3438    }
3439
3440    /**
3441     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
3442     */
3443    public List<StringType> getAlias() { 
3444      if (this.alias == null)
3445        this.alias = new ArrayList<StringType>();
3446      return this.alias;
3447    }
3448
3449    public boolean hasAlias() { 
3450      if (this.alias == null)
3451        return false;
3452      for (StringType item : this.alias)
3453        if (!item.isEmpty())
3454          return true;
3455      return false;
3456    }
3457
3458    /**
3459     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
3460     */
3461    // syntactic sugar
3462    public StringType addAliasElement() {//2 
3463      StringType t = new StringType();
3464      if (this.alias == null)
3465        this.alias = new ArrayList<StringType>();
3466      this.alias.add(t);
3467      return t;
3468    }
3469
3470    /**
3471     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
3472     */
3473    public ElementDefinition addAlias(String value) { //1
3474      StringType t = new StringType();
3475      t.setValue(value);
3476      if (this.alias == null)
3477        this.alias = new ArrayList<StringType>();
3478      this.alias.add(t);
3479      return this;
3480    }
3481
3482    /**
3483     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
3484     */
3485    public boolean hasAlias(String value) { 
3486      if (this.alias == null)
3487        return false;
3488      for (StringType v : this.alias)
3489        if (v.equals(value)) // string
3490          return true;
3491      return false;
3492    }
3493
3494    /**
3495     * @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
3496     */
3497    public IntegerType getMinElement() { 
3498      if (this.min == null)
3499        if (Configuration.errorOnAutoCreate())
3500          throw new Error("Attempt to auto-create ElementDefinition.min");
3501        else if (Configuration.doAutoCreate())
3502          this.min = new IntegerType(); // bb
3503      return this.min;
3504    }
3505
3506    public boolean hasMinElement() { 
3507      return this.min != null && !this.min.isEmpty();
3508    }
3509
3510    public boolean hasMin() { 
3511      return this.min != null && !this.min.isEmpty();
3512    }
3513
3514    /**
3515     * @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
3516     */
3517    public ElementDefinition setMinElement(IntegerType value) { 
3518      this.min = value;
3519      return this;
3520    }
3521
3522    /**
3523     * @return The minimum number of times this element SHALL appear in the instance.
3524     */
3525    public int getMin() { 
3526      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
3527    }
3528
3529    /**
3530     * @param value The minimum number of times this element SHALL appear in the instance.
3531     */
3532    public ElementDefinition setMin(int value) { 
3533        if (this.min == null)
3534          this.min = new IntegerType();
3535        this.min.setValue(value);
3536      return this;
3537    }
3538
3539    /**
3540     * @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
3541     */
3542    public StringType getMaxElement() { 
3543      if (this.max == null)
3544        if (Configuration.errorOnAutoCreate())
3545          throw new Error("Attempt to auto-create ElementDefinition.max");
3546        else if (Configuration.doAutoCreate())
3547          this.max = new StringType(); // bb
3548      return this.max;
3549    }
3550
3551    public boolean hasMaxElement() { 
3552      return this.max != null && !this.max.isEmpty();
3553    }
3554
3555    public boolean hasMax() { 
3556      return this.max != null && !this.max.isEmpty();
3557    }
3558
3559    /**
3560     * @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
3561     */
3562    public ElementDefinition setMaxElement(StringType value) { 
3563      this.max = value;
3564      return this;
3565    }
3566
3567    /**
3568     * @return The maximum number of times this element is permitted to appear in the instance.
3569     */
3570    public String getMax() { 
3571      return this.max == null ? null : this.max.getValue();
3572    }
3573
3574    /**
3575     * @param value The maximum number of times this element is permitted to appear in the instance.
3576     */
3577    public ElementDefinition setMax(String value) { 
3578      if (Utilities.noString(value))
3579        this.max = null;
3580      else {
3581        if (this.max == null)
3582          this.max = new StringType();
3583        this.max.setValue(value);
3584      }
3585      return this;
3586    }
3587
3588    /**
3589     * @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. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3590     */
3591    public ElementDefinitionBaseComponent getBase() { 
3592      if (this.base == null)
3593        if (Configuration.errorOnAutoCreate())
3594          throw new Error("Attempt to auto-create ElementDefinition.base");
3595        else if (Configuration.doAutoCreate())
3596          this.base = new ElementDefinitionBaseComponent(); // cc
3597      return this.base;
3598    }
3599
3600    public boolean hasBase() { 
3601      return this.base != null && !this.base.isEmpty();
3602    }
3603
3604    /**
3605     * @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. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3606     */
3607    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
3608      this.base = value;
3609      return this;
3610    }
3611
3612    /**
3613     * @return {@link #contentReference} (Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
3614     */
3615    public UriType getContentReferenceElement() { 
3616      if (this.contentReference == null)
3617        if (Configuration.errorOnAutoCreate())
3618          throw new Error("Attempt to auto-create ElementDefinition.contentReference");
3619        else if (Configuration.doAutoCreate())
3620          this.contentReference = new UriType(); // bb
3621      return this.contentReference;
3622    }
3623
3624    public boolean hasContentReferenceElement() { 
3625      return this.contentReference != null && !this.contentReference.isEmpty();
3626    }
3627
3628    public boolean hasContentReference() { 
3629      return this.contentReference != null && !this.contentReference.isEmpty();
3630    }
3631
3632    /**
3633     * @param value {@link #contentReference} (Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
3634     */
3635    public ElementDefinition setContentReferenceElement(UriType value) { 
3636      this.contentReference = value;
3637      return this;
3638    }
3639
3640    /**
3641     * @return Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
3642     */
3643    public String getContentReference() { 
3644      return this.contentReference == null ? null : this.contentReference.getValue();
3645    }
3646
3647    /**
3648     * @param value Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
3649     */
3650    public ElementDefinition setContentReference(String value) { 
3651      if (Utilities.noString(value))
3652        this.contentReference = null;
3653      else {
3654        if (this.contentReference == null)
3655          this.contentReference = new UriType();
3656        this.contentReference.setValue(value);
3657      }
3658      return this;
3659    }
3660
3661    /**
3662     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3663     */
3664    public List<TypeRefComponent> getType() { 
3665      if (this.type == null)
3666        this.type = new ArrayList<TypeRefComponent>();
3667      return this.type;
3668    }
3669
3670    public boolean hasType() { 
3671      if (this.type == null)
3672        return false;
3673      for (TypeRefComponent item : this.type)
3674        if (!item.isEmpty())
3675          return true;
3676      return false;
3677    }
3678
3679    /**
3680     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3681     */
3682    // syntactic sugar
3683    public TypeRefComponent addType() { //3
3684      TypeRefComponent t = new TypeRefComponent();
3685      if (this.type == null)
3686        this.type = new ArrayList<TypeRefComponent>();
3687      this.type.add(t);
3688      return t;
3689    }
3690
3691    // syntactic sugar
3692    public ElementDefinition addType(TypeRefComponent t) { //3
3693      if (t == null)
3694        return this;
3695      if (this.type == null)
3696        this.type = new ArrayList<TypeRefComponent>();
3697      this.type.add(t);
3698      return this;
3699    }
3700
3701    /**
3702     * @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').)
3703     */
3704    public org.hl7.fhir.dstu2016may.model.Type getDefaultValue() { 
3705      return this.defaultValue;
3706    }
3707
3708    public boolean hasDefaultValue() { 
3709      return this.defaultValue != null && !this.defaultValue.isEmpty();
3710    }
3711
3712    /**
3713     * @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').)
3714     */
3715    public ElementDefinition setDefaultValue(org.hl7.fhir.dstu2016may.model.Type value) { 
3716      this.defaultValue = value;
3717      return this;
3718    }
3719
3720    /**
3721     * @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
3722     */
3723    public MarkdownType getMeaningWhenMissingElement() { 
3724      if (this.meaningWhenMissing == null)
3725        if (Configuration.errorOnAutoCreate())
3726          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
3727        else if (Configuration.doAutoCreate())
3728          this.meaningWhenMissing = new MarkdownType(); // bb
3729      return this.meaningWhenMissing;
3730    }
3731
3732    public boolean hasMeaningWhenMissingElement() { 
3733      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3734    }
3735
3736    public boolean hasMeaningWhenMissing() { 
3737      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3738    }
3739
3740    /**
3741     * @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
3742     */
3743    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
3744      this.meaningWhenMissing = value;
3745      return this;
3746    }
3747
3748    /**
3749     * @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'.
3750     */
3751    public String getMeaningWhenMissing() { 
3752      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
3753    }
3754
3755    /**
3756     * @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'.
3757     */
3758    public ElementDefinition setMeaningWhenMissing(String value) { 
3759      if (value == null)
3760        this.meaningWhenMissing = null;
3761      else {
3762        if (this.meaningWhenMissing == null)
3763          this.meaningWhenMissing = new MarkdownType();
3764        this.meaningWhenMissing.setValue(value);
3765      }
3766      return this;
3767    }
3768
3769    /**
3770     * @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.)
3771     */
3772    public org.hl7.fhir.dstu2016may.model.Type getFixed() { 
3773      return this.fixed;
3774    }
3775
3776    public boolean hasFixed() { 
3777      return this.fixed != null && !this.fixed.isEmpty();
3778    }
3779
3780    /**
3781     * @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.)
3782     */
3783    public ElementDefinition setFixed(org.hl7.fhir.dstu2016may.model.Type value) { 
3784      this.fixed = value;
3785      return this;
3786    }
3787
3788    /**
3789     * @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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
3790     */
3791    public org.hl7.fhir.dstu2016may.model.Type getPattern() { 
3792      return this.pattern;
3793    }
3794
3795    public boolean hasPattern() { 
3796      return this.pattern != null && !this.pattern.isEmpty();
3797    }
3798
3799    /**
3800     * @param value {@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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
3801     */
3802    public ElementDefinition setPattern(org.hl7.fhir.dstu2016may.model.Type value) { 
3803      this.pattern = value;
3804      return this;
3805    }
3806
3807    /**
3808     * @return {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3809     */
3810    public org.hl7.fhir.dstu2016may.model.Type getExample() { 
3811      return this.example;
3812    }
3813
3814    public boolean hasExample() { 
3815      return this.example != null && !this.example.isEmpty();
3816    }
3817
3818    /**
3819     * @param value {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3820     */
3821    public ElementDefinition setExample(org.hl7.fhir.dstu2016may.model.Type value) { 
3822      this.example = value;
3823      return this;
3824    }
3825
3826    /**
3827     * @return {@link #minValue} (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.)
3828     */
3829    public org.hl7.fhir.dstu2016may.model.Type getMinValue() { 
3830      return this.minValue;
3831    }
3832
3833    public boolean hasMinValue() { 
3834      return this.minValue != null && !this.minValue.isEmpty();
3835    }
3836
3837    /**
3838     * @param value {@link #minValue} (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.)
3839     */
3840    public ElementDefinition setMinValue(org.hl7.fhir.dstu2016may.model.Type value) { 
3841      this.minValue = value;
3842      return this;
3843    }
3844
3845    /**
3846     * @return {@link #maxValue} (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.)
3847     */
3848    public org.hl7.fhir.dstu2016may.model.Type getMaxValue() { 
3849      return this.maxValue;
3850    }
3851
3852    public boolean hasMaxValue() { 
3853      return this.maxValue != null && !this.maxValue.isEmpty();
3854    }
3855
3856    /**
3857     * @param value {@link #maxValue} (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.)
3858     */
3859    public ElementDefinition setMaxValue(org.hl7.fhir.dstu2016may.model.Type value) { 
3860      this.maxValue = value;
3861      return this;
3862    }
3863
3864    /**
3865     * @return {@link #maxLength} (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.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
3866     */
3867    public IntegerType getMaxLengthElement() { 
3868      if (this.maxLength == null)
3869        if (Configuration.errorOnAutoCreate())
3870          throw new Error("Attempt to auto-create ElementDefinition.maxLength");
3871        else if (Configuration.doAutoCreate())
3872          this.maxLength = new IntegerType(); // bb
3873      return this.maxLength;
3874    }
3875
3876    public boolean hasMaxLengthElement() { 
3877      return this.maxLength != null && !this.maxLength.isEmpty();
3878    }
3879
3880    public boolean hasMaxLength() { 
3881      return this.maxLength != null && !this.maxLength.isEmpty();
3882    }
3883
3884    /**
3885     * @param value {@link #maxLength} (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.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
3886     */
3887    public ElementDefinition setMaxLengthElement(IntegerType value) { 
3888      this.maxLength = value;
3889      return this;
3890    }
3891
3892    /**
3893     * @return 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.
3894     */
3895    public int getMaxLength() { 
3896      return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
3897    }
3898
3899    /**
3900     * @param value 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.
3901     */
3902    public ElementDefinition setMaxLength(int value) { 
3903        if (this.maxLength == null)
3904          this.maxLength = new IntegerType();
3905        this.maxLength.setValue(value);
3906      return this;
3907    }
3908
3909    /**
3910     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3911     */
3912    public List<IdType> getCondition() { 
3913      if (this.condition == null)
3914        this.condition = new ArrayList<IdType>();
3915      return this.condition;
3916    }
3917
3918    public boolean hasCondition() { 
3919      if (this.condition == null)
3920        return false;
3921      for (IdType item : this.condition)
3922        if (!item.isEmpty())
3923          return true;
3924      return false;
3925    }
3926
3927    /**
3928     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3929     */
3930    // syntactic sugar
3931    public IdType addConditionElement() {//2 
3932      IdType t = new IdType();
3933      if (this.condition == null)
3934        this.condition = new ArrayList<IdType>();
3935      this.condition.add(t);
3936      return t;
3937    }
3938
3939    /**
3940     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3941     */
3942    public ElementDefinition addCondition(String value) { //1
3943      IdType t = new IdType();
3944      t.setValue(value);
3945      if (this.condition == null)
3946        this.condition = new ArrayList<IdType>();
3947      this.condition.add(t);
3948      return this;
3949    }
3950
3951    /**
3952     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3953     */
3954    public boolean hasCondition(String value) { 
3955      if (this.condition == null)
3956        return false;
3957      for (IdType v : this.condition)
3958        if (v.equals(value)) // id
3959          return true;
3960      return false;
3961    }
3962
3963    /**
3964     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3965     */
3966    public List<ElementDefinitionConstraintComponent> getConstraint() { 
3967      if (this.constraint == null)
3968        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3969      return this.constraint;
3970    }
3971
3972    public boolean hasConstraint() { 
3973      if (this.constraint == null)
3974        return false;
3975      for (ElementDefinitionConstraintComponent item : this.constraint)
3976        if (!item.isEmpty())
3977          return true;
3978      return false;
3979    }
3980
3981    /**
3982     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3983     */
3984    // syntactic sugar
3985    public ElementDefinitionConstraintComponent addConstraint() { //3
3986      ElementDefinitionConstraintComponent t = new ElementDefinitionConstraintComponent();
3987      if (this.constraint == null)
3988        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3989      this.constraint.add(t);
3990      return t;
3991    }
3992
3993    // syntactic sugar
3994    public ElementDefinition addConstraint(ElementDefinitionConstraintComponent t) { //3
3995      if (t == null)
3996        return this;
3997      if (this.constraint == null)
3998        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3999      this.constraint.add(t);
4000      return this;
4001    }
4002
4003    /**
4004     * @return {@link #mustSupport} (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.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
4005     */
4006    public BooleanType getMustSupportElement() { 
4007      if (this.mustSupport == null)
4008        if (Configuration.errorOnAutoCreate())
4009          throw new Error("Attempt to auto-create ElementDefinition.mustSupport");
4010        else if (Configuration.doAutoCreate())
4011          this.mustSupport = new BooleanType(); // bb
4012      return this.mustSupport;
4013    }
4014
4015    public boolean hasMustSupportElement() { 
4016      return this.mustSupport != null && !this.mustSupport.isEmpty();
4017    }
4018
4019    public boolean hasMustSupport() { 
4020      return this.mustSupport != null && !this.mustSupport.isEmpty();
4021    }
4022
4023    /**
4024     * @param value {@link #mustSupport} (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.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
4025     */
4026    public ElementDefinition setMustSupportElement(BooleanType value) { 
4027      this.mustSupport = value;
4028      return this;
4029    }
4030
4031    /**
4032     * @return 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.
4033     */
4034    public boolean getMustSupport() { 
4035      return this.mustSupport == null || this.mustSupport.isEmpty() ? false : this.mustSupport.getValue();
4036    }
4037
4038    /**
4039     * @param value 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.
4040     */
4041    public ElementDefinition setMustSupport(boolean value) { 
4042        if (this.mustSupport == null)
4043          this.mustSupport = new BooleanType();
4044        this.mustSupport.setValue(value);
4045      return this;
4046    }
4047
4048    /**
4049     * @return {@link #isModifier} (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.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
4050     */
4051    public BooleanType getIsModifierElement() { 
4052      if (this.isModifier == null)
4053        if (Configuration.errorOnAutoCreate())
4054          throw new Error("Attempt to auto-create ElementDefinition.isModifier");
4055        else if (Configuration.doAutoCreate())
4056          this.isModifier = new BooleanType(); // bb
4057      return this.isModifier;
4058    }
4059
4060    public boolean hasIsModifierElement() { 
4061      return this.isModifier != null && !this.isModifier.isEmpty();
4062    }
4063
4064    public boolean hasIsModifier() { 
4065      return this.isModifier != null && !this.isModifier.isEmpty();
4066    }
4067
4068    /**
4069     * @param value {@link #isModifier} (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.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
4070     */
4071    public ElementDefinition setIsModifierElement(BooleanType value) { 
4072      this.isModifier = value;
4073      return this;
4074    }
4075
4076    /**
4077     * @return 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.
4078     */
4079    public boolean getIsModifier() { 
4080      return this.isModifier == null || this.isModifier.isEmpty() ? false : this.isModifier.getValue();
4081    }
4082
4083    /**
4084     * @param value 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.
4085     */
4086    public ElementDefinition setIsModifier(boolean value) { 
4087        if (this.isModifier == null)
4088          this.isModifier = new BooleanType();
4089        this.isModifier.setValue(value);
4090      return this;
4091    }
4092
4093    /**
4094     * @return {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
4095     */
4096    public BooleanType getIsSummaryElement() { 
4097      if (this.isSummary == null)
4098        if (Configuration.errorOnAutoCreate())
4099          throw new Error("Attempt to auto-create ElementDefinition.isSummary");
4100        else if (Configuration.doAutoCreate())
4101          this.isSummary = new BooleanType(); // bb
4102      return this.isSummary;
4103    }
4104
4105    public boolean hasIsSummaryElement() { 
4106      return this.isSummary != null && !this.isSummary.isEmpty();
4107    }
4108
4109    public boolean hasIsSummary() { 
4110      return this.isSummary != null && !this.isSummary.isEmpty();
4111    }
4112
4113    /**
4114     * @param value {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
4115     */
4116    public ElementDefinition setIsSummaryElement(BooleanType value) { 
4117      this.isSummary = value;
4118      return this;
4119    }
4120
4121    /**
4122     * @return Whether the element should be included if a client requests a search with the parameter _summary=true.
4123     */
4124    public boolean getIsSummary() { 
4125      return this.isSummary == null || this.isSummary.isEmpty() ? false : this.isSummary.getValue();
4126    }
4127
4128    /**
4129     * @param value Whether the element should be included if a client requests a search with the parameter _summary=true.
4130     */
4131    public ElementDefinition setIsSummary(boolean value) { 
4132        if (this.isSummary == null)
4133          this.isSummary = new BooleanType();
4134        this.isSummary.setValue(value);
4135      return this;
4136    }
4137
4138    /**
4139     * @return {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
4140     */
4141    public ElementDefinitionBindingComponent getBinding() { 
4142      if (this.binding == null)
4143        if (Configuration.errorOnAutoCreate())
4144          throw new Error("Attempt to auto-create ElementDefinition.binding");
4145        else if (Configuration.doAutoCreate())
4146          this.binding = new ElementDefinitionBindingComponent(); // cc
4147      return this.binding;
4148    }
4149
4150    public boolean hasBinding() { 
4151      return this.binding != null && !this.binding.isEmpty();
4152    }
4153
4154    /**
4155     * @param value {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
4156     */
4157    public ElementDefinition setBinding(ElementDefinitionBindingComponent value) { 
4158      this.binding = value;
4159      return this;
4160    }
4161
4162    /**
4163     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
4164     */
4165    public List<ElementDefinitionMappingComponent> getMapping() { 
4166      if (this.mapping == null)
4167        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
4168      return this.mapping;
4169    }
4170
4171    public boolean hasMapping() { 
4172      if (this.mapping == null)
4173        return false;
4174      for (ElementDefinitionMappingComponent item : this.mapping)
4175        if (!item.isEmpty())
4176          return true;
4177      return false;
4178    }
4179
4180    /**
4181     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
4182     */
4183    // syntactic sugar
4184    public ElementDefinitionMappingComponent addMapping() { //3
4185      ElementDefinitionMappingComponent t = new ElementDefinitionMappingComponent();
4186      if (this.mapping == null)
4187        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
4188      this.mapping.add(t);
4189      return t;
4190    }
4191
4192    // syntactic sugar
4193    public ElementDefinition addMapping(ElementDefinitionMappingComponent t) { //3
4194      if (t == null)
4195        return this;
4196      if (this.mapping == null)
4197        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
4198      this.mapping.add(t);
4199      return this;
4200    }
4201
4202      protected void listChildren(List<Property> childrenList) {
4203        super.listChildren(childrenList);
4204        childrenList.add(new Property("path", "string", "The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension.", 0, java.lang.Integer.MAX_VALUE, path));
4205        childrenList.add(new Property("representation", "code", "Codes that define how this element is represented in instances, when the deviation varies from the normal case.", 0, java.lang.Integer.MAX_VALUE, representation));
4206        childrenList.add(new Property("name", "string", "The name of this element definition. 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.", 0, java.lang.Integer.MAX_VALUE, name));
4207        childrenList.add(new Property("label", "string", "The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.", 0, java.lang.Integer.MAX_VALUE, label));
4208        childrenList.add(new Property("code", "Coding", "A code that provides the meaning for the element according to a particular terminology.", 0, java.lang.Integer.MAX_VALUE, code));
4209        childrenList.add(new Property("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).", 0, java.lang.Integer.MAX_VALUE, slicing));
4210        childrenList.add(new Property("short", "string", "A concise description of what this element means (e.g. for use in autogenerated summaries).", 0, java.lang.Integer.MAX_VALUE, short_));
4211        childrenList.add(new Property("definition", "markdown", "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.", 0, java.lang.Integer.MAX_VALUE, definition));
4212        childrenList.add(new Property("comments", "markdown", "Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.", 0, java.lang.Integer.MAX_VALUE, comments));
4213        childrenList.add(new Property("requirements", "markdown", "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.", 0, java.lang.Integer.MAX_VALUE, requirements));
4214        childrenList.add(new Property("alias", "string", "Identifies additional names by which this element might also be known.", 0, java.lang.Integer.MAX_VALUE, alias));
4215        childrenList.add(new Property("min", "integer", "The minimum number of times this element SHALL appear in the instance.", 0, java.lang.Integer.MAX_VALUE, min));
4216        childrenList.add(new Property("max", "string", "The maximum number of times this element is permitted to appear in the instance.", 0, java.lang.Integer.MAX_VALUE, max));
4217        childrenList.add(new Property("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. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.", 0, java.lang.Integer.MAX_VALUE, base));
4218        childrenList.add(new Property("contentReference", "uri", "Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.", 0, java.lang.Integer.MAX_VALUE, contentReference));
4219        childrenList.add(new Property("type", "", "The data type or resource that the value of this element is permitted to be.", 0, java.lang.Integer.MAX_VALUE, type));
4220        childrenList.add(new Property("defaultValue[x]", "*", "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').", 0, java.lang.Integer.MAX_VALUE, defaultValue));
4221        childrenList.add(new Property("meaningWhenMissing", "markdown", "The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.", 0, java.lang.Integer.MAX_VALUE, meaningWhenMissing));
4222        childrenList.add(new Property("fixed[x]", "*", "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.", 0, java.lang.Integer.MAX_VALUE, fixed));
4223        childrenList.add(new Property("pattern[x]", "*", "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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).", 0, java.lang.Integer.MAX_VALUE, pattern));
4224        childrenList.add(new Property("example[x]", "*", "A sample value for this element demonstrating the type of information that would typically be captured.", 0, java.lang.Integer.MAX_VALUE, example));
4225        childrenList.add(new Property("minValue[x]", "*", "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.", 0, java.lang.Integer.MAX_VALUE, minValue));
4226        childrenList.add(new Property("maxValue[x]", "*", "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.", 0, java.lang.Integer.MAX_VALUE, maxValue));
4227        childrenList.add(new Property("maxLength", "integer", "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.", 0, java.lang.Integer.MAX_VALUE, maxLength));
4228        childrenList.add(new Property("condition", "id", "A reference to an invariant that may make additional statements about the cardinality or value in the instance.", 0, java.lang.Integer.MAX_VALUE, condition));
4229        childrenList.add(new Property("constraint", "", "Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.", 0, java.lang.Integer.MAX_VALUE, constraint));
4230        childrenList.add(new Property("mustSupport", "boolean", "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.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
4231        childrenList.add(new Property("isModifier", "boolean", "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.", 0, java.lang.Integer.MAX_VALUE, isModifier));
4232        childrenList.add(new Property("isSummary", "boolean", "Whether the element should be included if a client requests a search with the parameter _summary=true.", 0, java.lang.Integer.MAX_VALUE, isSummary));
4233        childrenList.add(new Property("binding", "", "Binds to a value set if this element is coded (code, Coding, CodeableConcept).", 0, java.lang.Integer.MAX_VALUE, binding));
4234        childrenList.add(new Property("mapping", "", "Identifies a concept from an external specification that roughly corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, mapping));
4235      }
4236
4237      @Override
4238      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4239        switch (hash) {
4240        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
4241        case -671065907: /*representation*/ return this.representation == null ? new Base[0] : this.representation.toArray(new Base[this.representation.size()]); // Enumeration<PropertyRepresentation>
4242        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
4243        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
4244        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
4245        case -2119287345: /*slicing*/ return this.slicing == null ? new Base[0] : new Base[] {this.slicing}; // ElementDefinitionSlicingComponent
4246        case 109413500: /*short*/ return this.short_ == null ? new Base[0] : new Base[] {this.short_}; // StringType
4247        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // MarkdownType
4248        case -602415628: /*comments*/ return this.comments == null ? new Base[0] : new Base[] {this.comments}; // MarkdownType
4249        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // MarkdownType
4250        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
4251        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
4252        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
4253        case 3016401: /*base*/ return this.base == null ? new Base[0] : new Base[] {this.base}; // ElementDefinitionBaseComponent
4254        case 1193747154: /*contentReference*/ return this.contentReference == null ? new Base[0] : new Base[] {this.contentReference}; // UriType
4255        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // TypeRefComponent
4256        case -659125328: /*defaultValue*/ return this.defaultValue == null ? new Base[0] : new Base[] {this.defaultValue}; // org.hl7.fhir.dstu2016may.model.Type
4257        case 1857257103: /*meaningWhenMissing*/ return this.meaningWhenMissing == null ? new Base[0] : new Base[] {this.meaningWhenMissing}; // MarkdownType
4258        case 97445748: /*fixed*/ return this.fixed == null ? new Base[0] : new Base[] {this.fixed}; // org.hl7.fhir.dstu2016may.model.Type
4259        case -791090288: /*pattern*/ return this.pattern == null ? new Base[0] : new Base[] {this.pattern}; // org.hl7.fhir.dstu2016may.model.Type
4260        case -1322970774: /*example*/ return this.example == null ? new Base[0] : new Base[] {this.example}; // org.hl7.fhir.dstu2016may.model.Type
4261        case -1376969153: /*minValue*/ return this.minValue == null ? new Base[0] : new Base[] {this.minValue}; // org.hl7.fhir.dstu2016may.model.Type
4262        case 399227501: /*maxValue*/ return this.maxValue == null ? new Base[0] : new Base[] {this.maxValue}; // org.hl7.fhir.dstu2016may.model.Type
4263        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
4264        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // IdType
4265        case -190376483: /*constraint*/ return this.constraint == null ? new Base[0] : this.constraint.toArray(new Base[this.constraint.size()]); // ElementDefinitionConstraintComponent
4266        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : new Base[] {this.mustSupport}; // BooleanType
4267        case -1408783839: /*isModifier*/ return this.isModifier == null ? new Base[0] : new Base[] {this.isModifier}; // BooleanType
4268        case 1857548060: /*isSummary*/ return this.isSummary == null ? new Base[0] : new Base[] {this.isSummary}; // BooleanType
4269        case -108220795: /*binding*/ return this.binding == null ? new Base[0] : new Base[] {this.binding}; // ElementDefinitionBindingComponent
4270        case 837556430: /*mapping*/ return this.mapping == null ? new Base[0] : this.mapping.toArray(new Base[this.mapping.size()]); // ElementDefinitionMappingComponent
4271        default: return super.getProperty(hash, name, checkValid);
4272        }
4273
4274      }
4275
4276      @Override
4277      public void setProperty(int hash, String name, Base value) throws FHIRException {
4278        switch (hash) {
4279        case 3433509: // path
4280          this.path = castToString(value); // StringType
4281          break;
4282        case -671065907: // representation
4283          this.getRepresentation().add(new PropertyRepresentationEnumFactory().fromType(value)); // Enumeration<PropertyRepresentation>
4284          break;
4285        case 3373707: // name
4286          this.name = castToString(value); // StringType
4287          break;
4288        case 102727412: // label
4289          this.label = castToString(value); // StringType
4290          break;
4291        case 3059181: // code
4292          this.getCode().add(castToCoding(value)); // Coding
4293          break;
4294        case -2119287345: // slicing
4295          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
4296          break;
4297        case 109413500: // short
4298          this.short_ = castToString(value); // StringType
4299          break;
4300        case -1014418093: // definition
4301          this.definition = castToMarkdown(value); // MarkdownType
4302          break;
4303        case -602415628: // comments
4304          this.comments = castToMarkdown(value); // MarkdownType
4305          break;
4306        case -1619874672: // requirements
4307          this.requirements = castToMarkdown(value); // MarkdownType
4308          break;
4309        case 92902992: // alias
4310          this.getAlias().add(castToString(value)); // StringType
4311          break;
4312        case 108114: // min
4313          this.min = castToInteger(value); // IntegerType
4314          break;
4315        case 107876: // max
4316          this.max = castToString(value); // StringType
4317          break;
4318        case 3016401: // base
4319          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
4320          break;
4321        case 1193747154: // contentReference
4322          this.contentReference = castToUri(value); // UriType
4323          break;
4324        case 3575610: // type
4325          this.getType().add((TypeRefComponent) value); // TypeRefComponent
4326          break;
4327        case -659125328: // defaultValue
4328          this.defaultValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4329          break;
4330        case 1857257103: // meaningWhenMissing
4331          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
4332          break;
4333        case 97445748: // fixed
4334          this.fixed = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4335          break;
4336        case -791090288: // pattern
4337          this.pattern = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4338          break;
4339        case -1322970774: // example
4340          this.example = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4341          break;
4342        case -1376969153: // minValue
4343          this.minValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4344          break;
4345        case 399227501: // maxValue
4346          this.maxValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4347          break;
4348        case -791400086: // maxLength
4349          this.maxLength = castToInteger(value); // IntegerType
4350          break;
4351        case -861311717: // condition
4352          this.getCondition().add(castToId(value)); // IdType
4353          break;
4354        case -190376483: // constraint
4355          this.getConstraint().add((ElementDefinitionConstraintComponent) value); // ElementDefinitionConstraintComponent
4356          break;
4357        case -1402857082: // mustSupport
4358          this.mustSupport = castToBoolean(value); // BooleanType
4359          break;
4360        case -1408783839: // isModifier
4361          this.isModifier = castToBoolean(value); // BooleanType
4362          break;
4363        case 1857548060: // isSummary
4364          this.isSummary = castToBoolean(value); // BooleanType
4365          break;
4366        case -108220795: // binding
4367          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
4368          break;
4369        case 837556430: // mapping
4370          this.getMapping().add((ElementDefinitionMappingComponent) value); // ElementDefinitionMappingComponent
4371          break;
4372        default: super.setProperty(hash, name, value);
4373        }
4374
4375      }
4376
4377      @Override
4378      public void setProperty(String name, Base value) throws FHIRException {
4379        if (name.equals("path"))
4380          this.path = castToString(value); // StringType
4381        else if (name.equals("representation"))
4382          this.getRepresentation().add(new PropertyRepresentationEnumFactory().fromType(value));
4383        else if (name.equals("name"))
4384          this.name = castToString(value); // StringType
4385        else if (name.equals("label"))
4386          this.label = castToString(value); // StringType
4387        else if (name.equals("code"))
4388          this.getCode().add(castToCoding(value));
4389        else if (name.equals("slicing"))
4390          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
4391        else if (name.equals("short"))
4392          this.short_ = castToString(value); // StringType
4393        else if (name.equals("definition"))
4394          this.definition = castToMarkdown(value); // MarkdownType
4395        else if (name.equals("comments"))
4396          this.comments = castToMarkdown(value); // MarkdownType
4397        else if (name.equals("requirements"))
4398          this.requirements = castToMarkdown(value); // MarkdownType
4399        else if (name.equals("alias"))
4400          this.getAlias().add(castToString(value));
4401        else if (name.equals("min"))
4402          this.min = castToInteger(value); // IntegerType
4403        else if (name.equals("max"))
4404          this.max = castToString(value); // StringType
4405        else if (name.equals("base"))
4406          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
4407        else if (name.equals("contentReference"))
4408          this.contentReference = castToUri(value); // UriType
4409        else if (name.equals("type"))
4410          this.getType().add((TypeRefComponent) value);
4411        else if (name.equals("defaultValue[x]"))
4412          this.defaultValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4413        else if (name.equals("meaningWhenMissing"))
4414          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
4415        else if (name.equals("fixed[x]"))
4416          this.fixed = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4417        else if (name.equals("pattern[x]"))
4418          this.pattern = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4419        else if (name.equals("example[x]"))
4420          this.example = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4421        else if (name.equals("minValue[x]"))
4422          this.minValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4423        else if (name.equals("maxValue[x]"))
4424          this.maxValue = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
4425        else if (name.equals("maxLength"))
4426          this.maxLength = castToInteger(value); // IntegerType
4427        else if (name.equals("condition"))
4428          this.getCondition().add(castToId(value));
4429        else if (name.equals("constraint"))
4430          this.getConstraint().add((ElementDefinitionConstraintComponent) value);
4431        else if (name.equals("mustSupport"))
4432          this.mustSupport = castToBoolean(value); // BooleanType
4433        else if (name.equals("isModifier"))
4434          this.isModifier = castToBoolean(value); // BooleanType
4435        else if (name.equals("isSummary"))
4436          this.isSummary = castToBoolean(value); // BooleanType
4437        else if (name.equals("binding"))
4438          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
4439        else if (name.equals("mapping"))
4440          this.getMapping().add((ElementDefinitionMappingComponent) value);
4441        else
4442          super.setProperty(name, value);
4443      }
4444
4445      @Override
4446      public Base makeProperty(int hash, String name) throws FHIRException {
4447        switch (hash) {
4448        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
4449        case -671065907: throw new FHIRException("Cannot make property representation as it is not a complex type"); // Enumeration<PropertyRepresentation>
4450        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
4451        case 102727412: throw new FHIRException("Cannot make property label as it is not a complex type"); // StringType
4452        case 3059181:  return addCode(); // Coding
4453        case -2119287345:  return getSlicing(); // ElementDefinitionSlicingComponent
4454        case 109413500: throw new FHIRException("Cannot make property short as it is not a complex type"); // StringType
4455        case -1014418093: throw new FHIRException("Cannot make property definition as it is not a complex type"); // MarkdownType
4456        case -602415628: throw new FHIRException("Cannot make property comments as it is not a complex type"); // MarkdownType
4457        case -1619874672: throw new FHIRException("Cannot make property requirements as it is not a complex type"); // MarkdownType
4458        case 92902992: throw new FHIRException("Cannot make property alias as it is not a complex type"); // StringType
4459        case 108114: throw new FHIRException("Cannot make property min as it is not a complex type"); // IntegerType
4460        case 107876: throw new FHIRException("Cannot make property max as it is not a complex type"); // StringType
4461        case 3016401:  return getBase(); // ElementDefinitionBaseComponent
4462        case 1193747154: throw new FHIRException("Cannot make property contentReference as it is not a complex type"); // UriType
4463        case 3575610:  return addType(); // TypeRefComponent
4464        case 587922128:  return getDefaultValue(); // org.hl7.fhir.dstu2016may.model.Type
4465        case 1857257103: throw new FHIRException("Cannot make property meaningWhenMissing as it is not a complex type"); // MarkdownType
4466        case -391522164:  return getFixed(); // org.hl7.fhir.dstu2016may.model.Type
4467        case -885125392:  return getPattern(); // org.hl7.fhir.dstu2016may.model.Type
4468        case -2002328874:  return getExample(); // org.hl7.fhir.dstu2016may.model.Type
4469        case -55301663:  return getMinValue(); // org.hl7.fhir.dstu2016may.model.Type
4470        case 622130931:  return getMaxValue(); // org.hl7.fhir.dstu2016may.model.Type
4471        case -791400086: throw new FHIRException("Cannot make property maxLength as it is not a complex type"); // IntegerType
4472        case -861311717: throw new FHIRException("Cannot make property condition as it is not a complex type"); // IdType
4473        case -190376483:  return addConstraint(); // ElementDefinitionConstraintComponent
4474        case -1402857082: throw new FHIRException("Cannot make property mustSupport as it is not a complex type"); // BooleanType
4475        case -1408783839: throw new FHIRException("Cannot make property isModifier as it is not a complex type"); // BooleanType
4476        case 1857548060: throw new FHIRException("Cannot make property isSummary as it is not a complex type"); // BooleanType
4477        case -108220795:  return getBinding(); // ElementDefinitionBindingComponent
4478        case 837556430:  return addMapping(); // ElementDefinitionMappingComponent
4479        default: return super.makeProperty(hash, name);
4480        }
4481
4482      }
4483
4484      @Override
4485      public Base addChild(String name) throws FHIRException {
4486        if (name.equals("path")) {
4487          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
4488        }
4489        else if (name.equals("representation")) {
4490          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.representation");
4491        }
4492        else if (name.equals("name")) {
4493          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.name");
4494        }
4495        else if (name.equals("label")) {
4496          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.label");
4497        }
4498        else if (name.equals("code")) {
4499          return addCode();
4500        }
4501        else if (name.equals("slicing")) {
4502          this.slicing = new ElementDefinitionSlicingComponent();
4503          return this.slicing;
4504        }
4505        else if (name.equals("short")) {
4506          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.short");
4507        }
4508        else if (name.equals("definition")) {
4509          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.definition");
4510        }
4511        else if (name.equals("comments")) {
4512          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.comments");
4513        }
4514        else if (name.equals("requirements")) {
4515          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
4516        }
4517        else if (name.equals("alias")) {
4518          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.alias");
4519        }
4520        else if (name.equals("min")) {
4521          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
4522        }
4523        else if (name.equals("max")) {
4524          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
4525        }
4526        else if (name.equals("base")) {
4527          this.base = new ElementDefinitionBaseComponent();
4528          return this.base;
4529        }
4530        else if (name.equals("contentReference")) {
4531          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.contentReference");
4532        }
4533        else if (name.equals("type")) {
4534          return addType();
4535        }
4536        else if (name.equals("defaultValueBoolean")) {
4537          this.defaultValue = new BooleanType();
4538          return this.defaultValue;
4539        }
4540        else if (name.equals("defaultValueInteger")) {
4541          this.defaultValue = new IntegerType();
4542          return this.defaultValue;
4543        }
4544        else if (name.equals("defaultValueDecimal")) {
4545          this.defaultValue = new DecimalType();
4546          return this.defaultValue;
4547        }
4548        else if (name.equals("defaultValueBase64Binary")) {
4549          this.defaultValue = new Base64BinaryType();
4550          return this.defaultValue;
4551        }
4552        else if (name.equals("defaultValueInstant")) {
4553          this.defaultValue = new InstantType();
4554          return this.defaultValue;
4555        }
4556        else if (name.equals("defaultValueString")) {
4557          this.defaultValue = new StringType();
4558          return this.defaultValue;
4559        }
4560        else if (name.equals("defaultValueUri")) {
4561          this.defaultValue = new UriType();
4562          return this.defaultValue;
4563        }
4564        else if (name.equals("defaultValueDate")) {
4565          this.defaultValue = new DateType();
4566          return this.defaultValue;
4567        }
4568        else if (name.equals("defaultValueDateTime")) {
4569          this.defaultValue = new DateTimeType();
4570          return this.defaultValue;
4571        }
4572        else if (name.equals("defaultValueTime")) {
4573          this.defaultValue = new TimeType();
4574          return this.defaultValue;
4575        }
4576        else if (name.equals("defaultValueCode")) {
4577          this.defaultValue = new CodeType();
4578          return this.defaultValue;
4579        }
4580        else if (name.equals("defaultValueOid")) {
4581          this.defaultValue = new OidType();
4582          return this.defaultValue;
4583        }
4584        else if (name.equals("defaultValueId")) {
4585          this.defaultValue = new IdType();
4586          return this.defaultValue;
4587        }
4588        else if (name.equals("defaultValueUnsignedInt")) {
4589          this.defaultValue = new UnsignedIntType();
4590          return this.defaultValue;
4591        }
4592        else if (name.equals("defaultValuePositiveInt")) {
4593          this.defaultValue = new PositiveIntType();
4594          return this.defaultValue;
4595        }
4596        else if (name.equals("defaultValueMarkdown")) {
4597          this.defaultValue = new MarkdownType();
4598          return this.defaultValue;
4599        }
4600        else if (name.equals("defaultValueAnnotation")) {
4601          this.defaultValue = new Annotation();
4602          return this.defaultValue;
4603        }
4604        else if (name.equals("defaultValueAttachment")) {
4605          this.defaultValue = new Attachment();
4606          return this.defaultValue;
4607        }
4608        else if (name.equals("defaultValueIdentifier")) {
4609          this.defaultValue = new Identifier();
4610          return this.defaultValue;
4611        }
4612        else if (name.equals("defaultValueCodeableConcept")) {
4613          this.defaultValue = new CodeableConcept();
4614          return this.defaultValue;
4615        }
4616        else if (name.equals("defaultValueCoding")) {
4617          this.defaultValue = new Coding();
4618          return this.defaultValue;
4619        }
4620        else if (name.equals("defaultValueQuantity")) {
4621          this.defaultValue = new Quantity();
4622          return this.defaultValue;
4623        }
4624        else if (name.equals("defaultValueRange")) {
4625          this.defaultValue = new Range();
4626          return this.defaultValue;
4627        }
4628        else if (name.equals("defaultValuePeriod")) {
4629          this.defaultValue = new Period();
4630          return this.defaultValue;
4631        }
4632        else if (name.equals("defaultValueRatio")) {
4633          this.defaultValue = new Ratio();
4634          return this.defaultValue;
4635        }
4636        else if (name.equals("defaultValueSampledData")) {
4637          this.defaultValue = new SampledData();
4638          return this.defaultValue;
4639        }
4640        else if (name.equals("defaultValueSignature")) {
4641          this.defaultValue = new Signature();
4642          return this.defaultValue;
4643        }
4644        else if (name.equals("defaultValueHumanName")) {
4645          this.defaultValue = new HumanName();
4646          return this.defaultValue;
4647        }
4648        else if (name.equals("defaultValueAddress")) {
4649          this.defaultValue = new Address();
4650          return this.defaultValue;
4651        }
4652        else if (name.equals("defaultValueContactPoint")) {
4653          this.defaultValue = new ContactPoint();
4654          return this.defaultValue;
4655        }
4656        else if (name.equals("defaultValueTiming")) {
4657          this.defaultValue = new Timing();
4658          return this.defaultValue;
4659        }
4660        else if (name.equals("defaultValueReference")) {
4661          this.defaultValue = new Reference();
4662          return this.defaultValue;
4663        }
4664        else if (name.equals("defaultValueMeta")) {
4665          this.defaultValue = new Meta();
4666          return this.defaultValue;
4667        }
4668        else if (name.equals("meaningWhenMissing")) {
4669          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.meaningWhenMissing");
4670        }
4671        else if (name.equals("fixedBoolean")) {
4672          this.fixed = new BooleanType();
4673          return this.fixed;
4674        }
4675        else if (name.equals("fixedInteger")) {
4676          this.fixed = new IntegerType();
4677          return this.fixed;
4678        }
4679        else if (name.equals("fixedDecimal")) {
4680          this.fixed = new DecimalType();
4681          return this.fixed;
4682        }
4683        else if (name.equals("fixedBase64Binary")) {
4684          this.fixed = new Base64BinaryType();
4685          return this.fixed;
4686        }
4687        else if (name.equals("fixedInstant")) {
4688          this.fixed = new InstantType();
4689          return this.fixed;
4690        }
4691        else if (name.equals("fixedString")) {
4692          this.fixed = new StringType();
4693          return this.fixed;
4694        }
4695        else if (name.equals("fixedUri")) {
4696          this.fixed = new UriType();
4697          return this.fixed;
4698        }
4699        else if (name.equals("fixedDate")) {
4700          this.fixed = new DateType();
4701          return this.fixed;
4702        }
4703        else if (name.equals("fixedDateTime")) {
4704          this.fixed = new DateTimeType();
4705          return this.fixed;
4706        }
4707        else if (name.equals("fixedTime")) {
4708          this.fixed = new TimeType();
4709          return this.fixed;
4710        }
4711        else if (name.equals("fixedCode")) {
4712          this.fixed = new CodeType();
4713          return this.fixed;
4714        }
4715        else if (name.equals("fixedOid")) {
4716          this.fixed = new OidType();
4717          return this.fixed;
4718        }
4719        else if (name.equals("fixedId")) {
4720          this.fixed = new IdType();
4721          return this.fixed;
4722        }
4723        else if (name.equals("fixedUnsignedInt")) {
4724          this.fixed = new UnsignedIntType();
4725          return this.fixed;
4726        }
4727        else if (name.equals("fixedPositiveInt")) {
4728          this.fixed = new PositiveIntType();
4729          return this.fixed;
4730        }
4731        else if (name.equals("fixedMarkdown")) {
4732          this.fixed = new MarkdownType();
4733          return this.fixed;
4734        }
4735        else if (name.equals("fixedAnnotation")) {
4736          this.fixed = new Annotation();
4737          return this.fixed;
4738        }
4739        else if (name.equals("fixedAttachment")) {
4740          this.fixed = new Attachment();
4741          return this.fixed;
4742        }
4743        else if (name.equals("fixedIdentifier")) {
4744          this.fixed = new Identifier();
4745          return this.fixed;
4746        }
4747        else if (name.equals("fixedCodeableConcept")) {
4748          this.fixed = new CodeableConcept();
4749          return this.fixed;
4750        }
4751        else if (name.equals("fixedCoding")) {
4752          this.fixed = new Coding();
4753          return this.fixed;
4754        }
4755        else if (name.equals("fixedQuantity")) {
4756          this.fixed = new Quantity();
4757          return this.fixed;
4758        }
4759        else if (name.equals("fixedRange")) {
4760          this.fixed = new Range();
4761          return this.fixed;
4762        }
4763        else if (name.equals("fixedPeriod")) {
4764          this.fixed = new Period();
4765          return this.fixed;
4766        }
4767        else if (name.equals("fixedRatio")) {
4768          this.fixed = new Ratio();
4769          return this.fixed;
4770        }
4771        else if (name.equals("fixedSampledData")) {
4772          this.fixed = new SampledData();
4773          return this.fixed;
4774        }
4775        else if (name.equals("fixedSignature")) {
4776          this.fixed = new Signature();
4777          return this.fixed;
4778        }
4779        else if (name.equals("fixedHumanName")) {
4780          this.fixed = new HumanName();
4781          return this.fixed;
4782        }
4783        else if (name.equals("fixedAddress")) {
4784          this.fixed = new Address();
4785          return this.fixed;
4786        }
4787        else if (name.equals("fixedContactPoint")) {
4788          this.fixed = new ContactPoint();
4789          return this.fixed;
4790        }
4791        else if (name.equals("fixedTiming")) {
4792          this.fixed = new Timing();
4793          return this.fixed;
4794        }
4795        else if (name.equals("fixedReference")) {
4796          this.fixed = new Reference();
4797          return this.fixed;
4798        }
4799        else if (name.equals("fixedMeta")) {
4800          this.fixed = new Meta();
4801          return this.fixed;
4802        }
4803        else if (name.equals("patternBoolean")) {
4804          this.pattern = new BooleanType();
4805          return this.pattern;
4806        }
4807        else if (name.equals("patternInteger")) {
4808          this.pattern = new IntegerType();
4809          return this.pattern;
4810        }
4811        else if (name.equals("patternDecimal")) {
4812          this.pattern = new DecimalType();
4813          return this.pattern;
4814        }
4815        else if (name.equals("patternBase64Binary")) {
4816          this.pattern = new Base64BinaryType();
4817          return this.pattern;
4818        }
4819        else if (name.equals("patternInstant")) {
4820          this.pattern = new InstantType();
4821          return this.pattern;
4822        }
4823        else if (name.equals("patternString")) {
4824          this.pattern = new StringType();
4825          return this.pattern;
4826        }
4827        else if (name.equals("patternUri")) {
4828          this.pattern = new UriType();
4829          return this.pattern;
4830        }
4831        else if (name.equals("patternDate")) {
4832          this.pattern = new DateType();
4833          return this.pattern;
4834        }
4835        else if (name.equals("patternDateTime")) {
4836          this.pattern = new DateTimeType();
4837          return this.pattern;
4838        }
4839        else if (name.equals("patternTime")) {
4840          this.pattern = new TimeType();
4841          return this.pattern;
4842        }
4843        else if (name.equals("patternCode")) {
4844          this.pattern = new CodeType();
4845          return this.pattern;
4846        }
4847        else if (name.equals("patternOid")) {
4848          this.pattern = new OidType();
4849          return this.pattern;
4850        }
4851        else if (name.equals("patternId")) {
4852          this.pattern = new IdType();
4853          return this.pattern;
4854        }
4855        else if (name.equals("patternUnsignedInt")) {
4856          this.pattern = new UnsignedIntType();
4857          return this.pattern;
4858        }
4859        else if (name.equals("patternPositiveInt")) {
4860          this.pattern = new PositiveIntType();
4861          return this.pattern;
4862        }
4863        else if (name.equals("patternMarkdown")) {
4864          this.pattern = new MarkdownType();
4865          return this.pattern;
4866        }
4867        else if (name.equals("patternAnnotation")) {
4868          this.pattern = new Annotation();
4869          return this.pattern;
4870        }
4871        else if (name.equals("patternAttachment")) {
4872          this.pattern = new Attachment();
4873          return this.pattern;
4874        }
4875        else if (name.equals("patternIdentifier")) {
4876          this.pattern = new Identifier();
4877          return this.pattern;
4878        }
4879        else if (name.equals("patternCodeableConcept")) {
4880          this.pattern = new CodeableConcept();
4881          return this.pattern;
4882        }
4883        else if (name.equals("patternCoding")) {
4884          this.pattern = new Coding();
4885          return this.pattern;
4886        }
4887        else if (name.equals("patternQuantity")) {
4888          this.pattern = new Quantity();
4889          return this.pattern;
4890        }
4891        else if (name.equals("patternRange")) {
4892          this.pattern = new Range();
4893          return this.pattern;
4894        }
4895        else if (name.equals("patternPeriod")) {
4896          this.pattern = new Period();
4897          return this.pattern;
4898        }
4899        else if (name.equals("patternRatio")) {
4900          this.pattern = new Ratio();
4901          return this.pattern;
4902        }
4903        else if (name.equals("patternSampledData")) {
4904          this.pattern = new SampledData();
4905          return this.pattern;
4906        }
4907        else if (name.equals("patternSignature")) {
4908          this.pattern = new Signature();
4909          return this.pattern;
4910        }
4911        else if (name.equals("patternHumanName")) {
4912          this.pattern = new HumanName();
4913          return this.pattern;
4914        }
4915        else if (name.equals("patternAddress")) {
4916          this.pattern = new Address();
4917          return this.pattern;
4918        }
4919        else if (name.equals("patternContactPoint")) {
4920          this.pattern = new ContactPoint();
4921          return this.pattern;
4922        }
4923        else if (name.equals("patternTiming")) {
4924          this.pattern = new Timing();
4925          return this.pattern;
4926        }
4927        else if (name.equals("patternReference")) {
4928          this.pattern = new Reference();
4929          return this.pattern;
4930        }
4931        else if (name.equals("patternMeta")) {
4932          this.pattern = new Meta();
4933          return this.pattern;
4934        }
4935        else if (name.equals("exampleBoolean")) {
4936          this.example = new BooleanType();
4937          return this.example;
4938        }
4939        else if (name.equals("exampleInteger")) {
4940          this.example = new IntegerType();
4941          return this.example;
4942        }
4943        else if (name.equals("exampleDecimal")) {
4944          this.example = new DecimalType();
4945          return this.example;
4946        }
4947        else if (name.equals("exampleBase64Binary")) {
4948          this.example = new Base64BinaryType();
4949          return this.example;
4950        }
4951        else if (name.equals("exampleInstant")) {
4952          this.example = new InstantType();
4953          return this.example;
4954        }
4955        else if (name.equals("exampleString")) {
4956          this.example = new StringType();
4957          return this.example;
4958        }
4959        else if (name.equals("exampleUri")) {
4960          this.example = new UriType();
4961          return this.example;
4962        }
4963        else if (name.equals("exampleDate")) {
4964          this.example = new DateType();
4965          return this.example;
4966        }
4967        else if (name.equals("exampleDateTime")) {
4968          this.example = new DateTimeType();
4969          return this.example;
4970        }
4971        else if (name.equals("exampleTime")) {
4972          this.example = new TimeType();
4973          return this.example;
4974        }
4975        else if (name.equals("exampleCode")) {
4976          this.example = new CodeType();
4977          return this.example;
4978        }
4979        else if (name.equals("exampleOid")) {
4980          this.example = new OidType();
4981          return this.example;
4982        }
4983        else if (name.equals("exampleId")) {
4984          this.example = new IdType();
4985          return this.example;
4986        }
4987        else if (name.equals("exampleUnsignedInt")) {
4988          this.example = new UnsignedIntType();
4989          return this.example;
4990        }
4991        else if (name.equals("examplePositiveInt")) {
4992          this.example = new PositiveIntType();
4993          return this.example;
4994        }
4995        else if (name.equals("exampleMarkdown")) {
4996          this.example = new MarkdownType();
4997          return this.example;
4998        }
4999        else if (name.equals("exampleAnnotation")) {
5000          this.example = new Annotation();
5001          return this.example;
5002        }
5003        else if (name.equals("exampleAttachment")) {
5004          this.example = new Attachment();
5005          return this.example;
5006        }
5007        else if (name.equals("exampleIdentifier")) {
5008          this.example = new Identifier();
5009          return this.example;
5010        }
5011        else if (name.equals("exampleCodeableConcept")) {
5012          this.example = new CodeableConcept();
5013          return this.example;
5014        }
5015        else if (name.equals("exampleCoding")) {
5016          this.example = new Coding();
5017          return this.example;
5018        }
5019        else if (name.equals("exampleQuantity")) {
5020          this.example = new Quantity();
5021          return this.example;
5022        }
5023        else if (name.equals("exampleRange")) {
5024          this.example = new Range();
5025          return this.example;
5026        }
5027        else if (name.equals("examplePeriod")) {
5028          this.example = new Period();
5029          return this.example;
5030        }
5031        else if (name.equals("exampleRatio")) {
5032          this.example = new Ratio();
5033          return this.example;
5034        }
5035        else if (name.equals("exampleSampledData")) {
5036          this.example = new SampledData();
5037          return this.example;
5038        }
5039        else if (name.equals("exampleSignature")) {
5040          this.example = new Signature();
5041          return this.example;
5042        }
5043        else if (name.equals("exampleHumanName")) {
5044          this.example = new HumanName();
5045          return this.example;
5046        }
5047        else if (name.equals("exampleAddress")) {
5048          this.example = new Address();
5049          return this.example;
5050        }
5051        else if (name.equals("exampleContactPoint")) {
5052          this.example = new ContactPoint();
5053          return this.example;
5054        }
5055        else if (name.equals("exampleTiming")) {
5056          this.example = new Timing();
5057          return this.example;
5058        }
5059        else if (name.equals("exampleReference")) {
5060          this.example = new Reference();
5061          return this.example;
5062        }
5063        else if (name.equals("exampleMeta")) {
5064          this.example = new Meta();
5065          return this.example;
5066        }
5067        else if (name.equals("minValueBoolean")) {
5068          this.minValue = new BooleanType();
5069          return this.minValue;
5070        }
5071        else if (name.equals("minValueInteger")) {
5072          this.minValue = new IntegerType();
5073          return this.minValue;
5074        }
5075        else if (name.equals("minValueDecimal")) {
5076          this.minValue = new DecimalType();
5077          return this.minValue;
5078        }
5079        else if (name.equals("minValueBase64Binary")) {
5080          this.minValue = new Base64BinaryType();
5081          return this.minValue;
5082        }
5083        else if (name.equals("minValueInstant")) {
5084          this.minValue = new InstantType();
5085          return this.minValue;
5086        }
5087        else if (name.equals("minValueString")) {
5088          this.minValue = new StringType();
5089          return this.minValue;
5090        }
5091        else if (name.equals("minValueUri")) {
5092          this.minValue = new UriType();
5093          return this.minValue;
5094        }
5095        else if (name.equals("minValueDate")) {
5096          this.minValue = new DateType();
5097          return this.minValue;
5098        }
5099        else if (name.equals("minValueDateTime")) {
5100          this.minValue = new DateTimeType();
5101          return this.minValue;
5102        }
5103        else if (name.equals("minValueTime")) {
5104          this.minValue = new TimeType();
5105          return this.minValue;
5106        }
5107        else if (name.equals("minValueCode")) {
5108          this.minValue = new CodeType();
5109          return this.minValue;
5110        }
5111        else if (name.equals("minValueOid")) {
5112          this.minValue = new OidType();
5113          return this.minValue;
5114        }
5115        else if (name.equals("minValueId")) {
5116          this.minValue = new IdType();
5117          return this.minValue;
5118        }
5119        else if (name.equals("minValueUnsignedInt")) {
5120          this.minValue = new UnsignedIntType();
5121          return this.minValue;
5122        }
5123        else if (name.equals("minValuePositiveInt")) {
5124          this.minValue = new PositiveIntType();
5125          return this.minValue;
5126        }
5127        else if (name.equals("minValueMarkdown")) {
5128          this.minValue = new MarkdownType();
5129          return this.minValue;
5130        }
5131        else if (name.equals("minValueAnnotation")) {
5132          this.minValue = new Annotation();
5133          return this.minValue;
5134        }
5135        else if (name.equals("minValueAttachment")) {
5136          this.minValue = new Attachment();
5137          return this.minValue;
5138        }
5139        else if (name.equals("minValueIdentifier")) {
5140          this.minValue = new Identifier();
5141          return this.minValue;
5142        }
5143        else if (name.equals("minValueCodeableConcept")) {
5144          this.minValue = new CodeableConcept();
5145          return this.minValue;
5146        }
5147        else if (name.equals("minValueCoding")) {
5148          this.minValue = new Coding();
5149          return this.minValue;
5150        }
5151        else if (name.equals("minValueQuantity")) {
5152          this.minValue = new Quantity();
5153          return this.minValue;
5154        }
5155        else if (name.equals("minValueRange")) {
5156          this.minValue = new Range();
5157          return this.minValue;
5158        }
5159        else if (name.equals("minValuePeriod")) {
5160          this.minValue = new Period();
5161          return this.minValue;
5162        }
5163        else if (name.equals("minValueRatio")) {
5164          this.minValue = new Ratio();
5165          return this.minValue;
5166        }
5167        else if (name.equals("minValueSampledData")) {
5168          this.minValue = new SampledData();
5169          return this.minValue;
5170        }
5171        else if (name.equals("minValueSignature")) {
5172          this.minValue = new Signature();
5173          return this.minValue;
5174        }
5175        else if (name.equals("minValueHumanName")) {
5176          this.minValue = new HumanName();
5177          return this.minValue;
5178        }
5179        else if (name.equals("minValueAddress")) {
5180          this.minValue = new Address();
5181          return this.minValue;
5182        }
5183        else if (name.equals("minValueContactPoint")) {
5184          this.minValue = new ContactPoint();
5185          return this.minValue;
5186        }
5187        else if (name.equals("minValueTiming")) {
5188          this.minValue = new Timing();
5189          return this.minValue;
5190        }
5191        else if (name.equals("minValueReference")) {
5192          this.minValue = new Reference();
5193          return this.minValue;
5194        }
5195        else if (name.equals("minValueMeta")) {
5196          this.minValue = new Meta();
5197          return this.minValue;
5198        }
5199        else if (name.equals("maxValueBoolean")) {
5200          this.maxValue = new BooleanType();
5201          return this.maxValue;
5202        }
5203        else if (name.equals("maxValueInteger")) {
5204          this.maxValue = new IntegerType();
5205          return this.maxValue;
5206        }
5207        else if (name.equals("maxValueDecimal")) {
5208          this.maxValue = new DecimalType();
5209          return this.maxValue;
5210        }
5211        else if (name.equals("maxValueBase64Binary")) {
5212          this.maxValue = new Base64BinaryType();
5213          return this.maxValue;
5214        }
5215        else if (name.equals("maxValueInstant")) {
5216          this.maxValue = new InstantType();
5217          return this.maxValue;
5218        }
5219        else if (name.equals("maxValueString")) {
5220          this.maxValue = new StringType();
5221          return this.maxValue;
5222        }
5223        else if (name.equals("maxValueUri")) {
5224          this.maxValue = new UriType();
5225          return this.maxValue;
5226        }
5227        else if (name.equals("maxValueDate")) {
5228          this.maxValue = new DateType();
5229          return this.maxValue;
5230        }
5231        else if (name.equals("maxValueDateTime")) {
5232          this.maxValue = new DateTimeType();
5233          return this.maxValue;
5234        }
5235        else if (name.equals("maxValueTime")) {
5236          this.maxValue = new TimeType();
5237          return this.maxValue;
5238        }
5239        else if (name.equals("maxValueCode")) {
5240          this.maxValue = new CodeType();
5241          return this.maxValue;
5242        }
5243        else if (name.equals("maxValueOid")) {
5244          this.maxValue = new OidType();
5245          return this.maxValue;
5246        }
5247        else if (name.equals("maxValueId")) {
5248          this.maxValue = new IdType();
5249          return this.maxValue;
5250        }
5251        else if (name.equals("maxValueUnsignedInt")) {
5252          this.maxValue = new UnsignedIntType();
5253          return this.maxValue;
5254        }
5255        else if (name.equals("maxValuePositiveInt")) {
5256          this.maxValue = new PositiveIntType();
5257          return this.maxValue;
5258        }
5259        else if (name.equals("maxValueMarkdown")) {
5260          this.maxValue = new MarkdownType();
5261          return this.maxValue;
5262        }
5263        else if (name.equals("maxValueAnnotation")) {
5264          this.maxValue = new Annotation();
5265          return this.maxValue;
5266        }
5267        else if (name.equals("maxValueAttachment")) {
5268          this.maxValue = new Attachment();
5269          return this.maxValue;
5270        }
5271        else if (name.equals("maxValueIdentifier")) {
5272          this.maxValue = new Identifier();
5273          return this.maxValue;
5274        }
5275        else if (name.equals("maxValueCodeableConcept")) {
5276          this.maxValue = new CodeableConcept();
5277          return this.maxValue;
5278        }
5279        else if (name.equals("maxValueCoding")) {
5280          this.maxValue = new Coding();
5281          return this.maxValue;
5282        }
5283        else if (name.equals("maxValueQuantity")) {
5284          this.maxValue = new Quantity();
5285          return this.maxValue;
5286        }
5287        else if (name.equals("maxValueRange")) {
5288          this.maxValue = new Range();
5289          return this.maxValue;
5290        }
5291        else if (name.equals("maxValuePeriod")) {
5292          this.maxValue = new Period();
5293          return this.maxValue;
5294        }
5295        else if (name.equals("maxValueRatio")) {
5296          this.maxValue = new Ratio();
5297          return this.maxValue;
5298        }
5299        else if (name.equals("maxValueSampledData")) {
5300          this.maxValue = new SampledData();
5301          return this.maxValue;
5302        }
5303        else if (name.equals("maxValueSignature")) {
5304          this.maxValue = new Signature();
5305          return this.maxValue;
5306        }
5307        else if (name.equals("maxValueHumanName")) {
5308          this.maxValue = new HumanName();
5309          return this.maxValue;
5310        }
5311        else if (name.equals("maxValueAddress")) {
5312          this.maxValue = new Address();
5313          return this.maxValue;
5314        }
5315        else if (name.equals("maxValueContactPoint")) {
5316          this.maxValue = new ContactPoint();
5317          return this.maxValue;
5318        }
5319        else if (name.equals("maxValueTiming")) {
5320          this.maxValue = new Timing();
5321          return this.maxValue;
5322        }
5323        else if (name.equals("maxValueReference")) {
5324          this.maxValue = new Reference();
5325          return this.maxValue;
5326        }
5327        else if (name.equals("maxValueMeta")) {
5328          this.maxValue = new Meta();
5329          return this.maxValue;
5330        }
5331        else if (name.equals("maxLength")) {
5332          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.maxLength");
5333        }
5334        else if (name.equals("condition")) {
5335          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.condition");
5336        }
5337        else if (name.equals("constraint")) {
5338          return addConstraint();
5339        }
5340        else if (name.equals("mustSupport")) {
5341          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mustSupport");
5342        }
5343        else if (name.equals("isModifier")) {
5344          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isModifier");
5345        }
5346        else if (name.equals("isSummary")) {
5347          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isSummary");
5348        }
5349        else if (name.equals("binding")) {
5350          this.binding = new ElementDefinitionBindingComponent();
5351          return this.binding;
5352        }
5353        else if (name.equals("mapping")) {
5354          return addMapping();
5355        }
5356        else
5357          return super.addChild(name);
5358      }
5359
5360  public String fhirType() {
5361    return "ElementDefinition";
5362
5363  }
5364
5365      public ElementDefinition copy() {
5366        ElementDefinition dst = new ElementDefinition();
5367        copyValues(dst);
5368        dst.path = path == null ? null : path.copy();
5369        if (representation != null) {
5370          dst.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
5371          for (Enumeration<PropertyRepresentation> i : representation)
5372            dst.representation.add(i.copy());
5373        };
5374        dst.name = name == null ? null : name.copy();
5375        dst.label = label == null ? null : label.copy();
5376        if (code != null) {
5377          dst.code = new ArrayList<Coding>();
5378          for (Coding i : code)
5379            dst.code.add(i.copy());
5380        };
5381        dst.slicing = slicing == null ? null : slicing.copy();
5382        dst.short_ = short_ == null ? null : short_.copy();
5383        dst.definition = definition == null ? null : definition.copy();
5384        dst.comments = comments == null ? null : comments.copy();
5385        dst.requirements = requirements == null ? null : requirements.copy();
5386        if (alias != null) {
5387          dst.alias = new ArrayList<StringType>();
5388          for (StringType i : alias)
5389            dst.alias.add(i.copy());
5390        };
5391        dst.min = min == null ? null : min.copy();
5392        dst.max = max == null ? null : max.copy();
5393        dst.base = base == null ? null : base.copy();
5394        dst.contentReference = contentReference == null ? null : contentReference.copy();
5395        if (type != null) {
5396          dst.type = new ArrayList<TypeRefComponent>();
5397          for (TypeRefComponent i : type)
5398            dst.type.add(i.copy());
5399        };
5400        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
5401        dst.meaningWhenMissing = meaningWhenMissing == null ? null : meaningWhenMissing.copy();
5402        dst.fixed = fixed == null ? null : fixed.copy();
5403        dst.pattern = pattern == null ? null : pattern.copy();
5404        dst.example = example == null ? null : example.copy();
5405        dst.minValue = minValue == null ? null : minValue.copy();
5406        dst.maxValue = maxValue == null ? null : maxValue.copy();
5407        dst.maxLength = maxLength == null ? null : maxLength.copy();
5408        if (condition != null) {
5409          dst.condition = new ArrayList<IdType>();
5410          for (IdType i : condition)
5411            dst.condition.add(i.copy());
5412        };
5413        if (constraint != null) {
5414          dst.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
5415          for (ElementDefinitionConstraintComponent i : constraint)
5416            dst.constraint.add(i.copy());
5417        };
5418        dst.mustSupport = mustSupport == null ? null : mustSupport.copy();
5419        dst.isModifier = isModifier == null ? null : isModifier.copy();
5420        dst.isSummary = isSummary == null ? null : isSummary.copy();
5421        dst.binding = binding == null ? null : binding.copy();
5422        if (mapping != null) {
5423          dst.mapping = new ArrayList<ElementDefinitionMappingComponent>();
5424          for (ElementDefinitionMappingComponent i : mapping)
5425            dst.mapping.add(i.copy());
5426        };
5427        return dst;
5428      }
5429
5430      protected ElementDefinition typedCopy() {
5431        return copy();
5432      }
5433
5434      @Override
5435      public boolean equalsDeep(Base other) {
5436        if (!super.equalsDeep(other))
5437          return false;
5438        if (!(other instanceof ElementDefinition))
5439          return false;
5440        ElementDefinition o = (ElementDefinition) other;
5441        return compareDeep(path, o.path, true) && compareDeep(representation, o.representation, true) && compareDeep(name, o.name, true)
5442           && compareDeep(label, o.label, true) && compareDeep(code, o.code, true) && compareDeep(slicing, o.slicing, true)
5443           && compareDeep(short_, o.short_, true) && compareDeep(definition, o.definition, true) && compareDeep(comments, o.comments, true)
5444           && compareDeep(requirements, o.requirements, true) && compareDeep(alias, o.alias, true) && compareDeep(min, o.min, true)
5445           && compareDeep(max, o.max, true) && compareDeep(base, o.base, true) && compareDeep(contentReference, o.contentReference, true)
5446           && compareDeep(type, o.type, true) && compareDeep(defaultValue, o.defaultValue, true) && compareDeep(meaningWhenMissing, o.meaningWhenMissing, true)
5447           && compareDeep(fixed, o.fixed, true) && compareDeep(pattern, o.pattern, true) && compareDeep(example, o.example, true)
5448           && compareDeep(minValue, o.minValue, true) && compareDeep(maxValue, o.maxValue, true) && compareDeep(maxLength, o.maxLength, true)
5449           && compareDeep(condition, o.condition, true) && compareDeep(constraint, o.constraint, true) && compareDeep(mustSupport, o.mustSupport, true)
5450           && compareDeep(isModifier, o.isModifier, true) && compareDeep(isSummary, o.isSummary, true) && compareDeep(binding, o.binding, true)
5451           && compareDeep(mapping, o.mapping, true);
5452      }
5453
5454      @Override
5455      public boolean equalsShallow(Base other) {
5456        if (!super.equalsShallow(other))
5457          return false;
5458        if (!(other instanceof ElementDefinition))
5459          return false;
5460        ElementDefinition o = (ElementDefinition) other;
5461        return compareValues(path, o.path, true) && compareValues(representation, o.representation, true) && compareValues(name, o.name, true)
5462           && compareValues(label, o.label, true) && compareValues(short_, o.short_, true) && compareValues(definition, o.definition, true)
5463           && compareValues(comments, o.comments, true) && compareValues(requirements, o.requirements, true) && compareValues(alias, o.alias, true)
5464           && compareValues(min, o.min, true) && compareValues(max, o.max, true) && compareValues(contentReference, o.contentReference, true)
5465           && compareValues(meaningWhenMissing, o.meaningWhenMissing, true) && compareValues(maxLength, o.maxLength, true)
5466           && compareValues(condition, o.condition, true) && compareValues(mustSupport, o.mustSupport, true) && compareValues(isModifier, o.isModifier, true)
5467           && compareValues(isSummary, o.isSummary, true);
5468      }
5469
5470      public boolean isEmpty() {
5471        return super.isEmpty() && (path == null || path.isEmpty()) && (representation == null || representation.isEmpty())
5472           && (name == null || name.isEmpty()) && (label == null || label.isEmpty()) && (code == null || code.isEmpty())
5473           && (slicing == null || slicing.isEmpty()) && (short_ == null || short_.isEmpty()) && (definition == null || definition.isEmpty())
5474           && (comments == null || comments.isEmpty()) && (requirements == null || requirements.isEmpty())
5475           && (alias == null || alias.isEmpty()) && (min == null || min.isEmpty()) && (max == null || max.isEmpty())
5476           && (base == null || base.isEmpty()) && (contentReference == null || contentReference.isEmpty())
5477           && (type == null || type.isEmpty()) && (defaultValue == null || defaultValue.isEmpty()) && (meaningWhenMissing == null || meaningWhenMissing.isEmpty())
5478           && (fixed == null || fixed.isEmpty()) && (pattern == null || pattern.isEmpty()) && (example == null || example.isEmpty())
5479           && (minValue == null || minValue.isEmpty()) && (maxValue == null || maxValue.isEmpty()) && (maxLength == null || maxLength.isEmpty())
5480           && (condition == null || condition.isEmpty()) && (constraint == null || constraint.isEmpty())
5481           && (mustSupport == null || mustSupport.isEmpty()) && (isModifier == null || isModifier.isEmpty())
5482           && (isSummary == null || isSummary.isEmpty()) && (binding == null || binding.isEmpty()) && (mapping == null || mapping.isEmpty())
5483          ;
5484      }
5485
5486
5487}