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