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