001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
037import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.*;
042/**
043 * A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions, and constraints on resources and data types.
044 */
045@ResourceDef(name="StructureDefinition", profile="http://hl7.org/fhir/Profile/StructureDefinition")
046public class StructureDefinition extends DomainResource {
047
048    public enum StructureDefinitionKind {
049        /**
050         * A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions.
051         */
052        DATATYPE, 
053        /**
054         * A resource defined by the FHIR specification.
055         */
056        RESOURCE, 
057        /**
058         * A logical model - a conceptual package of data that will be mapped to resources for implementation.
059         */
060        LOGICAL, 
061        /**
062         * added to help the parsers
063         */
064        NULL;
065        public static StructureDefinitionKind fromCode(String codeString) throws FHIRException {
066            if (codeString == null || "".equals(codeString))
067                return null;
068        if ("datatype".equals(codeString))
069          return DATATYPE;
070        if ("resource".equals(codeString))
071          return RESOURCE;
072        if ("logical".equals(codeString))
073          return LOGICAL;
074        throw new FHIRException("Unknown StructureDefinitionKind code '"+codeString+"'");
075        }
076        public String toCode() {
077          switch (this) {
078            case DATATYPE: return "datatype";
079            case RESOURCE: return "resource";
080            case LOGICAL: return "logical";
081            default: return "?";
082          }
083        }
084        public String getSystem() {
085          switch (this) {
086            case DATATYPE: return "http://hl7.org/fhir/structure-definition-kind";
087            case RESOURCE: return "http://hl7.org/fhir/structure-definition-kind";
088            case LOGICAL: return "http://hl7.org/fhir/structure-definition-kind";
089            default: return "?";
090          }
091        }
092        public String getDefinition() {
093          switch (this) {
094            case DATATYPE: return "A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions.";
095            case RESOURCE: return "A resource defined by the FHIR specification.";
096            case LOGICAL: return "A logical model - a conceptual package of data that will be mapped to resources for implementation.";
097            default: return "?";
098          }
099        }
100        public String getDisplay() {
101          switch (this) {
102            case DATATYPE: return "Data Type";
103            case RESOURCE: return "Resource";
104            case LOGICAL: return "Logical Model";
105            default: return "?";
106          }
107        }
108    }
109
110  public static class StructureDefinitionKindEnumFactory implements EnumFactory<StructureDefinitionKind> {
111    public StructureDefinitionKind fromCode(String codeString) throws IllegalArgumentException {
112      if (codeString == null || "".equals(codeString))
113            if (codeString == null || "".equals(codeString))
114                return null;
115        if ("datatype".equals(codeString))
116          return StructureDefinitionKind.DATATYPE;
117        if ("resource".equals(codeString))
118          return StructureDefinitionKind.RESOURCE;
119        if ("logical".equals(codeString))
120          return StructureDefinitionKind.LOGICAL;
121        throw new IllegalArgumentException("Unknown StructureDefinitionKind code '"+codeString+"'");
122        }
123        public Enumeration<StructureDefinitionKind> fromType(Base code) throws FHIRException {
124          if (code == null || code.isEmpty())
125            return null;
126          String codeString = ((PrimitiveType) code).asStringValue();
127          if (codeString == null || "".equals(codeString))
128            return null;
129        if ("datatype".equals(codeString))
130          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.DATATYPE);
131        if ("resource".equals(codeString))
132          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.RESOURCE);
133        if ("logical".equals(codeString))
134          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.LOGICAL);
135        throw new FHIRException("Unknown StructureDefinitionKind code '"+codeString+"'");
136        }
137    public String toCode(StructureDefinitionKind code) {
138      if (code == StructureDefinitionKind.DATATYPE)
139        return "datatype";
140      if (code == StructureDefinitionKind.RESOURCE)
141        return "resource";
142      if (code == StructureDefinitionKind.LOGICAL)
143        return "logical";
144      return "?";
145      }
146    }
147
148    public enum ExtensionContext {
149        /**
150         * The context is all elements matching a particular resource element path.
151         */
152        RESOURCE, 
153        /**
154         * The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).
155         */
156        DATATYPE, 
157        /**
158         * The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.
159         */
160        MAPPING, 
161        /**
162         * The context is a particular extension from a particular profile, a uri that identifies the extension definition.
163         */
164        EXTENSION, 
165        /**
166         * added to help the parsers
167         */
168        NULL;
169        public static ExtensionContext fromCode(String codeString) throws FHIRException {
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("resource".equals(codeString))
173          return RESOURCE;
174        if ("datatype".equals(codeString))
175          return DATATYPE;
176        if ("mapping".equals(codeString))
177          return MAPPING;
178        if ("extension".equals(codeString))
179          return EXTENSION;
180        throw new FHIRException("Unknown ExtensionContext code '"+codeString+"'");
181        }
182        public String toCode() {
183          switch (this) {
184            case RESOURCE: return "resource";
185            case DATATYPE: return "datatype";
186            case MAPPING: return "mapping";
187            case EXTENSION: return "extension";
188            default: return "?";
189          }
190        }
191        public String getSystem() {
192          switch (this) {
193            case RESOURCE: return "http://hl7.org/fhir/extension-context";
194            case DATATYPE: return "http://hl7.org/fhir/extension-context";
195            case MAPPING: return "http://hl7.org/fhir/extension-context";
196            case EXTENSION: return "http://hl7.org/fhir/extension-context";
197            default: return "?";
198          }
199        }
200        public String getDefinition() {
201          switch (this) {
202            case RESOURCE: return "The context is all elements matching a particular resource element path.";
203            case DATATYPE: return "The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).";
204            case MAPPING: return "The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.";
205            case EXTENSION: return "The context is a particular extension from a particular profile, a uri that identifies the extension definition.";
206            default: return "?";
207          }
208        }
209        public String getDisplay() {
210          switch (this) {
211            case RESOURCE: return "Resource";
212            case DATATYPE: return "Datatype";
213            case MAPPING: return "Mapping";
214            case EXTENSION: return "Extension";
215            default: return "?";
216          }
217        }
218    }
219
220  public static class ExtensionContextEnumFactory implements EnumFactory<ExtensionContext> {
221    public ExtensionContext fromCode(String codeString) throws IllegalArgumentException {
222      if (codeString == null || "".equals(codeString))
223            if (codeString == null || "".equals(codeString))
224                return null;
225        if ("resource".equals(codeString))
226          return ExtensionContext.RESOURCE;
227        if ("datatype".equals(codeString))
228          return ExtensionContext.DATATYPE;
229        if ("mapping".equals(codeString))
230          return ExtensionContext.MAPPING;
231        if ("extension".equals(codeString))
232          return ExtensionContext.EXTENSION;
233        throw new IllegalArgumentException("Unknown ExtensionContext code '"+codeString+"'");
234        }
235        public Enumeration<ExtensionContext> fromType(Base code) throws FHIRException {
236          if (code == null || code.isEmpty())
237            return null;
238          String codeString = ((PrimitiveType) code).asStringValue();
239          if (codeString == null || "".equals(codeString))
240            return null;
241        if ("resource".equals(codeString))
242          return new Enumeration<ExtensionContext>(this, ExtensionContext.RESOURCE);
243        if ("datatype".equals(codeString))
244          return new Enumeration<ExtensionContext>(this, ExtensionContext.DATATYPE);
245        if ("mapping".equals(codeString))
246          return new Enumeration<ExtensionContext>(this, ExtensionContext.MAPPING);
247        if ("extension".equals(codeString))
248          return new Enumeration<ExtensionContext>(this, ExtensionContext.EXTENSION);
249        throw new FHIRException("Unknown ExtensionContext code '"+codeString+"'");
250        }
251    public String toCode(ExtensionContext code) {
252      if (code == ExtensionContext.RESOURCE)
253        return "resource";
254      if (code == ExtensionContext.DATATYPE)
255        return "datatype";
256      if (code == ExtensionContext.MAPPING)
257        return "mapping";
258      if (code == ExtensionContext.EXTENSION)
259        return "extension";
260      return "?";
261      }
262    }
263
264    @Block()
265    public static class StructureDefinitionContactComponent extends BackboneElement implements IBaseBackboneElement {
266        /**
267         * The name of an individual to contact regarding the structure definition.
268         */
269        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
270        @Description(shortDefinition="Name of a individual to contact", formalDefinition="The name of an individual to contact regarding the structure definition." )
271        protected StringType name;
272
273        /**
274         * Contact details for individual (if a name was provided) or the publisher.
275         */
276        @Child(name = "telecom", type = {ContactPoint.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
277        @Description(shortDefinition="Contact details for individual or publisher", formalDefinition="Contact details for individual (if a name was provided) or the publisher." )
278        protected List<ContactPoint> telecom;
279
280        private static final long serialVersionUID = -1179697803L;
281
282    /*
283     * Constructor
284     */
285      public StructureDefinitionContactComponent() {
286        super();
287      }
288
289        /**
290         * @return {@link #name} (The name of an individual to contact regarding the structure definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
291         */
292        public StringType getNameElement() { 
293          if (this.name == null)
294            if (Configuration.errorOnAutoCreate())
295              throw new Error("Attempt to auto-create StructureDefinitionContactComponent.name");
296            else if (Configuration.doAutoCreate())
297              this.name = new StringType(); // bb
298          return this.name;
299        }
300
301        public boolean hasNameElement() { 
302          return this.name != null && !this.name.isEmpty();
303        }
304
305        public boolean hasName() { 
306          return this.name != null && !this.name.isEmpty();
307        }
308
309        /**
310         * @param value {@link #name} (The name of an individual to contact regarding the structure definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
311         */
312        public StructureDefinitionContactComponent setNameElement(StringType value) { 
313          this.name = value;
314          return this;
315        }
316
317        /**
318         * @return The name of an individual to contact regarding the structure definition.
319         */
320        public String getName() { 
321          return this.name == null ? null : this.name.getValue();
322        }
323
324        /**
325         * @param value The name of an individual to contact regarding the structure definition.
326         */
327        public StructureDefinitionContactComponent setName(String value) { 
328          if (Utilities.noString(value))
329            this.name = null;
330          else {
331            if (this.name == null)
332              this.name = new StringType();
333            this.name.setValue(value);
334          }
335          return this;
336        }
337
338        /**
339         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
340         */
341        public List<ContactPoint> getTelecom() { 
342          if (this.telecom == null)
343            this.telecom = new ArrayList<ContactPoint>();
344          return this.telecom;
345        }
346
347        public boolean hasTelecom() { 
348          if (this.telecom == null)
349            return false;
350          for (ContactPoint item : this.telecom)
351            if (!item.isEmpty())
352              return true;
353          return false;
354        }
355
356        /**
357         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
358         */
359    // syntactic sugar
360        public ContactPoint addTelecom() { //3
361          ContactPoint t = new ContactPoint();
362          if (this.telecom == null)
363            this.telecom = new ArrayList<ContactPoint>();
364          this.telecom.add(t);
365          return t;
366        }
367
368    // syntactic sugar
369        public StructureDefinitionContactComponent addTelecom(ContactPoint t) { //3
370          if (t == null)
371            return this;
372          if (this.telecom == null)
373            this.telecom = new ArrayList<ContactPoint>();
374          this.telecom.add(t);
375          return this;
376        }
377
378        protected void listChildren(List<Property> childrenList) {
379          super.listChildren(childrenList);
380          childrenList.add(new Property("name", "string", "The name of an individual to contact regarding the structure definition.", 0, java.lang.Integer.MAX_VALUE, name));
381          childrenList.add(new Property("telecom", "ContactPoint", "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE, telecom));
382        }
383
384      @Override
385      public void setProperty(String name, Base value) throws FHIRException {
386        if (name.equals("name"))
387          this.name = castToString(value); // StringType
388        else if (name.equals("telecom"))
389          this.getTelecom().add(castToContactPoint(value));
390        else
391          super.setProperty(name, value);
392      }
393
394      @Override
395      public Base addChild(String name) throws FHIRException {
396        if (name.equals("name")) {
397          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
398        }
399        else if (name.equals("telecom")) {
400          return addTelecom();
401        }
402        else
403          return super.addChild(name);
404      }
405
406      public StructureDefinitionContactComponent copy() {
407        StructureDefinitionContactComponent dst = new StructureDefinitionContactComponent();
408        copyValues(dst);
409        dst.name = name == null ? null : name.copy();
410        if (telecom != null) {
411          dst.telecom = new ArrayList<ContactPoint>();
412          for (ContactPoint i : telecom)
413            dst.telecom.add(i.copy());
414        };
415        return dst;
416      }
417
418      @Override
419      public boolean equalsDeep(Base other) {
420        if (!super.equalsDeep(other))
421          return false;
422        if (!(other instanceof StructureDefinitionContactComponent))
423          return false;
424        StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
425        return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
426      }
427
428      @Override
429      public boolean equalsShallow(Base other) {
430        if (!super.equalsShallow(other))
431          return false;
432        if (!(other instanceof StructureDefinitionContactComponent))
433          return false;
434        StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
435        return compareValues(name, o.name, true);
436      }
437
438      public boolean isEmpty() {
439        return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
440          ;
441      }
442
443  public String fhirType() {
444    return "StructureDefinition.contact";
445
446  }
447
448  }
449
450    @Block()
451    public static class StructureDefinitionMappingComponent extends BackboneElement implements IBaseBackboneElement {
452        /**
453         * An Internal id that is used to identify this mapping set when specific mappings are made.
454         */
455        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
456        @Description(shortDefinition="Internal id when this mapping is used", formalDefinition="An Internal id that is used to identify this mapping set when specific mappings are made." )
457        protected IdType identity;
458
459        /**
460         * An absolute URI that identifies the specification that this mapping is expressed to.
461         */
462        @Child(name = "uri", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
463        @Description(shortDefinition="Identifies what this mapping refers to", formalDefinition="An absolute URI that identifies the specification that this mapping is expressed to." )
464        protected UriType uri;
465
466        /**
467         * A name for the specification that is being mapped to.
468         */
469        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
470        @Description(shortDefinition="Names what this mapping refers to", formalDefinition="A name for the specification that is being mapped to." )
471        protected StringType name;
472
473        /**
474         * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
475         */
476        @Child(name = "comments", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
477        @Description(shortDefinition="Versions, Issues, Scope limitations etc.", formalDefinition="Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage." )
478        protected StringType comments;
479
480        private static final long serialVersionUID = 299630820L;
481
482    /*
483     * Constructor
484     */
485      public StructureDefinitionMappingComponent() {
486        super();
487      }
488
489    /*
490     * Constructor
491     */
492      public StructureDefinitionMappingComponent(IdType identity) {
493        super();
494        this.identity = identity;
495      }
496
497        /**
498         * @return {@link #identity} (An Internal id that is used to identify this mapping set when specific mappings are made.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
499         */
500        public IdType getIdentityElement() { 
501          if (this.identity == null)
502            if (Configuration.errorOnAutoCreate())
503              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.identity");
504            else if (Configuration.doAutoCreate())
505              this.identity = new IdType(); // bb
506          return this.identity;
507        }
508
509        public boolean hasIdentityElement() { 
510          return this.identity != null && !this.identity.isEmpty();
511        }
512
513        public boolean hasIdentity() { 
514          return this.identity != null && !this.identity.isEmpty();
515        }
516
517        /**
518         * @param value {@link #identity} (An Internal id that is used to identify this mapping set when specific mappings are made.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
519         */
520        public StructureDefinitionMappingComponent setIdentityElement(IdType value) { 
521          this.identity = value;
522          return this;
523        }
524
525        /**
526         * @return An Internal id that is used to identify this mapping set when specific mappings are made.
527         */
528        public String getIdentity() { 
529          return this.identity == null ? null : this.identity.getValue();
530        }
531
532        /**
533         * @param value An Internal id that is used to identify this mapping set when specific mappings are made.
534         */
535        public StructureDefinitionMappingComponent setIdentity(String value) { 
536            if (this.identity == null)
537              this.identity = new IdType();
538            this.identity.setValue(value);
539          return this;
540        }
541
542        /**
543         * @return {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
544         */
545        public UriType getUriElement() { 
546          if (this.uri == null)
547            if (Configuration.errorOnAutoCreate())
548              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.uri");
549            else if (Configuration.doAutoCreate())
550              this.uri = new UriType(); // bb
551          return this.uri;
552        }
553
554        public boolean hasUriElement() { 
555          return this.uri != null && !this.uri.isEmpty();
556        }
557
558        public boolean hasUri() { 
559          return this.uri != null && !this.uri.isEmpty();
560        }
561
562        /**
563         * @param value {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
564         */
565        public StructureDefinitionMappingComponent setUriElement(UriType value) { 
566          this.uri = value;
567          return this;
568        }
569
570        /**
571         * @return An absolute URI that identifies the specification that this mapping is expressed to.
572         */
573        public String getUri() { 
574          return this.uri == null ? null : this.uri.getValue();
575        }
576
577        /**
578         * @param value An absolute URI that identifies the specification that this mapping is expressed to.
579         */
580        public StructureDefinitionMappingComponent setUri(String value) { 
581          if (Utilities.noString(value))
582            this.uri = null;
583          else {
584            if (this.uri == null)
585              this.uri = new UriType();
586            this.uri.setValue(value);
587          }
588          return this;
589        }
590
591        /**
592         * @return {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
593         */
594        public StringType getNameElement() { 
595          if (this.name == null)
596            if (Configuration.errorOnAutoCreate())
597              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.name");
598            else if (Configuration.doAutoCreate())
599              this.name = new StringType(); // bb
600          return this.name;
601        }
602
603        public boolean hasNameElement() { 
604          return this.name != null && !this.name.isEmpty();
605        }
606
607        public boolean hasName() { 
608          return this.name != null && !this.name.isEmpty();
609        }
610
611        /**
612         * @param value {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
613         */
614        public StructureDefinitionMappingComponent setNameElement(StringType value) { 
615          this.name = value;
616          return this;
617        }
618
619        /**
620         * @return A name for the specification that is being mapped to.
621         */
622        public String getName() { 
623          return this.name == null ? null : this.name.getValue();
624        }
625
626        /**
627         * @param value A name for the specification that is being mapped to.
628         */
629        public StructureDefinitionMappingComponent setName(String value) { 
630          if (Utilities.noString(value))
631            this.name = null;
632          else {
633            if (this.name == null)
634              this.name = new StringType();
635            this.name.setValue(value);
636          }
637          return this;
638        }
639
640        /**
641         * @return {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
642         */
643        public StringType getCommentsElement() { 
644          if (this.comments == null)
645            if (Configuration.errorOnAutoCreate())
646              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.comments");
647            else if (Configuration.doAutoCreate())
648              this.comments = new StringType(); // bb
649          return this.comments;
650        }
651
652        public boolean hasCommentsElement() { 
653          return this.comments != null && !this.comments.isEmpty();
654        }
655
656        public boolean hasComments() { 
657          return this.comments != null && !this.comments.isEmpty();
658        }
659
660        /**
661         * @param value {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
662         */
663        public StructureDefinitionMappingComponent setCommentsElement(StringType value) { 
664          this.comments = value;
665          return this;
666        }
667
668        /**
669         * @return Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
670         */
671        public String getComments() { 
672          return this.comments == null ? null : this.comments.getValue();
673        }
674
675        /**
676         * @param value Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
677         */
678        public StructureDefinitionMappingComponent setComments(String value) { 
679          if (Utilities.noString(value))
680            this.comments = null;
681          else {
682            if (this.comments == null)
683              this.comments = new StringType();
684            this.comments.setValue(value);
685          }
686          return this;
687        }
688
689        protected void listChildren(List<Property> childrenList) {
690          super.listChildren(childrenList);
691          childrenList.add(new Property("identity", "id", "An Internal id that is used to identify this mapping set when specific mappings are made.", 0, java.lang.Integer.MAX_VALUE, identity));
692          childrenList.add(new Property("uri", "uri", "An absolute URI that identifies the specification that this mapping is expressed to.", 0, java.lang.Integer.MAX_VALUE, uri));
693          childrenList.add(new Property("name", "string", "A name for the specification that is being mapped to.", 0, java.lang.Integer.MAX_VALUE, name));
694          childrenList.add(new Property("comments", "string", "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.", 0, java.lang.Integer.MAX_VALUE, comments));
695        }
696
697      @Override
698      public void setProperty(String name, Base value) throws FHIRException {
699        if (name.equals("identity"))
700          this.identity = castToId(value); // IdType
701        else if (name.equals("uri"))
702          this.uri = castToUri(value); // UriType
703        else if (name.equals("name"))
704          this.name = castToString(value); // StringType
705        else if (name.equals("comments"))
706          this.comments = castToString(value); // StringType
707        else
708          super.setProperty(name, value);
709      }
710
711      @Override
712      public Base addChild(String name) throws FHIRException {
713        if (name.equals("identity")) {
714          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.identity");
715        }
716        else if (name.equals("uri")) {
717          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.uri");
718        }
719        else if (name.equals("name")) {
720          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
721        }
722        else if (name.equals("comments")) {
723          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.comments");
724        }
725        else
726          return super.addChild(name);
727      }
728
729      public StructureDefinitionMappingComponent copy() {
730        StructureDefinitionMappingComponent dst = new StructureDefinitionMappingComponent();
731        copyValues(dst);
732        dst.identity = identity == null ? null : identity.copy();
733        dst.uri = uri == null ? null : uri.copy();
734        dst.name = name == null ? null : name.copy();
735        dst.comments = comments == null ? null : comments.copy();
736        return dst;
737      }
738
739      @Override
740      public boolean equalsDeep(Base other) {
741        if (!super.equalsDeep(other))
742          return false;
743        if (!(other instanceof StructureDefinitionMappingComponent))
744          return false;
745        StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
746        return compareDeep(identity, o.identity, true) && compareDeep(uri, o.uri, true) && compareDeep(name, o.name, true)
747           && compareDeep(comments, o.comments, true);
748      }
749
750      @Override
751      public boolean equalsShallow(Base other) {
752        if (!super.equalsShallow(other))
753          return false;
754        if (!(other instanceof StructureDefinitionMappingComponent))
755          return false;
756        StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
757        return compareValues(identity, o.identity, true) && compareValues(uri, o.uri, true) && compareValues(name, o.name, true)
758           && compareValues(comments, o.comments, true);
759      }
760
761      public boolean isEmpty() {
762        return super.isEmpty() && (identity == null || identity.isEmpty()) && (uri == null || uri.isEmpty())
763           && (name == null || name.isEmpty()) && (comments == null || comments.isEmpty());
764      }
765
766  public String fhirType() {
767    return "StructureDefinition.mapping";
768
769  }
770
771  }
772
773    @Block()
774    public static class StructureDefinitionSnapshotComponent extends BackboneElement implements IBaseBackboneElement {
775        /**
776         * Captures constraints on each element within the resource.
777         */
778        @Child(name = "element", type = {ElementDefinition.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
779        @Description(shortDefinition="Definition of elements in the resource (if no StructureDefinition)", formalDefinition="Captures constraints on each element within the resource." )
780        protected List<ElementDefinition> element;
781
782        private static final long serialVersionUID = 53896641L;
783
784    /*
785     * Constructor
786     */
787      public StructureDefinitionSnapshotComponent() {
788        super();
789      }
790
791        /**
792         * @return {@link #element} (Captures constraints on each element within the resource.)
793         */
794        public List<ElementDefinition> getElement() { 
795          if (this.element == null)
796            this.element = new ArrayList<ElementDefinition>();
797          return this.element;
798        }
799
800        public boolean hasElement() { 
801          if (this.element == null)
802            return false;
803          for (ElementDefinition item : this.element)
804            if (!item.isEmpty())
805              return true;
806          return false;
807        }
808
809        /**
810         * @return {@link #element} (Captures constraints on each element within the resource.)
811         */
812    // syntactic sugar
813        public ElementDefinition addElement() { //3
814          ElementDefinition t = new ElementDefinition();
815          if (this.element == null)
816            this.element = new ArrayList<ElementDefinition>();
817          this.element.add(t);
818          return t;
819        }
820
821    // syntactic sugar
822        public StructureDefinitionSnapshotComponent addElement(ElementDefinition t) { //3
823          if (t == null)
824            return this;
825          if (this.element == null)
826            this.element = new ArrayList<ElementDefinition>();
827          this.element.add(t);
828          return this;
829        }
830
831        protected void listChildren(List<Property> childrenList) {
832          super.listChildren(childrenList);
833          childrenList.add(new Property("element", "ElementDefinition", "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
834        }
835
836      @Override
837      public void setProperty(String name, Base value) throws FHIRException {
838        if (name.equals("element"))
839          this.getElement().add(castToElementDefinition(value));
840        else
841          super.setProperty(name, value);
842      }
843
844      @Override
845      public Base addChild(String name) throws FHIRException {
846        if (name.equals("element")) {
847          return addElement();
848        }
849        else
850          return super.addChild(name);
851      }
852
853      public StructureDefinitionSnapshotComponent copy() {
854        StructureDefinitionSnapshotComponent dst = new StructureDefinitionSnapshotComponent();
855        copyValues(dst);
856        if (element != null) {
857          dst.element = new ArrayList<ElementDefinition>();
858          for (ElementDefinition i : element)
859            dst.element.add(i.copy());
860        };
861        return dst;
862      }
863
864      @Override
865      public boolean equalsDeep(Base other) {
866        if (!super.equalsDeep(other))
867          return false;
868        if (!(other instanceof StructureDefinitionSnapshotComponent))
869          return false;
870        StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
871        return compareDeep(element, o.element, true);
872      }
873
874      @Override
875      public boolean equalsShallow(Base other) {
876        if (!super.equalsShallow(other))
877          return false;
878        if (!(other instanceof StructureDefinitionSnapshotComponent))
879          return false;
880        StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
881        return true;
882      }
883
884      public boolean isEmpty() {
885        return super.isEmpty() && (element == null || element.isEmpty());
886      }
887
888  public String fhirType() {
889    return "StructureDefinition.snapshot";
890
891  }
892
893  }
894
895    @Block()
896    public static class StructureDefinitionDifferentialComponent extends BackboneElement implements IBaseBackboneElement {
897        /**
898         * Captures constraints on each element within the resource.
899         */
900        @Child(name = "element", type = {ElementDefinition.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
901        @Description(shortDefinition="Definition of elements in the resource (if no StructureDefinition)", formalDefinition="Captures constraints on each element within the resource." )
902        protected List<ElementDefinition> element;
903
904        private static final long serialVersionUID = 53896641L;
905
906    /*
907     * Constructor
908     */
909      public StructureDefinitionDifferentialComponent() {
910        super();
911      }
912
913        /**
914         * @return {@link #element} (Captures constraints on each element within the resource.)
915         */
916        public List<ElementDefinition> getElement() { 
917          if (this.element == null)
918            this.element = new ArrayList<ElementDefinition>();
919          return this.element;
920        }
921
922        public boolean hasElement() { 
923          if (this.element == null)
924            return false;
925          for (ElementDefinition item : this.element)
926            if (!item.isEmpty())
927              return true;
928          return false;
929        }
930
931        /**
932         * @return {@link #element} (Captures constraints on each element within the resource.)
933         */
934    // syntactic sugar
935        public ElementDefinition addElement() { //3
936          ElementDefinition t = new ElementDefinition();
937          if (this.element == null)
938            this.element = new ArrayList<ElementDefinition>();
939          this.element.add(t);
940          return t;
941        }
942
943    // syntactic sugar
944        public StructureDefinitionDifferentialComponent addElement(ElementDefinition t) { //3
945          if (t == null)
946            return this;
947          if (this.element == null)
948            this.element = new ArrayList<ElementDefinition>();
949          this.element.add(t);
950          return this;
951        }
952
953        protected void listChildren(List<Property> childrenList) {
954          super.listChildren(childrenList);
955          childrenList.add(new Property("element", "ElementDefinition", "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
956        }
957
958      @Override
959      public void setProperty(String name, Base value) throws FHIRException {
960        if (name.equals("element"))
961          this.getElement().add(castToElementDefinition(value));
962        else
963          super.setProperty(name, value);
964      }
965
966      @Override
967      public Base addChild(String name) throws FHIRException {
968        if (name.equals("element")) {
969          return addElement();
970        }
971        else
972          return super.addChild(name);
973      }
974
975      public StructureDefinitionDifferentialComponent copy() {
976        StructureDefinitionDifferentialComponent dst = new StructureDefinitionDifferentialComponent();
977        copyValues(dst);
978        if (element != null) {
979          dst.element = new ArrayList<ElementDefinition>();
980          for (ElementDefinition i : element)
981            dst.element.add(i.copy());
982        };
983        return dst;
984      }
985
986      @Override
987      public boolean equalsDeep(Base other) {
988        if (!super.equalsDeep(other))
989          return false;
990        if (!(other instanceof StructureDefinitionDifferentialComponent))
991          return false;
992        StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
993        return compareDeep(element, o.element, true);
994      }
995
996      @Override
997      public boolean equalsShallow(Base other) {
998        if (!super.equalsShallow(other))
999          return false;
1000        if (!(other instanceof StructureDefinitionDifferentialComponent))
1001          return false;
1002        StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
1003        return true;
1004      }
1005
1006      public boolean isEmpty() {
1007        return super.isEmpty() && (element == null || element.isEmpty());
1008      }
1009
1010  public String fhirType() {
1011    return "StructureDefinition.differential";
1012
1013  }
1014
1015  }
1016
1017    /**
1018     * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1019     */
1020    @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1021    @Description(shortDefinition="Absolute URL used to reference this StructureDefinition", formalDefinition="An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published." )
1022    protected UriType url;
1023
1024    /**
1025     * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).
1026     */
1027    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1028    @Description(shortDefinition="Other identifiers for the StructureDefinition", formalDefinition="Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI)." )
1029    protected List<Identifier> identifier;
1030
1031    /**
1032     * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1033     */
1034    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1035    @Description(shortDefinition="Logical id for this version of the StructureDefinition", formalDefinition="The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually." )
1036    protected StringType version;
1037
1038    /**
1039     * A free text natural language name identifying the StructureDefinition.
1040     */
1041    @Child(name = "name", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1042    @Description(shortDefinition="Informal name for this StructureDefinition", formalDefinition="A free text natural language name identifying the StructureDefinition." )
1043    protected StringType name;
1044
1045    /**
1046     * Defined so that applications can use this name when displaying the value of the extension to the user.
1047     */
1048    @Child(name = "display", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1049    @Description(shortDefinition="Use this name when displaying the value", formalDefinition="Defined so that applications can use this name when displaying the value of the extension to the user." )
1050    protected StringType display;
1051
1052    /**
1053     * The status of the StructureDefinition.
1054     */
1055    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
1056    @Description(shortDefinition="draft | active | retired", formalDefinition="The status of the StructureDefinition." )
1057    protected Enumeration<ConformanceResourceStatus> status;
1058
1059    /**
1060     * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1061     */
1062    @Child(name = "experimental", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1063    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
1064    protected BooleanType experimental;
1065
1066    /**
1067     * The name of the individual or organization that published the structure definition.
1068     */
1069    @Child(name = "publisher", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1070    @Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the structure definition." )
1071    protected StringType publisher;
1072
1073    /**
1074     * Contacts to assist a user in finding and communicating with the publisher.
1075     */
1076    @Child(name = "contact", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1077    @Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
1078    protected List<StructureDefinitionContactComponent> contact;
1079
1080    /**
1081     * The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1082     */
1083    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1084    @Description(shortDefinition="Date for this version of the StructureDefinition", formalDefinition="The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes." )
1085    protected DateTimeType date;
1086
1087    /**
1088     * A free text natural language description of the StructureDefinition and its use.
1089     */
1090    @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1091    @Description(shortDefinition="Natural language description of the StructureDefinition", formalDefinition="A free text natural language description of the StructureDefinition and its use." )
1092    protected StringType description;
1093
1094    /**
1095     * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.
1096     */
1097    @Child(name = "useContext", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1098    @Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions." )
1099    protected List<CodeableConcept> useContext;
1100
1101    /**
1102     * Explains why this structure definition is needed and why it's been constrained as it has.
1103     */
1104    @Child(name = "requirements", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1105    @Description(shortDefinition="Scope and Usage this structure definition is for", formalDefinition="Explains why this structure definition is needed and why it's been constrained as it has." )
1106    protected StringType requirements;
1107
1108    /**
1109     * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1110     */
1111    @Child(name = "copyright", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
1112    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings." )
1113    protected StringType copyright;
1114
1115    /**
1116     * A set of terms from external terminologies that may be used to assist with indexing and searching of templates.
1117     */
1118    @Child(name = "code", type = {Coding.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1119    @Description(shortDefinition="Assist with indexing and finding", formalDefinition="A set of terms from external terminologies that may be used to assist with indexing and searching of templates." )
1120    protected List<Coding> code;
1121
1122    /**
1123     * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1124     */
1125    @Child(name = "fhirVersion", type = {IdType.class}, order=15, min=0, max=1, modifier=false, summary=true)
1126    @Description(shortDefinition="FHIR Version this StructureDefinition targets", formalDefinition="The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version." )
1127    protected IdType fhirVersion;
1128
1129    /**
1130     * An external specification that the content is mapped to.
1131     */
1132    @Child(name = "mapping", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1133    @Description(shortDefinition="External specification that the content is mapped to", formalDefinition="An external specification that the content is mapped to." )
1134    protected List<StructureDefinitionMappingComponent> mapping;
1135
1136    /**
1137     * Defines the kind of structure that this definition is describing.
1138     */
1139    @Child(name = "kind", type = {CodeType.class}, order=17, min=1, max=1, modifier=false, summary=true)
1140    @Description(shortDefinition="datatype | resource | logical", formalDefinition="Defines the kind of structure that this definition is describing." )
1141    protected Enumeration<StructureDefinitionKind> kind;
1142
1143    /**
1144     * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
1145     */
1146    @Child(name = "constrainedType", type = {CodeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1147    @Description(shortDefinition="Any datatype or resource, including abstract ones", formalDefinition="The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure." )
1148    protected CodeType constrainedType;
1149
1150    /**
1151     * Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
1152     */
1153    @Child(name = "abstract", type = {BooleanType.class}, order=19, min=1, max=1, modifier=false, summary=true)
1154    @Description(shortDefinition="Whether the structure is abstract", formalDefinition="Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type." )
1155    protected BooleanType abstract_;
1156
1157    /**
1158     * If this is an extension, Identifies the context within FHIR resources where the extension can be used.
1159     */
1160    @Child(name = "contextType", type = {CodeType.class}, order=20, min=0, max=1, modifier=false, summary=true)
1161    @Description(shortDefinition="resource | datatype | mapping | extension", formalDefinition="If this is an extension, Identifies the context within FHIR resources where the extension can be used." )
1162    protected Enumeration<ExtensionContext> contextType;
1163
1164    /**
1165     * Identifies the types of resource or data type elements to which the extension can be applied.
1166     */
1167    @Child(name = "context", type = {StringType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1168    @Description(shortDefinition="Where the extension can be used in instances", formalDefinition="Identifies the types of resource or data type elements to which the extension can be applied." )
1169    protected List<StringType> context;
1170
1171    /**
1172     * An absolute URI that is the base structure from which this set of constraints is derived.
1173     */
1174    @Child(name = "base", type = {UriType.class}, order=22, min=0, max=1, modifier=false, summary=true)
1175    @Description(shortDefinition="Structure that this set of constraints applies to", formalDefinition="An absolute URI that is the base structure from which this set of constraints is derived." )
1176    protected UriType base;
1177
1178    /**
1179     * A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.
1180     */
1181    @Child(name = "snapshot", type = {}, order=23, min=0, max=1, modifier=false, summary=false)
1182    @Description(shortDefinition="Snapshot view of the structure", formalDefinition="A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition." )
1183    protected StructureDefinitionSnapshotComponent snapshot;
1184
1185    /**
1186     * A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.
1187     */
1188    @Child(name = "differential", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
1189    @Description(shortDefinition="Differential view of the structure", formalDefinition="A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies." )
1190    protected StructureDefinitionDifferentialComponent differential;
1191
1192    private static final long serialVersionUID = -580779569L;
1193
1194  /*
1195   * Constructor
1196   */
1197    public StructureDefinition() {
1198      super();
1199    }
1200
1201  /*
1202   * Constructor
1203   */
1204    public StructureDefinition(UriType url, StringType name, Enumeration<ConformanceResourceStatus> status, Enumeration<StructureDefinitionKind> kind, BooleanType abstract_) {
1205      super();
1206      this.url = url;
1207      this.name = name;
1208      this.status = status;
1209      this.kind = kind;
1210      this.abstract_ = abstract_;
1211    }
1212
1213    /**
1214     * @return {@link #url} (An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1215     */
1216    public UriType getUrlElement() { 
1217      if (this.url == null)
1218        if (Configuration.errorOnAutoCreate())
1219          throw new Error("Attempt to auto-create StructureDefinition.url");
1220        else if (Configuration.doAutoCreate())
1221          this.url = new UriType(); // bb
1222      return this.url;
1223    }
1224
1225    public boolean hasUrlElement() { 
1226      return this.url != null && !this.url.isEmpty();
1227    }
1228
1229    public boolean hasUrl() { 
1230      return this.url != null && !this.url.isEmpty();
1231    }
1232
1233    /**
1234     * @param value {@link #url} (An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1235     */
1236    public StructureDefinition setUrlElement(UriType value) { 
1237      this.url = value;
1238      return this;
1239    }
1240
1241    /**
1242     * @return An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1243     */
1244    public String getUrl() { 
1245      return this.url == null ? null : this.url.getValue();
1246    }
1247
1248    /**
1249     * @param value An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1250     */
1251    public StructureDefinition setUrl(String value) { 
1252        if (this.url == null)
1253          this.url = new UriType();
1254        this.url.setValue(value);
1255      return this;
1256    }
1257
1258    /**
1259     * @return {@link #identifier} (Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).)
1260     */
1261    public List<Identifier> getIdentifier() { 
1262      if (this.identifier == null)
1263        this.identifier = new ArrayList<Identifier>();
1264      return this.identifier;
1265    }
1266
1267    public boolean hasIdentifier() { 
1268      if (this.identifier == null)
1269        return false;
1270      for (Identifier item : this.identifier)
1271        if (!item.isEmpty())
1272          return true;
1273      return false;
1274    }
1275
1276    /**
1277     * @return {@link #identifier} (Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).)
1278     */
1279    // syntactic sugar
1280    public Identifier addIdentifier() { //3
1281      Identifier t = new Identifier();
1282      if (this.identifier == null)
1283        this.identifier = new ArrayList<Identifier>();
1284      this.identifier.add(t);
1285      return t;
1286    }
1287
1288    // syntactic sugar
1289    public StructureDefinition addIdentifier(Identifier t) { //3
1290      if (t == null)
1291        return this;
1292      if (this.identifier == null)
1293        this.identifier = new ArrayList<Identifier>();
1294      this.identifier.add(t);
1295      return this;
1296    }
1297
1298    /**
1299     * @return {@link #version} (The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1300     */
1301    public StringType getVersionElement() { 
1302      if (this.version == null)
1303        if (Configuration.errorOnAutoCreate())
1304          throw new Error("Attempt to auto-create StructureDefinition.version");
1305        else if (Configuration.doAutoCreate())
1306          this.version = new StringType(); // bb
1307      return this.version;
1308    }
1309
1310    public boolean hasVersionElement() { 
1311      return this.version != null && !this.version.isEmpty();
1312    }
1313
1314    public boolean hasVersion() { 
1315      return this.version != null && !this.version.isEmpty();
1316    }
1317
1318    /**
1319     * @param value {@link #version} (The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1320     */
1321    public StructureDefinition setVersionElement(StringType value) { 
1322      this.version = value;
1323      return this;
1324    }
1325
1326    /**
1327     * @return The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1328     */
1329    public String getVersion() { 
1330      return this.version == null ? null : this.version.getValue();
1331    }
1332
1333    /**
1334     * @param value The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1335     */
1336    public StructureDefinition setVersion(String value) { 
1337      if (Utilities.noString(value))
1338        this.version = null;
1339      else {
1340        if (this.version == null)
1341          this.version = new StringType();
1342        this.version.setValue(value);
1343      }
1344      return this;
1345    }
1346
1347    /**
1348     * @return {@link #name} (A free text natural language name identifying the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1349     */
1350    public StringType getNameElement() { 
1351      if (this.name == null)
1352        if (Configuration.errorOnAutoCreate())
1353          throw new Error("Attempt to auto-create StructureDefinition.name");
1354        else if (Configuration.doAutoCreate())
1355          this.name = new StringType(); // bb
1356      return this.name;
1357    }
1358
1359    public boolean hasNameElement() { 
1360      return this.name != null && !this.name.isEmpty();
1361    }
1362
1363    public boolean hasName() { 
1364      return this.name != null && !this.name.isEmpty();
1365    }
1366
1367    /**
1368     * @param value {@link #name} (A free text natural language name identifying the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1369     */
1370    public StructureDefinition setNameElement(StringType value) { 
1371      this.name = value;
1372      return this;
1373    }
1374
1375    /**
1376     * @return A free text natural language name identifying the StructureDefinition.
1377     */
1378    public String getName() { 
1379      return this.name == null ? null : this.name.getValue();
1380    }
1381
1382    /**
1383     * @param value A free text natural language name identifying the StructureDefinition.
1384     */
1385    public StructureDefinition setName(String value) { 
1386        if (this.name == null)
1387          this.name = new StringType();
1388        this.name.setValue(value);
1389      return this;
1390    }
1391
1392    /**
1393     * @return {@link #display} (Defined so that applications can use this name when displaying the value of the extension to the user.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1394     */
1395    public StringType getDisplayElement() { 
1396      if (this.display == null)
1397        if (Configuration.errorOnAutoCreate())
1398          throw new Error("Attempt to auto-create StructureDefinition.display");
1399        else if (Configuration.doAutoCreate())
1400          this.display = new StringType(); // bb
1401      return this.display;
1402    }
1403
1404    public boolean hasDisplayElement() { 
1405      return this.display != null && !this.display.isEmpty();
1406    }
1407
1408    public boolean hasDisplay() { 
1409      return this.display != null && !this.display.isEmpty();
1410    }
1411
1412    /**
1413     * @param value {@link #display} (Defined so that applications can use this name when displaying the value of the extension to the user.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1414     */
1415    public StructureDefinition setDisplayElement(StringType value) { 
1416      this.display = value;
1417      return this;
1418    }
1419
1420    /**
1421     * @return Defined so that applications can use this name when displaying the value of the extension to the user.
1422     */
1423    public String getDisplay() { 
1424      return this.display == null ? null : this.display.getValue();
1425    }
1426
1427    /**
1428     * @param value Defined so that applications can use this name when displaying the value of the extension to the user.
1429     */
1430    public StructureDefinition setDisplay(String value) { 
1431      if (Utilities.noString(value))
1432        this.display = null;
1433      else {
1434        if (this.display == null)
1435          this.display = new StringType();
1436        this.display.setValue(value);
1437      }
1438      return this;
1439    }
1440
1441    /**
1442     * @return {@link #status} (The status of the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1443     */
1444    public Enumeration<ConformanceResourceStatus> getStatusElement() { 
1445      if (this.status == null)
1446        if (Configuration.errorOnAutoCreate())
1447          throw new Error("Attempt to auto-create StructureDefinition.status");
1448        else if (Configuration.doAutoCreate())
1449          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1450      return this.status;
1451    }
1452
1453    public boolean hasStatusElement() { 
1454      return this.status != null && !this.status.isEmpty();
1455    }
1456
1457    public boolean hasStatus() { 
1458      return this.status != null && !this.status.isEmpty();
1459    }
1460
1461    /**
1462     * @param value {@link #status} (The status of the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1463     */
1464    public StructureDefinition setStatusElement(Enumeration<ConformanceResourceStatus> value) { 
1465      this.status = value;
1466      return this;
1467    }
1468
1469    /**
1470     * @return The status of the StructureDefinition.
1471     */
1472    public ConformanceResourceStatus getStatus() { 
1473      return this.status == null ? null : this.status.getValue();
1474    }
1475
1476    /**
1477     * @param value The status of the StructureDefinition.
1478     */
1479    public StructureDefinition setStatus(ConformanceResourceStatus value) { 
1480        if (this.status == null)
1481          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1482        this.status.setValue(value);
1483      return this;
1484    }
1485
1486    /**
1487     * @return {@link #experimental} (This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1488     */
1489    public BooleanType getExperimentalElement() { 
1490      if (this.experimental == null)
1491        if (Configuration.errorOnAutoCreate())
1492          throw new Error("Attempt to auto-create StructureDefinition.experimental");
1493        else if (Configuration.doAutoCreate())
1494          this.experimental = new BooleanType(); // bb
1495      return this.experimental;
1496    }
1497
1498    public boolean hasExperimentalElement() { 
1499      return this.experimental != null && !this.experimental.isEmpty();
1500    }
1501
1502    public boolean hasExperimental() { 
1503      return this.experimental != null && !this.experimental.isEmpty();
1504    }
1505
1506    /**
1507     * @param value {@link #experimental} (This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1508     */
1509    public StructureDefinition setExperimentalElement(BooleanType value) { 
1510      this.experimental = value;
1511      return this;
1512    }
1513
1514    /**
1515     * @return This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1516     */
1517    public boolean getExperimental() { 
1518      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1519    }
1520
1521    /**
1522     * @param value This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1523     */
1524    public StructureDefinition setExperimental(boolean value) { 
1525        if (this.experimental == null)
1526          this.experimental = new BooleanType();
1527        this.experimental.setValue(value);
1528      return this;
1529    }
1530
1531    /**
1532     * @return {@link #publisher} (The name of the individual or organization that published the structure definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1533     */
1534    public StringType getPublisherElement() { 
1535      if (this.publisher == null)
1536        if (Configuration.errorOnAutoCreate())
1537          throw new Error("Attempt to auto-create StructureDefinition.publisher");
1538        else if (Configuration.doAutoCreate())
1539          this.publisher = new StringType(); // bb
1540      return this.publisher;
1541    }
1542
1543    public boolean hasPublisherElement() { 
1544      return this.publisher != null && !this.publisher.isEmpty();
1545    }
1546
1547    public boolean hasPublisher() { 
1548      return this.publisher != null && !this.publisher.isEmpty();
1549    }
1550
1551    /**
1552     * @param value {@link #publisher} (The name of the individual or organization that published the structure definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1553     */
1554    public StructureDefinition setPublisherElement(StringType value) { 
1555      this.publisher = value;
1556      return this;
1557    }
1558
1559    /**
1560     * @return The name of the individual or organization that published the structure definition.
1561     */
1562    public String getPublisher() { 
1563      return this.publisher == null ? null : this.publisher.getValue();
1564    }
1565
1566    /**
1567     * @param value The name of the individual or organization that published the structure definition.
1568     */
1569    public StructureDefinition setPublisher(String value) { 
1570      if (Utilities.noString(value))
1571        this.publisher = null;
1572      else {
1573        if (this.publisher == null)
1574          this.publisher = new StringType();
1575        this.publisher.setValue(value);
1576      }
1577      return this;
1578    }
1579
1580    /**
1581     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1582     */
1583    public List<StructureDefinitionContactComponent> getContact() { 
1584      if (this.contact == null)
1585        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1586      return this.contact;
1587    }
1588
1589    public boolean hasContact() { 
1590      if (this.contact == null)
1591        return false;
1592      for (StructureDefinitionContactComponent item : this.contact)
1593        if (!item.isEmpty())
1594          return true;
1595      return false;
1596    }
1597
1598    /**
1599     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1600     */
1601    // syntactic sugar
1602    public StructureDefinitionContactComponent addContact() { //3
1603      StructureDefinitionContactComponent t = new StructureDefinitionContactComponent();
1604      if (this.contact == null)
1605        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1606      this.contact.add(t);
1607      return t;
1608    }
1609
1610    // syntactic sugar
1611    public StructureDefinition addContact(StructureDefinitionContactComponent t) { //3
1612      if (t == null)
1613        return this;
1614      if (this.contact == null)
1615        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1616      this.contact.add(t);
1617      return this;
1618    }
1619
1620    /**
1621     * @return {@link #date} (The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1622     */
1623    public DateTimeType getDateElement() { 
1624      if (this.date == null)
1625        if (Configuration.errorOnAutoCreate())
1626          throw new Error("Attempt to auto-create StructureDefinition.date");
1627        else if (Configuration.doAutoCreate())
1628          this.date = new DateTimeType(); // bb
1629      return this.date;
1630    }
1631
1632    public boolean hasDateElement() { 
1633      return this.date != null && !this.date.isEmpty();
1634    }
1635
1636    public boolean hasDate() { 
1637      return this.date != null && !this.date.isEmpty();
1638    }
1639
1640    /**
1641     * @param value {@link #date} (The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1642     */
1643    public StructureDefinition setDateElement(DateTimeType value) { 
1644      this.date = value;
1645      return this;
1646    }
1647
1648    /**
1649     * @return The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1650     */
1651    public Date getDate() { 
1652      return this.date == null ? null : this.date.getValue();
1653    }
1654
1655    /**
1656     * @param value The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1657     */
1658    public StructureDefinition setDate(Date value) { 
1659      if (value == null)
1660        this.date = null;
1661      else {
1662        if (this.date == null)
1663          this.date = new DateTimeType();
1664        this.date.setValue(value);
1665      }
1666      return this;
1667    }
1668
1669    /**
1670     * @return {@link #description} (A free text natural language description of the StructureDefinition and its use.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1671     */
1672    public StringType getDescriptionElement() { 
1673      if (this.description == null)
1674        if (Configuration.errorOnAutoCreate())
1675          throw new Error("Attempt to auto-create StructureDefinition.description");
1676        else if (Configuration.doAutoCreate())
1677          this.description = new StringType(); // bb
1678      return this.description;
1679    }
1680
1681    public boolean hasDescriptionElement() { 
1682      return this.description != null && !this.description.isEmpty();
1683    }
1684
1685    public boolean hasDescription() { 
1686      return this.description != null && !this.description.isEmpty();
1687    }
1688
1689    /**
1690     * @param value {@link #description} (A free text natural language description of the StructureDefinition and its use.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1691     */
1692    public StructureDefinition setDescriptionElement(StringType value) { 
1693      this.description = value;
1694      return this;
1695    }
1696
1697    /**
1698     * @return A free text natural language description of the StructureDefinition and its use.
1699     */
1700    public String getDescription() { 
1701      return this.description == null ? null : this.description.getValue();
1702    }
1703
1704    /**
1705     * @param value A free text natural language description of the StructureDefinition and its use.
1706     */
1707    public StructureDefinition setDescription(String value) { 
1708      if (Utilities.noString(value))
1709        this.description = null;
1710      else {
1711        if (this.description == null)
1712          this.description = new StringType();
1713        this.description.setValue(value);
1714      }
1715      return this;
1716    }
1717
1718    /**
1719     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.)
1720     */
1721    public List<CodeableConcept> getUseContext() { 
1722      if (this.useContext == null)
1723        this.useContext = new ArrayList<CodeableConcept>();
1724      return this.useContext;
1725    }
1726
1727    public boolean hasUseContext() { 
1728      if (this.useContext == null)
1729        return false;
1730      for (CodeableConcept item : this.useContext)
1731        if (!item.isEmpty())
1732          return true;
1733      return false;
1734    }
1735
1736    /**
1737     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.)
1738     */
1739    // syntactic sugar
1740    public CodeableConcept addUseContext() { //3
1741      CodeableConcept t = new CodeableConcept();
1742      if (this.useContext == null)
1743        this.useContext = new ArrayList<CodeableConcept>();
1744      this.useContext.add(t);
1745      return t;
1746    }
1747
1748    // syntactic sugar
1749    public StructureDefinition addUseContext(CodeableConcept t) { //3
1750      if (t == null)
1751        return this;
1752      if (this.useContext == null)
1753        this.useContext = new ArrayList<CodeableConcept>();
1754      this.useContext.add(t);
1755      return this;
1756    }
1757
1758    /**
1759     * @return {@link #requirements} (Explains why this structure definition is needed and why it's been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1760     */
1761    public StringType getRequirementsElement() { 
1762      if (this.requirements == null)
1763        if (Configuration.errorOnAutoCreate())
1764          throw new Error("Attempt to auto-create StructureDefinition.requirements");
1765        else if (Configuration.doAutoCreate())
1766          this.requirements = new StringType(); // bb
1767      return this.requirements;
1768    }
1769
1770    public boolean hasRequirementsElement() { 
1771      return this.requirements != null && !this.requirements.isEmpty();
1772    }
1773
1774    public boolean hasRequirements() { 
1775      return this.requirements != null && !this.requirements.isEmpty();
1776    }
1777
1778    /**
1779     * @param value {@link #requirements} (Explains why this structure definition is needed and why it's been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1780     */
1781    public StructureDefinition setRequirementsElement(StringType value) { 
1782      this.requirements = value;
1783      return this;
1784    }
1785
1786    /**
1787     * @return Explains why this structure definition is needed and why it's been constrained as it has.
1788     */
1789    public String getRequirements() { 
1790      return this.requirements == null ? null : this.requirements.getValue();
1791    }
1792
1793    /**
1794     * @param value Explains why this structure definition is needed and why it's been constrained as it has.
1795     */
1796    public StructureDefinition setRequirements(String value) { 
1797      if (Utilities.noString(value))
1798        this.requirements = null;
1799      else {
1800        if (this.requirements == null)
1801          this.requirements = new StringType();
1802        this.requirements.setValue(value);
1803      }
1804      return this;
1805    }
1806
1807    /**
1808     * @return {@link #copyright} (A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1809     */
1810    public StringType getCopyrightElement() { 
1811      if (this.copyright == null)
1812        if (Configuration.errorOnAutoCreate())
1813          throw new Error("Attempt to auto-create StructureDefinition.copyright");
1814        else if (Configuration.doAutoCreate())
1815          this.copyright = new StringType(); // bb
1816      return this.copyright;
1817    }
1818
1819    public boolean hasCopyrightElement() { 
1820      return this.copyright != null && !this.copyright.isEmpty();
1821    }
1822
1823    public boolean hasCopyright() { 
1824      return this.copyright != null && !this.copyright.isEmpty();
1825    }
1826
1827    /**
1828     * @param value {@link #copyright} (A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1829     */
1830    public StructureDefinition setCopyrightElement(StringType value) { 
1831      this.copyright = value;
1832      return this;
1833    }
1834
1835    /**
1836     * @return A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1837     */
1838    public String getCopyright() { 
1839      return this.copyright == null ? null : this.copyright.getValue();
1840    }
1841
1842    /**
1843     * @param value A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1844     */
1845    public StructureDefinition setCopyright(String value) { 
1846      if (Utilities.noString(value))
1847        this.copyright = null;
1848      else {
1849        if (this.copyright == null)
1850          this.copyright = new StringType();
1851        this.copyright.setValue(value);
1852      }
1853      return this;
1854    }
1855
1856    /**
1857     * @return {@link #code} (A set of terms from external terminologies that may be used to assist with indexing and searching of templates.)
1858     */
1859    public List<Coding> getCode() { 
1860      if (this.code == null)
1861        this.code = new ArrayList<Coding>();
1862      return this.code;
1863    }
1864
1865    public boolean hasCode() { 
1866      if (this.code == null)
1867        return false;
1868      for (Coding item : this.code)
1869        if (!item.isEmpty())
1870          return true;
1871      return false;
1872    }
1873
1874    /**
1875     * @return {@link #code} (A set of terms from external terminologies that may be used to assist with indexing and searching of templates.)
1876     */
1877    // syntactic sugar
1878    public Coding addCode() { //3
1879      Coding t = new Coding();
1880      if (this.code == null)
1881        this.code = new ArrayList<Coding>();
1882      this.code.add(t);
1883      return t;
1884    }
1885
1886    // syntactic sugar
1887    public StructureDefinition addCode(Coding t) { //3
1888      if (t == null)
1889        return this;
1890      if (this.code == null)
1891        this.code = new ArrayList<Coding>();
1892      this.code.add(t);
1893      return this;
1894    }
1895
1896    /**
1897     * @return {@link #fhirVersion} (The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.). This is the underlying object with id, value and extensions. The accessor "getFhirVersion" gives direct access to the value
1898     */
1899    public IdType getFhirVersionElement() { 
1900      if (this.fhirVersion == null)
1901        if (Configuration.errorOnAutoCreate())
1902          throw new Error("Attempt to auto-create StructureDefinition.fhirVersion");
1903        else if (Configuration.doAutoCreate())
1904          this.fhirVersion = new IdType(); // bb
1905      return this.fhirVersion;
1906    }
1907
1908    public boolean hasFhirVersionElement() { 
1909      return this.fhirVersion != null && !this.fhirVersion.isEmpty();
1910    }
1911
1912    public boolean hasFhirVersion() { 
1913      return this.fhirVersion != null && !this.fhirVersion.isEmpty();
1914    }
1915
1916    /**
1917     * @param value {@link #fhirVersion} (The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.). This is the underlying object with id, value and extensions. The accessor "getFhirVersion" gives direct access to the value
1918     */
1919    public StructureDefinition setFhirVersionElement(IdType value) { 
1920      this.fhirVersion = value;
1921      return this;
1922    }
1923
1924    /**
1925     * @return The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1926     */
1927    public String getFhirVersion() { 
1928      return this.fhirVersion == null ? null : this.fhirVersion.getValue();
1929    }
1930
1931    /**
1932     * @param value The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1933     */
1934    public StructureDefinition setFhirVersion(String value) { 
1935      if (Utilities.noString(value))
1936        this.fhirVersion = null;
1937      else {
1938        if (this.fhirVersion == null)
1939          this.fhirVersion = new IdType();
1940        this.fhirVersion.setValue(value);
1941      }
1942      return this;
1943    }
1944
1945    /**
1946     * @return {@link #mapping} (An external specification that the content is mapped to.)
1947     */
1948    public List<StructureDefinitionMappingComponent> getMapping() { 
1949      if (this.mapping == null)
1950        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1951      return this.mapping;
1952    }
1953
1954    public boolean hasMapping() { 
1955      if (this.mapping == null)
1956        return false;
1957      for (StructureDefinitionMappingComponent item : this.mapping)
1958        if (!item.isEmpty())
1959          return true;
1960      return false;
1961    }
1962
1963    /**
1964     * @return {@link #mapping} (An external specification that the content is mapped to.)
1965     */
1966    // syntactic sugar
1967    public StructureDefinitionMappingComponent addMapping() { //3
1968      StructureDefinitionMappingComponent t = new StructureDefinitionMappingComponent();
1969      if (this.mapping == null)
1970        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1971      this.mapping.add(t);
1972      return t;
1973    }
1974
1975    // syntactic sugar
1976    public StructureDefinition addMapping(StructureDefinitionMappingComponent t) { //3
1977      if (t == null)
1978        return this;
1979      if (this.mapping == null)
1980        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1981      this.mapping.add(t);
1982      return this;
1983    }
1984
1985    /**
1986     * @return {@link #kind} (Defines the kind of structure that this definition is describing.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
1987     */
1988    public Enumeration<StructureDefinitionKind> getKindElement() { 
1989      if (this.kind == null)
1990        if (Configuration.errorOnAutoCreate())
1991          throw new Error("Attempt to auto-create StructureDefinition.kind");
1992        else if (Configuration.doAutoCreate())
1993          this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory()); // bb
1994      return this.kind;
1995    }
1996
1997    public boolean hasKindElement() { 
1998      return this.kind != null && !this.kind.isEmpty();
1999    }
2000
2001    public boolean hasKind() { 
2002      return this.kind != null && !this.kind.isEmpty();
2003    }
2004
2005    /**
2006     * @param value {@link #kind} (Defines the kind of structure that this definition is describing.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
2007     */
2008    public StructureDefinition setKindElement(Enumeration<StructureDefinitionKind> value) { 
2009      this.kind = value;
2010      return this;
2011    }
2012
2013    /**
2014     * @return Defines the kind of structure that this definition is describing.
2015     */
2016    public StructureDefinitionKind getKind() { 
2017      return this.kind == null ? null : this.kind.getValue();
2018    }
2019
2020    /**
2021     * @param value Defines the kind of structure that this definition is describing.
2022     */
2023    public StructureDefinition setKind(StructureDefinitionKind value) { 
2024        if (this.kind == null)
2025          this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory());
2026        this.kind.setValue(value);
2027      return this;
2028    }
2029
2030    /**
2031     * @return {@link #constrainedType} (The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.). This is the underlying object with id, value and extensions. The accessor "getConstrainedType" gives direct access to the value
2032     */
2033    public CodeType getConstrainedTypeElement() { 
2034      if (this.constrainedType == null)
2035        if (Configuration.errorOnAutoCreate())
2036          throw new Error("Attempt to auto-create StructureDefinition.constrainedType");
2037        else if (Configuration.doAutoCreate())
2038          this.constrainedType = new CodeType(); // bb
2039      return this.constrainedType;
2040    }
2041
2042    public boolean hasConstrainedTypeElement() { 
2043      return this.constrainedType != null && !this.constrainedType.isEmpty();
2044    }
2045
2046    public boolean hasConstrainedType() { 
2047      return this.constrainedType != null && !this.constrainedType.isEmpty();
2048    }
2049
2050    /**
2051     * @param value {@link #constrainedType} (The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.). This is the underlying object with id, value and extensions. The accessor "getConstrainedType" gives direct access to the value
2052     */
2053    public StructureDefinition setConstrainedTypeElement(CodeType value) { 
2054      this.constrainedType = value;
2055      return this;
2056    }
2057
2058    /**
2059     * @return The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
2060     */
2061    public String getConstrainedType() { 
2062      return this.constrainedType == null ? null : this.constrainedType.getValue();
2063    }
2064
2065    /**
2066     * @param value The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
2067     */
2068    public StructureDefinition setConstrainedType(String value) { 
2069      if (Utilities.noString(value))
2070        this.constrainedType = null;
2071      else {
2072        if (this.constrainedType == null)
2073          this.constrainedType = new CodeType();
2074        this.constrainedType.setValue(value);
2075      }
2076      return this;
2077    }
2078
2079    /**
2080     * @return {@link #abstract_} (Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
2081     */
2082    public BooleanType getAbstractElement() { 
2083      if (this.abstract_ == null)
2084        if (Configuration.errorOnAutoCreate())
2085          throw new Error("Attempt to auto-create StructureDefinition.abstract_");
2086        else if (Configuration.doAutoCreate())
2087          this.abstract_ = new BooleanType(); // bb
2088      return this.abstract_;
2089    }
2090
2091    public boolean hasAbstractElement() { 
2092      return this.abstract_ != null && !this.abstract_.isEmpty();
2093    }
2094
2095    public boolean hasAbstract() { 
2096      return this.abstract_ != null && !this.abstract_.isEmpty();
2097    }
2098
2099    /**
2100     * @param value {@link #abstract_} (Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
2101     */
2102    public StructureDefinition setAbstractElement(BooleanType value) { 
2103      this.abstract_ = value;
2104      return this;
2105    }
2106
2107    /**
2108     * @return Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
2109     */
2110    public boolean getAbstract() { 
2111      return this.abstract_ == null || this.abstract_.isEmpty() ? false : this.abstract_.getValue();
2112    }
2113
2114    /**
2115     * @param value Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
2116     */
2117    public StructureDefinition setAbstract(boolean value) { 
2118        if (this.abstract_ == null)
2119          this.abstract_ = new BooleanType();
2120        this.abstract_.setValue(value);
2121      return this;
2122    }
2123
2124    /**
2125     * @return {@link #contextType} (If this is an extension, Identifies the context within FHIR resources where the extension can be used.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
2126     */
2127    public Enumeration<ExtensionContext> getContextTypeElement() { 
2128      if (this.contextType == null)
2129        if (Configuration.errorOnAutoCreate())
2130          throw new Error("Attempt to auto-create StructureDefinition.contextType");
2131        else if (Configuration.doAutoCreate())
2132          this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory()); // bb
2133      return this.contextType;
2134    }
2135
2136    public boolean hasContextTypeElement() { 
2137      return this.contextType != null && !this.contextType.isEmpty();
2138    }
2139
2140    public boolean hasContextType() { 
2141      return this.contextType != null && !this.contextType.isEmpty();
2142    }
2143
2144    /**
2145     * @param value {@link #contextType} (If this is an extension, Identifies the context within FHIR resources where the extension can be used.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
2146     */
2147    public StructureDefinition setContextTypeElement(Enumeration<ExtensionContext> value) { 
2148      this.contextType = value;
2149      return this;
2150    }
2151
2152    /**
2153     * @return If this is an extension, Identifies the context within FHIR resources where the extension can be used.
2154     */
2155    public ExtensionContext getContextType() { 
2156      return this.contextType == null ? null : this.contextType.getValue();
2157    }
2158
2159    /**
2160     * @param value If this is an extension, Identifies the context within FHIR resources where the extension can be used.
2161     */
2162    public StructureDefinition setContextType(ExtensionContext value) { 
2163      if (value == null)
2164        this.contextType = null;
2165      else {
2166        if (this.contextType == null)
2167          this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory());
2168        this.contextType.setValue(value);
2169      }
2170      return this;
2171    }
2172
2173    /**
2174     * @return {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2175     */
2176    public List<StringType> getContext() { 
2177      if (this.context == null)
2178        this.context = new ArrayList<StringType>();
2179      return this.context;
2180    }
2181
2182    public boolean hasContext() { 
2183      if (this.context == null)
2184        return false;
2185      for (StringType item : this.context)
2186        if (!item.isEmpty())
2187          return true;
2188      return false;
2189    }
2190
2191    /**
2192     * @return {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2193     */
2194    // syntactic sugar
2195    public StringType addContextElement() {//2 
2196      StringType t = new StringType();
2197      if (this.context == null)
2198        this.context = new ArrayList<StringType>();
2199      this.context.add(t);
2200      return t;
2201    }
2202
2203    /**
2204     * @param value {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2205     */
2206    public StructureDefinition addContext(String value) { //1
2207      StringType t = new StringType();
2208      t.setValue(value);
2209      if (this.context == null)
2210        this.context = new ArrayList<StringType>();
2211      this.context.add(t);
2212      return this;
2213    }
2214
2215    /**
2216     * @param value {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2217     */
2218    public boolean hasContext(String value) { 
2219      if (this.context == null)
2220        return false;
2221      for (StringType v : this.context)
2222        if (v.equals(value)) // string
2223          return true;
2224      return false;
2225    }
2226
2227    /**
2228     * @return {@link #base} (An absolute URI that is the base structure from which this set of constraints is derived.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
2229     */
2230    public UriType getBaseElement() { 
2231      if (this.base == null)
2232        if (Configuration.errorOnAutoCreate())
2233          throw new Error("Attempt to auto-create StructureDefinition.base");
2234        else if (Configuration.doAutoCreate())
2235          this.base = new UriType(); // bb
2236      return this.base;
2237    }
2238
2239    public boolean hasBaseElement() { 
2240      return this.base != null && !this.base.isEmpty();
2241    }
2242
2243    public boolean hasBase() { 
2244      return this.base != null && !this.base.isEmpty();
2245    }
2246
2247    /**
2248     * @param value {@link #base} (An absolute URI that is the base structure from which this set of constraints is derived.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
2249     */
2250    public StructureDefinition setBaseElement(UriType value) { 
2251      this.base = value;
2252      return this;
2253    }
2254
2255    /**
2256     * @return An absolute URI that is the base structure from which this set of constraints is derived.
2257     */
2258    public String getBase() { 
2259      return this.base == null ? null : this.base.getValue();
2260    }
2261
2262    /**
2263     * @param value An absolute URI that is the base structure from which this set of constraints is derived.
2264     */
2265    public StructureDefinition setBase(String value) { 
2266      if (Utilities.noString(value))
2267        this.base = null;
2268      else {
2269        if (this.base == null)
2270          this.base = new UriType();
2271        this.base.setValue(value);
2272      }
2273      return this;
2274    }
2275
2276    /**
2277     * @return {@link #snapshot} (A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.)
2278     */
2279    public StructureDefinitionSnapshotComponent getSnapshot() { 
2280      if (this.snapshot == null)
2281        if (Configuration.errorOnAutoCreate())
2282          throw new Error("Attempt to auto-create StructureDefinition.snapshot");
2283        else if (Configuration.doAutoCreate())
2284          this.snapshot = new StructureDefinitionSnapshotComponent(); // cc
2285      return this.snapshot;
2286    }
2287
2288    public boolean hasSnapshot() { 
2289      return this.snapshot != null && !this.snapshot.isEmpty();
2290    }
2291
2292    /**
2293     * @param value {@link #snapshot} (A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.)
2294     */
2295    public StructureDefinition setSnapshot(StructureDefinitionSnapshotComponent value) { 
2296      this.snapshot = value;
2297      return this;
2298    }
2299
2300    /**
2301     * @return {@link #differential} (A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.)
2302     */
2303    public StructureDefinitionDifferentialComponent getDifferential() { 
2304      if (this.differential == null)
2305        if (Configuration.errorOnAutoCreate())
2306          throw new Error("Attempt to auto-create StructureDefinition.differential");
2307        else if (Configuration.doAutoCreate())
2308          this.differential = new StructureDefinitionDifferentialComponent(); // cc
2309      return this.differential;
2310    }
2311
2312    public boolean hasDifferential() { 
2313      return this.differential != null && !this.differential.isEmpty();
2314    }
2315
2316    /**
2317     * @param value {@link #differential} (A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.)
2318     */
2319    public StructureDefinition setDifferential(StructureDefinitionDifferentialComponent value) { 
2320      this.differential = value;
2321      return this;
2322    }
2323
2324      protected void listChildren(List<Property> childrenList) {
2325        super.listChildren(childrenList);
2326        childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
2327        childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).", 0, java.lang.Integer.MAX_VALUE, identifier));
2328        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.", 0, java.lang.Integer.MAX_VALUE, version));
2329        childrenList.add(new Property("name", "string", "A free text natural language name identifying the StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, name));
2330        childrenList.add(new Property("display", "string", "Defined so that applications can use this name when displaying the value of the extension to the user.", 0, java.lang.Integer.MAX_VALUE, display));
2331        childrenList.add(new Property("status", "code", "The status of the StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, status));
2332        childrenList.add(new Property("experimental", "boolean", "This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
2333        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the structure definition.", 0, java.lang.Integer.MAX_VALUE, publisher));
2334        childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
2335        childrenList.add(new Property("date", "dateTime", "The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.", 0, java.lang.Integer.MAX_VALUE, date));
2336        childrenList.add(new Property("description", "string", "A free text natural language description of the StructureDefinition and its use.", 0, java.lang.Integer.MAX_VALUE, description));
2337        childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
2338        childrenList.add(new Property("requirements", "string", "Explains why this structure definition is needed and why it's been constrained as it has.", 0, java.lang.Integer.MAX_VALUE, requirements));
2339        childrenList.add(new Property("copyright", "string", "A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.", 0, java.lang.Integer.MAX_VALUE, copyright));
2340        childrenList.add(new Property("code", "Coding", "A set of terms from external terminologies that may be used to assist with indexing and searching of templates.", 0, java.lang.Integer.MAX_VALUE, code));
2341        childrenList.add(new Property("fhirVersion", "id", "The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.", 0, java.lang.Integer.MAX_VALUE, fhirVersion));
2342        childrenList.add(new Property("mapping", "", "An external specification that the content is mapped to.", 0, java.lang.Integer.MAX_VALUE, mapping));
2343        childrenList.add(new Property("kind", "code", "Defines the kind of structure that this definition is describing.", 0, java.lang.Integer.MAX_VALUE, kind));
2344        childrenList.add(new Property("constrainedType", "code", "The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.", 0, java.lang.Integer.MAX_VALUE, constrainedType));
2345        childrenList.add(new Property("abstract", "boolean", "Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.", 0, java.lang.Integer.MAX_VALUE, abstract_));
2346        childrenList.add(new Property("contextType", "code", "If this is an extension, Identifies the context within FHIR resources where the extension can be used.", 0, java.lang.Integer.MAX_VALUE, contextType));
2347        childrenList.add(new Property("context", "string", "Identifies the types of resource or data type elements to which the extension can be applied.", 0, java.lang.Integer.MAX_VALUE, context));
2348        childrenList.add(new Property("base", "uri", "An absolute URI that is the base structure from which this set of constraints is derived.", 0, java.lang.Integer.MAX_VALUE, base));
2349        childrenList.add(new Property("snapshot", "", "A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, snapshot));
2350        childrenList.add(new Property("differential", "", "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.", 0, java.lang.Integer.MAX_VALUE, differential));
2351      }
2352
2353      @Override
2354      public void setProperty(String name, Base value) throws FHIRException {
2355        if (name.equals("url"))
2356          this.url = castToUri(value); // UriType
2357        else if (name.equals("identifier"))
2358          this.getIdentifier().add(castToIdentifier(value));
2359        else if (name.equals("version"))
2360          this.version = castToString(value); // StringType
2361        else if (name.equals("name"))
2362          this.name = castToString(value); // StringType
2363        else if (name.equals("display"))
2364          this.display = castToString(value); // StringType
2365        else if (name.equals("status"))
2366          this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
2367        else if (name.equals("experimental"))
2368          this.experimental = castToBoolean(value); // BooleanType
2369        else if (name.equals("publisher"))
2370          this.publisher = castToString(value); // StringType
2371        else if (name.equals("contact"))
2372          this.getContact().add((StructureDefinitionContactComponent) value);
2373        else if (name.equals("date"))
2374          this.date = castToDateTime(value); // DateTimeType
2375        else if (name.equals("description"))
2376          this.description = castToString(value); // StringType
2377        else if (name.equals("useContext"))
2378          this.getUseContext().add(castToCodeableConcept(value));
2379        else if (name.equals("requirements"))
2380          this.requirements = castToString(value); // StringType
2381        else if (name.equals("copyright"))
2382          this.copyright = castToString(value); // StringType
2383        else if (name.equals("code"))
2384          this.getCode().add(castToCoding(value));
2385        else if (name.equals("fhirVersion"))
2386          this.fhirVersion = castToId(value); // IdType
2387        else if (name.equals("mapping"))
2388          this.getMapping().add((StructureDefinitionMappingComponent) value);
2389        else if (name.equals("kind"))
2390          this.kind = new StructureDefinitionKindEnumFactory().fromType(value); // Enumeration<StructureDefinitionKind>
2391        else if (name.equals("constrainedType"))
2392          this.constrainedType = castToCode(value); // CodeType
2393        else if (name.equals("abstract"))
2394          this.abstract_ = castToBoolean(value); // BooleanType
2395        else if (name.equals("contextType"))
2396          this.contextType = new ExtensionContextEnumFactory().fromType(value); // Enumeration<ExtensionContext>
2397        else if (name.equals("context"))
2398          this.getContext().add(castToString(value));
2399        else if (name.equals("base"))
2400          this.base = castToUri(value); // UriType
2401        else if (name.equals("snapshot"))
2402          this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
2403        else if (name.equals("differential"))
2404          this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
2405        else
2406          super.setProperty(name, value);
2407      }
2408
2409      @Override
2410      public Base addChild(String name) throws FHIRException {
2411        if (name.equals("url")) {
2412          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.url");
2413        }
2414        else if (name.equals("identifier")) {
2415          return addIdentifier();
2416        }
2417        else if (name.equals("version")) {
2418          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.version");
2419        }
2420        else if (name.equals("name")) {
2421          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
2422        }
2423        else if (name.equals("display")) {
2424          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.display");
2425        }
2426        else if (name.equals("status")) {
2427          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.status");
2428        }
2429        else if (name.equals("experimental")) {
2430          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.experimental");
2431        }
2432        else if (name.equals("publisher")) {
2433          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.publisher");
2434        }
2435        else if (name.equals("contact")) {
2436          return addContact();
2437        }
2438        else if (name.equals("date")) {
2439          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.date");
2440        }
2441        else if (name.equals("description")) {
2442          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.description");
2443        }
2444        else if (name.equals("useContext")) {
2445          return addUseContext();
2446        }
2447        else if (name.equals("requirements")) {
2448          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.requirements");
2449        }
2450        else if (name.equals("copyright")) {
2451          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.copyright");
2452        }
2453        else if (name.equals("code")) {
2454          return addCode();
2455        }
2456        else if (name.equals("fhirVersion")) {
2457          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.fhirVersion");
2458        }
2459        else if (name.equals("mapping")) {
2460          return addMapping();
2461        }
2462        else if (name.equals("kind")) {
2463          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.kind");
2464        }
2465        else if (name.equals("constrainedType")) {
2466          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.constrainedType");
2467        }
2468        else if (name.equals("abstract")) {
2469          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.abstract");
2470        }
2471        else if (name.equals("contextType")) {
2472          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.contextType");
2473        }
2474        else if (name.equals("context")) {
2475          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.context");
2476        }
2477        else if (name.equals("base")) {
2478          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.base");
2479        }
2480        else if (name.equals("snapshot")) {
2481          this.snapshot = new StructureDefinitionSnapshotComponent();
2482          return this.snapshot;
2483        }
2484        else if (name.equals("differential")) {
2485          this.differential = new StructureDefinitionDifferentialComponent();
2486          return this.differential;
2487        }
2488        else
2489          return super.addChild(name);
2490      }
2491
2492  public String fhirType() {
2493    return "StructureDefinition";
2494
2495  }
2496
2497      public StructureDefinition copy() {
2498        StructureDefinition dst = new StructureDefinition();
2499        copyValues(dst);
2500        dst.url = url == null ? null : url.copy();
2501        if (identifier != null) {
2502          dst.identifier = new ArrayList<Identifier>();
2503          for (Identifier i : identifier)
2504            dst.identifier.add(i.copy());
2505        };
2506        dst.version = version == null ? null : version.copy();
2507        dst.name = name == null ? null : name.copy();
2508        dst.display = display == null ? null : display.copy();
2509        dst.status = status == null ? null : status.copy();
2510        dst.experimental = experimental == null ? null : experimental.copy();
2511        dst.publisher = publisher == null ? null : publisher.copy();
2512        if (contact != null) {
2513          dst.contact = new ArrayList<StructureDefinitionContactComponent>();
2514          for (StructureDefinitionContactComponent i : contact)
2515            dst.contact.add(i.copy());
2516        };
2517        dst.date = date == null ? null : date.copy();
2518        dst.description = description == null ? null : description.copy();
2519        if (useContext != null) {
2520          dst.useContext = new ArrayList<CodeableConcept>();
2521          for (CodeableConcept i : useContext)
2522            dst.useContext.add(i.copy());
2523        };
2524        dst.requirements = requirements == null ? null : requirements.copy();
2525        dst.copyright = copyright == null ? null : copyright.copy();
2526        if (code != null) {
2527          dst.code = new ArrayList<Coding>();
2528          for (Coding i : code)
2529            dst.code.add(i.copy());
2530        };
2531        dst.fhirVersion = fhirVersion == null ? null : fhirVersion.copy();
2532        if (mapping != null) {
2533          dst.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2534          for (StructureDefinitionMappingComponent i : mapping)
2535            dst.mapping.add(i.copy());
2536        };
2537        dst.kind = kind == null ? null : kind.copy();
2538        dst.constrainedType = constrainedType == null ? null : constrainedType.copy();
2539        dst.abstract_ = abstract_ == null ? null : abstract_.copy();
2540        dst.contextType = contextType == null ? null : contextType.copy();
2541        if (context != null) {
2542          dst.context = new ArrayList<StringType>();
2543          for (StringType i : context)
2544            dst.context.add(i.copy());
2545        };
2546        dst.base = base == null ? null : base.copy();
2547        dst.snapshot = snapshot == null ? null : snapshot.copy();
2548        dst.differential = differential == null ? null : differential.copy();
2549        return dst;
2550      }
2551
2552      protected StructureDefinition typedCopy() {
2553        return copy();
2554      }
2555
2556      @Override
2557      public boolean equalsDeep(Base other) {
2558        if (!super.equalsDeep(other))
2559          return false;
2560        if (!(other instanceof StructureDefinition))
2561          return false;
2562        StructureDefinition o = (StructureDefinition) other;
2563        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
2564           && compareDeep(name, o.name, true) && compareDeep(display, o.display, true) && compareDeep(status, o.status, true)
2565           && compareDeep(experimental, o.experimental, true) && compareDeep(publisher, o.publisher, true)
2566           && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true) && compareDeep(description, o.description, true)
2567           && compareDeep(useContext, o.useContext, true) && compareDeep(requirements, o.requirements, true)
2568           && compareDeep(copyright, o.copyright, true) && compareDeep(code, o.code, true) && compareDeep(fhirVersion, o.fhirVersion, true)
2569           && compareDeep(mapping, o.mapping, true) && compareDeep(kind, o.kind, true) && compareDeep(constrainedType, o.constrainedType, true)
2570           && compareDeep(abstract_, o.abstract_, true) && compareDeep(contextType, o.contextType, true) && compareDeep(context, o.context, true)
2571           && compareDeep(base, o.base, true) && compareDeep(snapshot, o.snapshot, true) && compareDeep(differential, o.differential, true)
2572          ;
2573      }
2574
2575      @Override
2576      public boolean equalsShallow(Base other) {
2577        if (!super.equalsShallow(other))
2578          return false;
2579        if (!(other instanceof StructureDefinition))
2580          return false;
2581        StructureDefinition o = (StructureDefinition) other;
2582        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
2583           && compareValues(display, o.display, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
2584           && compareValues(publisher, o.publisher, true) && compareValues(date, o.date, true) && compareValues(description, o.description, true)
2585           && compareValues(requirements, o.requirements, true) && compareValues(copyright, o.copyright, true)
2586           && compareValues(fhirVersion, o.fhirVersion, true) && compareValues(kind, o.kind, true) && compareValues(constrainedType, o.constrainedType, true)
2587           && compareValues(abstract_, o.abstract_, true) && compareValues(contextType, o.contextType, true) && compareValues(context, o.context, true)
2588           && compareValues(base, o.base, true);
2589      }
2590
2591      public boolean isEmpty() {
2592        return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
2593           && (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (display == null || display.isEmpty())
2594           && (status == null || status.isEmpty()) && (experimental == null || experimental.isEmpty())
2595           && (publisher == null || publisher.isEmpty()) && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty())
2596           && (description == null || description.isEmpty()) && (useContext == null || useContext.isEmpty())
2597           && (requirements == null || requirements.isEmpty()) && (copyright == null || copyright.isEmpty())
2598           && (code == null || code.isEmpty()) && (fhirVersion == null || fhirVersion.isEmpty()) && (mapping == null || mapping.isEmpty())
2599           && (kind == null || kind.isEmpty()) && (constrainedType == null || constrainedType.isEmpty())
2600           && (abstract_ == null || abstract_.isEmpty()) && (contextType == null || contextType.isEmpty())
2601           && (context == null || context.isEmpty()) && (base == null || base.isEmpty()) && (snapshot == null || snapshot.isEmpty())
2602           && (differential == null || differential.isEmpty());
2603      }
2604
2605  @Override
2606  public ResourceType getResourceType() {
2607    return ResourceType.StructureDefinition;
2608   }
2609
2610  @SearchParamDefinition(name="date", path="StructureDefinition.date", description="The profile publication date", type="date" )
2611  public static final String SP_DATE = "date";
2612  @SearchParamDefinition(name="identifier", path="StructureDefinition.identifier", description="The identifier of the profile", type="token" )
2613  public static final String SP_IDENTIFIER = "identifier";
2614  @SearchParamDefinition(name="code", path="StructureDefinition.code", description="A code for the profile", type="token" )
2615  public static final String SP_CODE = "code";
2616  @SearchParamDefinition(name="valueset", path="StructureDefinition.snapshot.element.binding.valueSet[x]", description="A vocabulary binding reference", type="reference" )
2617  public static final String SP_VALUESET = "valueset";
2618  @SearchParamDefinition(name="kind", path="StructureDefinition.kind", description="datatype | resource | logical", type="token" )
2619  public static final String SP_KIND = "kind";
2620  @SearchParamDefinition(name="display", path="StructureDefinition.display", description="Use this name when displaying the value", type="string" )
2621  public static final String SP_DISPLAY = "display";
2622  @SearchParamDefinition(name="description", path="StructureDefinition.description", description="Text search in the description of the profile", type="string" )
2623  public static final String SP_DESCRIPTION = "description";
2624  @SearchParamDefinition(name="experimental", path="StructureDefinition.experimental", description="If for testing purposes, not real usage", type="token" )
2625  public static final String SP_EXPERIMENTAL = "experimental";
2626  @SearchParamDefinition(name="context-type", path="StructureDefinition.contextType", description="resource | datatype | mapping | extension", type="token" )
2627  public static final String SP_CONTEXTTYPE = "context-type";
2628  @SearchParamDefinition(name="abstract", path="StructureDefinition.abstract", description="Whether the structure is abstract", type="token" )
2629  public static final String SP_ABSTRACT = "abstract";
2630  @SearchParamDefinition(name="type", path="StructureDefinition.constrainedType", description="Any datatype or resource, including abstract ones", type="token" )
2631  public static final String SP_TYPE = "type";
2632  @SearchParamDefinition(name="version", path="StructureDefinition.version", description="The version identifier of the profile", type="token" )
2633  public static final String SP_VERSION = "version";
2634  @SearchParamDefinition(name="url", path="StructureDefinition.url", description="Absolute URL used to reference this StructureDefinition", type="uri" )
2635  public static final String SP_URL = "url";
2636  @SearchParamDefinition(name="path", path="StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path", description="A path that is constrained in the profile", type="token" )
2637  public static final String SP_PATH = "path";
2638  @SearchParamDefinition(name="ext-context", path="StructureDefinition.context", description="Where the extension can be used in instances", type="string" )
2639  public static final String SP_EXTCONTEXT = "ext-context";
2640  @SearchParamDefinition(name="name", path="StructureDefinition.name", description="Name of the profile", type="string" )
2641  public static final String SP_NAME = "name";
2642  @SearchParamDefinition(name="context", path="StructureDefinition.useContext", description="A use context assigned to the structure", type="token" )
2643  public static final String SP_CONTEXT = "context";
2644  @SearchParamDefinition(name="base-path", path="StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path", description="Path that identifies the base element", type="token" )
2645  public static final String SP_BASEPATH = "base-path";
2646  @SearchParamDefinition(name="publisher", path="StructureDefinition.publisher", description="Name of the publisher of the profile", type="string" )
2647  public static final String SP_PUBLISHER = "publisher";
2648  @SearchParamDefinition(name="status", path="StructureDefinition.status", description="The current status of the profile", type="token" )
2649  public static final String SP_STATUS = "status";
2650  @SearchParamDefinition(name="base", path="StructureDefinition.base", description="Structure that this set of constraints applies to", type="uri" )
2651  public static final String SP_BASE = "base";
2652
2653}
2654