001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.r4.model.Enumerations.FHIRVersion;
040import org.hl7.fhir.r4.model.Enumerations.FHIRVersionEnumFactory;
041import org.hl7.fhir.r4.model.Enumerations.PublicationStatus;
042import org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory;
043import org.hl7.fhir.utilities.Utilities;
044
045import ca.uhn.fhir.model.api.annotation.Block;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.ChildOrder;
048import ca.uhn.fhir.model.api.annotation.Description;
049import ca.uhn.fhir.model.api.annotation.ResourceDef;
050import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
051
052/**
053 * A definition of a FHIR structure. This resource is used to describe the
054 * underlying resources, data types defined in FHIR, and also for describing
055 * extensions and constraints on resources and data types.
056 */
057@ResourceDef(name = "StructureDefinition", profile = "http://hl7.org/fhir/StructureDefinition/StructureDefinition")
058@ChildOrder(names = { "url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher",
059    "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "keyword", "fhirVersion", "mapping",
060    "kind", "abstract", "context", "contextInvariant", "type", "baseDefinition", "derivation", "snapshot",
061    "differential" })
062public class StructureDefinition extends MetadataResource {
063
064  public enum StructureDefinitionKind {
065    /**
066     * A primitive type that has a value and an extension. These can be used
067     * throughout complex datatype, Resource and extension definitions. Only the
068     * base specification can define primitive types.
069     */
070    PRIMITIVETYPE,
071    /**
072     * A complex structure that defines a set of data elements that is suitable for
073     * use in 'resources'. The base specification defines a number of complex types,
074     * and other specifications can define additional types. These structures do not
075     * have a maintained identity.
076     */
077    COMPLEXTYPE,
078    /**
079     * A 'resource' - a directed acyclic graph of elements that aggregrates other
080     * types into an identifiable entity. The base FHIR resources are defined by the
081     * FHIR specification itself but other 'resources' can be defined in additional
082     * specifications (though these will not be recognised as 'resources' by the
083     * FHIR specification (i.e. they do not get end-points etc, or act as the
084     * targets of references in FHIR defined resources - though other specificatiosn
085     * can treat them this way).
086     */
087    RESOURCE,
088    /**
089     * A pattern or a template that is not intended to be a real resource or complex
090     * type.
091     */
092    LOGICAL,
093    /**
094     * added to help the parsers with the generic types
095     */
096    NULL;
097
098    public static StructureDefinitionKind fromCode(String codeString) throws FHIRException {
099      if (codeString == null || "".equals(codeString))
100        return null;
101      if ("primitive-type".equals(codeString))
102        return PRIMITIVETYPE;
103      if ("complex-type".equals(codeString))
104        return COMPLEXTYPE;
105      if ("resource".equals(codeString))
106        return RESOURCE;
107      if ("logical".equals(codeString))
108        return LOGICAL;
109      if (Configuration.isAcceptInvalidEnums())
110        return null;
111      else
112        throw new FHIRException("Unknown StructureDefinitionKind code '" + codeString + "'");
113    }
114
115    public String toCode() {
116      switch (this) {
117      case PRIMITIVETYPE:
118        return "primitive-type";
119      case COMPLEXTYPE:
120        return "complex-type";
121      case RESOURCE:
122        return "resource";
123      case LOGICAL:
124        return "logical";
125      case NULL:
126        return null;
127      default:
128        return "?";
129      }
130    }
131
132    public String getSystem() {
133      switch (this) {
134      case PRIMITIVETYPE:
135        return "http://hl7.org/fhir/structure-definition-kind";
136      case COMPLEXTYPE:
137        return "http://hl7.org/fhir/structure-definition-kind";
138      case RESOURCE:
139        return "http://hl7.org/fhir/structure-definition-kind";
140      case LOGICAL:
141        return "http://hl7.org/fhir/structure-definition-kind";
142      case NULL:
143        return null;
144      default:
145        return "?";
146      }
147    }
148
149    public String getDefinition() {
150      switch (this) {
151      case PRIMITIVETYPE:
152        return "A primitive type that has a value and an extension. These can be used throughout complex datatype, Resource and extension definitions. Only the base specification can define primitive types.";
153      case COMPLEXTYPE:
154        return "A  complex structure that defines a set of data elements that is suitable for use in 'resources'. The base specification defines a number of complex types, and other specifications can define additional types. These structures do not have a maintained identity.";
155      case RESOURCE:
156        return "A 'resource' - a directed acyclic graph of elements that aggregrates other types into an identifiable entity. The base FHIR resources are defined by the FHIR specification itself but other 'resources' can be defined in additional specifications (though these will not be recognised as 'resources' by the FHIR specification (i.e. they do not get end-points etc, or act as the targets of references in FHIR defined resources - though other specificatiosn can treat them this way).";
157      case LOGICAL:
158        return "A pattern or a template that is not intended to be a real resource or complex type.";
159      case NULL:
160        return null;
161      default:
162        return "?";
163      }
164    }
165
166    public String getDisplay() {
167      switch (this) {
168      case PRIMITIVETYPE:
169        return "Primitive Data Type";
170      case COMPLEXTYPE:
171        return "Complex Data Type";
172      case RESOURCE:
173        return "Resource";
174      case LOGICAL:
175        return "Logical";
176      case NULL:
177        return null;
178      default:
179        return "?";
180      }
181    }
182  }
183
184  public static class StructureDefinitionKindEnumFactory implements EnumFactory<StructureDefinitionKind> {
185    public StructureDefinitionKind fromCode(String codeString) throws IllegalArgumentException {
186      if (codeString == null || "".equals(codeString))
187        if (codeString == null || "".equals(codeString))
188          return null;
189      if ("primitive-type".equals(codeString))
190        return StructureDefinitionKind.PRIMITIVETYPE;
191      if ("complex-type".equals(codeString))
192        return StructureDefinitionKind.COMPLEXTYPE;
193      if ("resource".equals(codeString))
194        return StructureDefinitionKind.RESOURCE;
195      if ("logical".equals(codeString))
196        return StructureDefinitionKind.LOGICAL;
197      throw new IllegalArgumentException("Unknown StructureDefinitionKind code '" + codeString + "'");
198    }
199
200    public Enumeration<StructureDefinitionKind> fromType(PrimitiveType<?> code) throws FHIRException {
201      if (code == null)
202        return null;
203      if (code.isEmpty())
204        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.NULL, code);
205      String codeString = code.asStringValue();
206      if (codeString == null || "".equals(codeString))
207        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.NULL, code);
208      if ("primitive-type".equals(codeString))
209        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.PRIMITIVETYPE, code);
210      if ("complex-type".equals(codeString))
211        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.COMPLEXTYPE, code);
212      if ("resource".equals(codeString))
213        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.RESOURCE, code);
214      if ("logical".equals(codeString))
215        return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.LOGICAL, code);
216      throw new FHIRException("Unknown StructureDefinitionKind code '" + codeString + "'");
217    }
218
219    public String toCode(StructureDefinitionKind code) {
220      if (code == StructureDefinitionKind.PRIMITIVETYPE)
221        return "primitive-type";
222      if (code == StructureDefinitionKind.COMPLEXTYPE)
223        return "complex-type";
224      if (code == StructureDefinitionKind.RESOURCE)
225        return "resource";
226      if (code == StructureDefinitionKind.LOGICAL)
227        return "logical";
228      return "?";
229    }
230
231    public String toSystem(StructureDefinitionKind code) {
232      return code.getSystem();
233    }
234  }
235
236  public enum ExtensionContextType {
237    /**
238     * The context is all elements that match the FHIRPath query found in the
239     * expression.
240     */
241    FHIRPATH,
242    /**
243     * The context is any element that has an ElementDefinition.id that matches that
244     * found in the expression. This includes ElementDefinition Ids that have
245     * slicing identifiers. The full path for the element is [url]#[elementid]. If
246     * there is no #, the Element id is one defined in the base specification.
247     */
248    ELEMENT,
249    /**
250     * The context is a particular extension from a particular StructureDefinition,
251     * and the expression is just a uri that identifies the extension.
252     */
253    EXTENSION,
254    /**
255     * added to help the parsers with the generic types
256     */
257    NULL;
258
259    public static ExtensionContextType fromCode(String codeString) throws FHIRException {
260      if (codeString == null || "".equals(codeString))
261        return null;
262      if ("fhirpath".equals(codeString))
263        return FHIRPATH;
264      if ("element".equals(codeString))
265        return ELEMENT;
266      if ("extension".equals(codeString))
267        return EXTENSION;
268      if (Configuration.isAcceptInvalidEnums())
269        return null;
270      else
271        throw new FHIRException("Unknown ExtensionContextType code '" + codeString + "'");
272    }
273
274    public String toCode() {
275      switch (this) {
276      case FHIRPATH:
277        return "fhirpath";
278      case ELEMENT:
279        return "element";
280      case EXTENSION:
281        return "extension";
282      case NULL:
283        return null;
284      default:
285        return "?";
286      }
287    }
288
289    public String getSystem() {
290      switch (this) {
291      case FHIRPATH:
292        return "http://hl7.org/fhir/extension-context-type";
293      case ELEMENT:
294        return "http://hl7.org/fhir/extension-context-type";
295      case EXTENSION:
296        return "http://hl7.org/fhir/extension-context-type";
297      case NULL:
298        return null;
299      default:
300        return "?";
301      }
302    }
303
304    public String getDefinition() {
305      switch (this) {
306      case FHIRPATH:
307        return "The context is all elements that match the FHIRPath query found in the expression.";
308      case ELEMENT:
309        return "The context is any element that has an ElementDefinition.id that matches that found in the expression. This includes ElementDefinition Ids that have slicing identifiers. The full path for the element is [url]#[elementid]. If there is no #, the Element id is one defined in the base specification.";
310      case EXTENSION:
311        return "The context is a particular extension from a particular StructureDefinition, and the expression is just a uri that identifies the extension.";
312      case NULL:
313        return null;
314      default:
315        return "?";
316      }
317    }
318
319    public String getDisplay() {
320      switch (this) {
321      case FHIRPATH:
322        return "FHIRPath";
323      case ELEMENT:
324        return "Element ID";
325      case EXTENSION:
326        return "Extension URL";
327      case NULL:
328        return null;
329      default:
330        return "?";
331      }
332    }
333  }
334
335  public static class ExtensionContextTypeEnumFactory implements EnumFactory<ExtensionContextType> {
336    public ExtensionContextType fromCode(String codeString) throws IllegalArgumentException {
337      if (codeString == null || "".equals(codeString))
338        if (codeString == null || "".equals(codeString))
339          return null;
340      if ("fhirpath".equals(codeString))
341        return ExtensionContextType.FHIRPATH;
342      if ("element".equals(codeString))
343        return ExtensionContextType.ELEMENT;
344      if ("extension".equals(codeString))
345        return ExtensionContextType.EXTENSION;
346      throw new IllegalArgumentException("Unknown ExtensionContextType code '" + codeString + "'");
347    }
348
349    public Enumeration<ExtensionContextType> fromType(PrimitiveType<?> code) throws FHIRException {
350      if (code == null)
351        return null;
352      if (code.isEmpty())
353        return new Enumeration<ExtensionContextType>(this, ExtensionContextType.NULL, code);
354      String codeString = code.asStringValue();
355      if (codeString == null || "".equals(codeString))
356        return new Enumeration<ExtensionContextType>(this, ExtensionContextType.NULL, code);
357      if ("fhirpath".equals(codeString))
358        return new Enumeration<ExtensionContextType>(this, ExtensionContextType.FHIRPATH, code);
359      if ("element".equals(codeString))
360        return new Enumeration<ExtensionContextType>(this, ExtensionContextType.ELEMENT, code);
361      if ("extension".equals(codeString))
362        return new Enumeration<ExtensionContextType>(this, ExtensionContextType.EXTENSION, code);
363      throw new FHIRException("Unknown ExtensionContextType code '" + codeString + "'");
364    }
365
366    public String toCode(ExtensionContextType code) {
367      if (code == ExtensionContextType.FHIRPATH)
368        return "fhirpath";
369      if (code == ExtensionContextType.ELEMENT)
370        return "element";
371      if (code == ExtensionContextType.EXTENSION)
372        return "extension";
373      return "?";
374    }
375
376    public String toSystem(ExtensionContextType code) {
377      return code.getSystem();
378    }
379  }
380
381  public enum TypeDerivationRule {
382    /**
383     * This definition defines a new type that adds additional elements to the base
384     * type.
385     */
386    SPECIALIZATION,
387    /**
388     * This definition adds additional rules to an existing concrete type.
389     */
390    CONSTRAINT,
391    /**
392     * added to help the parsers with the generic types
393     */
394    NULL;
395
396    public static TypeDerivationRule fromCode(String codeString) throws FHIRException {
397      if (codeString == null || "".equals(codeString))
398        return null;
399      if ("specialization".equals(codeString))
400        return SPECIALIZATION;
401      if ("constraint".equals(codeString))
402        return CONSTRAINT;
403      if (Configuration.isAcceptInvalidEnums())
404        return null;
405      else
406        throw new FHIRException("Unknown TypeDerivationRule code '" + codeString + "'");
407    }
408
409    public String toCode() {
410      switch (this) {
411      case SPECIALIZATION:
412        return "specialization";
413      case CONSTRAINT:
414        return "constraint";
415      case NULL:
416        return null;
417      default:
418        return "?";
419      }
420    }
421
422    public String getSystem() {
423      switch (this) {
424      case SPECIALIZATION:
425        return "http://hl7.org/fhir/type-derivation-rule";
426      case CONSTRAINT:
427        return "http://hl7.org/fhir/type-derivation-rule";
428      case NULL:
429        return null;
430      default:
431        return "?";
432      }
433    }
434
435    public String getDefinition() {
436      switch (this) {
437      case SPECIALIZATION:
438        return "This definition defines a new type that adds additional elements to the base type.";
439      case CONSTRAINT:
440        return "This definition adds additional rules to an existing concrete type.";
441      case NULL:
442        return null;
443      default:
444        return "?";
445      }
446    }
447
448    public String getDisplay() {
449      switch (this) {
450      case SPECIALIZATION:
451        return "Specialization";
452      case CONSTRAINT:
453        return "Constraint";
454      case NULL:
455        return null;
456      default:
457        return "?";
458      }
459    }
460  }
461
462  public static class TypeDerivationRuleEnumFactory implements EnumFactory<TypeDerivationRule> {
463    public TypeDerivationRule fromCode(String codeString) throws IllegalArgumentException {
464      if (codeString == null || "".equals(codeString))
465        if (codeString == null || "".equals(codeString))
466          return null;
467      if ("specialization".equals(codeString))
468        return TypeDerivationRule.SPECIALIZATION;
469      if ("constraint".equals(codeString))
470        return TypeDerivationRule.CONSTRAINT;
471      throw new IllegalArgumentException("Unknown TypeDerivationRule code '" + codeString + "'");
472    }
473
474    public Enumeration<TypeDerivationRule> fromType(PrimitiveType<?> code) throws FHIRException {
475      if (code == null)
476        return null;
477      if (code.isEmpty())
478        return new Enumeration<TypeDerivationRule>(this, TypeDerivationRule.NULL, code);
479      String codeString = code.asStringValue();
480      if (codeString == null || "".equals(codeString))
481        return new Enumeration<TypeDerivationRule>(this, TypeDerivationRule.NULL, code);
482      if ("specialization".equals(codeString))
483        return new Enumeration<TypeDerivationRule>(this, TypeDerivationRule.SPECIALIZATION, code);
484      if ("constraint".equals(codeString))
485        return new Enumeration<TypeDerivationRule>(this, TypeDerivationRule.CONSTRAINT, code);
486      throw new FHIRException("Unknown TypeDerivationRule code '" + codeString + "'");
487    }
488
489    public String toCode(TypeDerivationRule code) {
490      if (code == TypeDerivationRule.SPECIALIZATION)
491        return "specialization";
492      if (code == TypeDerivationRule.CONSTRAINT)
493        return "constraint";
494      return "?";
495    }
496
497    public String toSystem(TypeDerivationRule code) {
498      return code.getSystem();
499    }
500  }
501
502  @Block()
503  public static class StructureDefinitionMappingComponent extends BackboneElement implements IBaseBackboneElement {
504    /**
505     * An Internal id that is used to identify this mapping set when specific
506     * mappings are made.
507     */
508    @Child(name = "identity", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
509    @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.")
510    protected IdType identity;
511
512    /**
513     * An absolute URI that identifies the specification that this mapping is
514     * expressed to.
515     */
516    @Child(name = "uri", type = { UriType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
517    @Description(shortDefinition = "Identifies what this mapping refers to", formalDefinition = "An absolute URI that identifies the specification that this mapping is expressed to.")
518    protected UriType uri;
519
520    /**
521     * A name for the specification that is being mapped to.
522     */
523    @Child(name = "name", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
524    @Description(shortDefinition = "Names what this mapping refers to", formalDefinition = "A name for the specification that is being mapped to.")
525    protected StringType name;
526
527    /**
528     * Comments about this mapping, including version notes, issues, scope
529     * limitations, and other important notes for usage.
530     */
531    @Child(name = "comment", type = {
532        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
533    @Description(shortDefinition = "Versions, Issues, Scope limitations etc.", formalDefinition = "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.")
534    protected StringType comment;
535
536    private static final long serialVersionUID = 9610265L;
537
538    /**
539     * Constructor
540     */
541    public StructureDefinitionMappingComponent() {
542      super();
543    }
544
545    /**
546     * Constructor
547     */
548    public StructureDefinitionMappingComponent(IdType identity) {
549      super();
550      this.identity = identity;
551    }
552
553    /**
554     * @return {@link #identity} (An Internal id that is used to identify this
555     *         mapping set when specific mappings are made.). This is the underlying
556     *         object with id, value and extensions. The accessor "getIdentity"
557     *         gives direct access to the value
558     */
559    public IdType getIdentityElement() {
560      if (this.identity == null)
561        if (Configuration.errorOnAutoCreate())
562          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.identity");
563        else if (Configuration.doAutoCreate())
564          this.identity = new IdType(); // bb
565      return this.identity;
566    }
567
568    public boolean hasIdentityElement() {
569      return this.identity != null && !this.identity.isEmpty();
570    }
571
572    public boolean hasIdentity() {
573      return this.identity != null && !this.identity.isEmpty();
574    }
575
576    /**
577     * @param value {@link #identity} (An Internal id that is used to identify this
578     *              mapping set when specific mappings are made.). This is the
579     *              underlying object with id, value and extensions. The accessor
580     *              "getIdentity" gives direct access to the value
581     */
582    public StructureDefinitionMappingComponent setIdentityElement(IdType value) {
583      this.identity = value;
584      return this;
585    }
586
587    /**
588     * @return An Internal id that is used to identify this mapping set when
589     *         specific mappings are made.
590     */
591    public String getIdentity() {
592      return this.identity == null ? null : this.identity.getValue();
593    }
594
595    /**
596     * @param value An Internal id that is used to identify this mapping set when
597     *              specific mappings are made.
598     */
599    public StructureDefinitionMappingComponent setIdentity(String value) {
600      if (this.identity == null)
601        this.identity = new IdType();
602      this.identity.setValue(value);
603      return this;
604    }
605
606    /**
607     * @return {@link #uri} (An absolute URI that identifies the specification that
608     *         this mapping is expressed to.). This is the underlying object with
609     *         id, value and extensions. The accessor "getUri" gives direct access
610     *         to the value
611     */
612    public UriType getUriElement() {
613      if (this.uri == null)
614        if (Configuration.errorOnAutoCreate())
615          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.uri");
616        else if (Configuration.doAutoCreate())
617          this.uri = new UriType(); // bb
618      return this.uri;
619    }
620
621    public boolean hasUriElement() {
622      return this.uri != null && !this.uri.isEmpty();
623    }
624
625    public boolean hasUri() {
626      return this.uri != null && !this.uri.isEmpty();
627    }
628
629    /**
630     * @param value {@link #uri} (An absolute URI that identifies the specification
631     *              that this mapping is expressed to.). This is the underlying
632     *              object with id, value and extensions. The accessor "getUri"
633     *              gives direct access to the value
634     */
635    public StructureDefinitionMappingComponent setUriElement(UriType value) {
636      this.uri = value;
637      return this;
638    }
639
640    /**
641     * @return An absolute URI that identifies the specification that this mapping
642     *         is expressed to.
643     */
644    public String getUri() {
645      return this.uri == null ? null : this.uri.getValue();
646    }
647
648    /**
649     * @param value An absolute URI that identifies the specification that this
650     *              mapping is expressed to.
651     */
652    public StructureDefinitionMappingComponent setUri(String value) {
653      if (Utilities.noString(value))
654        this.uri = null;
655      else {
656        if (this.uri == null)
657          this.uri = new UriType();
658        this.uri.setValue(value);
659      }
660      return this;
661    }
662
663    /**
664     * @return {@link #name} (A name for the specification that is being mapped
665     *         to.). This is the underlying object with id, value and extensions.
666     *         The accessor "getName" gives direct access to the value
667     */
668    public StringType getNameElement() {
669      if (this.name == null)
670        if (Configuration.errorOnAutoCreate())
671          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.name");
672        else if (Configuration.doAutoCreate())
673          this.name = new StringType(); // bb
674      return this.name;
675    }
676
677    public boolean hasNameElement() {
678      return this.name != null && !this.name.isEmpty();
679    }
680
681    public boolean hasName() {
682      return this.name != null && !this.name.isEmpty();
683    }
684
685    /**
686     * @param value {@link #name} (A name for the specification that is being mapped
687     *              to.). This is the underlying object with id, value and
688     *              extensions. The accessor "getName" gives direct access to the
689     *              value
690     */
691    public StructureDefinitionMappingComponent setNameElement(StringType value) {
692      this.name = value;
693      return this;
694    }
695
696    /**
697     * @return A name for the specification that is being mapped to.
698     */
699    public String getName() {
700      return this.name == null ? null : this.name.getValue();
701    }
702
703    /**
704     * @param value A name for the specification that is being mapped to.
705     */
706    public StructureDefinitionMappingComponent setName(String value) {
707      if (Utilities.noString(value))
708        this.name = null;
709      else {
710        if (this.name == null)
711          this.name = new StringType();
712        this.name.setValue(value);
713      }
714      return this;
715    }
716
717    /**
718     * @return {@link #comment} (Comments about this mapping, including version
719     *         notes, issues, scope limitations, and other important notes for
720     *         usage.). This is the underlying object with id, value and extensions.
721     *         The accessor "getComment" gives direct access to the value
722     */
723    public StringType getCommentElement() {
724      if (this.comment == null)
725        if (Configuration.errorOnAutoCreate())
726          throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.comment");
727        else if (Configuration.doAutoCreate())
728          this.comment = new StringType(); // bb
729      return this.comment;
730    }
731
732    public boolean hasCommentElement() {
733      return this.comment != null && !this.comment.isEmpty();
734    }
735
736    public boolean hasComment() {
737      return this.comment != null && !this.comment.isEmpty();
738    }
739
740    /**
741     * @param value {@link #comment} (Comments about this mapping, including version
742     *              notes, issues, scope limitations, and other important notes for
743     *              usage.). This is the underlying object with id, value and
744     *              extensions. The accessor "getComment" gives direct access to the
745     *              value
746     */
747    public StructureDefinitionMappingComponent setCommentElement(StringType value) {
748      this.comment = value;
749      return this;
750    }
751
752    /**
753     * @return Comments about this mapping, including version notes, issues, scope
754     *         limitations, and other important notes for usage.
755     */
756    public String getComment() {
757      return this.comment == null ? null : this.comment.getValue();
758    }
759
760    /**
761     * @param value Comments about this mapping, including version notes, issues,
762     *              scope limitations, and other important notes for usage.
763     */
764    public StructureDefinitionMappingComponent setComment(String value) {
765      if (Utilities.noString(value))
766        this.comment = null;
767      else {
768        if (this.comment == null)
769          this.comment = new StringType();
770        this.comment.setValue(value);
771      }
772      return this;
773    }
774
775    protected void listChildren(List<Property> children) {
776      super.listChildren(children);
777      children.add(new Property("identity", "id",
778          "An Internal id that is used to identify this mapping set when specific mappings are made.", 0, 1, identity));
779      children.add(new Property("uri", "uri",
780          "An absolute URI that identifies the specification that this mapping is expressed to.", 0, 1, uri));
781      children.add(new Property("name", "string", "A name for the specification that is being mapped to.", 0, 1, name));
782      children.add(new Property("comment", "string",
783          "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.",
784          0, 1, comment));
785    }
786
787    @Override
788    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
789      switch (_hash) {
790      case -135761730:
791        /* identity */ return new Property("identity", "id",
792            "An Internal id that is used to identify this mapping set when specific mappings are made.", 0, 1,
793            identity);
794      case 116076:
795        /* uri */ return new Property("uri", "uri",
796            "An absolute URI that identifies the specification that this mapping is expressed to.", 0, 1, uri);
797      case 3373707:
798        /* name */ return new Property("name", "string", "A name for the specification that is being mapped to.", 0, 1,
799            name);
800      case 950398559:
801        /* comment */ return new Property("comment", "string",
802            "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.",
803            0, 1, comment);
804      default:
805        return super.getNamedProperty(_hash, _name, _checkValid);
806      }
807
808    }
809
810    @Override
811    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
812      switch (hash) {
813      case -135761730:
814        /* identity */ return this.identity == null ? new Base[0] : new Base[] { this.identity }; // IdType
815      case 116076:
816        /* uri */ return this.uri == null ? new Base[0] : new Base[] { this.uri }; // UriType
817      case 3373707:
818        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
819      case 950398559:
820        /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType
821      default:
822        return super.getProperty(hash, name, checkValid);
823      }
824
825    }
826
827    @Override
828    public Base setProperty(int hash, String name, Base value) throws FHIRException {
829      switch (hash) {
830      case -135761730: // identity
831        this.identity = castToId(value); // IdType
832        return value;
833      case 116076: // uri
834        this.uri = castToUri(value); // UriType
835        return value;
836      case 3373707: // name
837        this.name = castToString(value); // StringType
838        return value;
839      case 950398559: // comment
840        this.comment = castToString(value); // StringType
841        return value;
842      default:
843        return super.setProperty(hash, name, value);
844      }
845
846    }
847
848    @Override
849    public Base setProperty(String name, Base value) throws FHIRException {
850      if (name.equals("identity")) {
851        this.identity = castToId(value); // IdType
852      } else if (name.equals("uri")) {
853        this.uri = castToUri(value); // UriType
854      } else if (name.equals("name")) {
855        this.name = castToString(value); // StringType
856      } else if (name.equals("comment")) {
857        this.comment = castToString(value); // StringType
858      } else
859        return super.setProperty(name, value);
860      return value;
861    }
862
863  @Override
864  public void removeChild(String name, Base value) throws FHIRException {
865      if (name.equals("identity")) {
866        this.identity = null;
867      } else if (name.equals("uri")) {
868        this.uri = null;
869      } else if (name.equals("name")) {
870        this.name = null;
871      } else if (name.equals("comment")) {
872        this.comment = null;
873      } else
874        super.removeChild(name, value);
875      
876    }
877
878    @Override
879    public Base makeProperty(int hash, String name) throws FHIRException {
880      switch (hash) {
881      case -135761730:
882        return getIdentityElement();
883      case 116076:
884        return getUriElement();
885      case 3373707:
886        return getNameElement();
887      case 950398559:
888        return getCommentElement();
889      default:
890        return super.makeProperty(hash, name);
891      }
892
893    }
894
895    @Override
896    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
897      switch (hash) {
898      case -135761730:
899        /* identity */ return new String[] { "id" };
900      case 116076:
901        /* uri */ return new String[] { "uri" };
902      case 3373707:
903        /* name */ return new String[] { "string" };
904      case 950398559:
905        /* comment */ return new String[] { "string" };
906      default:
907        return super.getTypesForProperty(hash, name);
908      }
909
910    }
911
912    @Override
913    public Base addChild(String name) throws FHIRException {
914      if (name.equals("identity")) {
915        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.identity");
916      } else if (name.equals("uri")) {
917        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.uri");
918      } else if (name.equals("name")) {
919        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.name");
920      } else if (name.equals("comment")) {
921        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.comment");
922      } else
923        return super.addChild(name);
924    }
925
926    public StructureDefinitionMappingComponent copy() {
927      StructureDefinitionMappingComponent dst = new StructureDefinitionMappingComponent();
928      copyValues(dst);
929      return dst;
930    }
931
932    public void copyValues(StructureDefinitionMappingComponent dst) {
933      super.copyValues(dst);
934      dst.identity = identity == null ? null : identity.copy();
935      dst.uri = uri == null ? null : uri.copy();
936      dst.name = name == null ? null : name.copy();
937      dst.comment = comment == null ? null : comment.copy();
938    }
939
940    @Override
941    public boolean equalsDeep(Base other_) {
942      if (!super.equalsDeep(other_))
943        return false;
944      if (!(other_ instanceof StructureDefinitionMappingComponent))
945        return false;
946      StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other_;
947      return compareDeep(identity, o.identity, true) && compareDeep(uri, o.uri, true) && compareDeep(name, o.name, true)
948          && compareDeep(comment, o.comment, true);
949    }
950
951    @Override
952    public boolean equalsShallow(Base other_) {
953      if (!super.equalsShallow(other_))
954        return false;
955      if (!(other_ instanceof StructureDefinitionMappingComponent))
956        return false;
957      StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other_;
958      return compareValues(identity, o.identity, true) && compareValues(uri, o.uri, true)
959          && compareValues(name, o.name, true) && compareValues(comment, o.comment, true);
960    }
961
962    public boolean isEmpty() {
963      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identity, uri, name, comment);
964    }
965
966    public String fhirType() {
967      return "StructureDefinition.mapping";
968
969    }
970
971  }
972
973  @Block()
974  public static class StructureDefinitionContextComponent extends BackboneElement implements IBaseBackboneElement {
975    /**
976     * Defines how to interpret the expression that defines what the context of the
977     * extension is.
978     */
979    @Child(name = "type", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
980    @Description(shortDefinition = "fhirpath | element | extension", formalDefinition = "Defines how to interpret the expression that defines what the context of the extension is.")
981    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/extension-context-type")
982    protected Enumeration<ExtensionContextType> type;
983
984    /**
985     * An expression that defines where an extension can be used in resources.
986     */
987    @Child(name = "expression", type = {
988        StringType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
989    @Description(shortDefinition = "Where the extension can be used in instances", formalDefinition = "An expression that defines where an extension can be used in resources.")
990    protected StringType expression;
991
992    private static final long serialVersionUID = 1958074856L;
993
994    /**
995     * Constructor
996     */
997    public StructureDefinitionContextComponent() {
998      super();
999    }
1000
1001    /**
1002     * Constructor
1003     */
1004    public StructureDefinitionContextComponent(Enumeration<ExtensionContextType> type, StringType expression) {
1005      super();
1006      this.type = type;
1007      this.expression = expression;
1008    }
1009
1010    /**
1011     * @return {@link #type} (Defines how to interpret the expression that defines
1012     *         what the context of the extension is.). This is the underlying object
1013     *         with id, value and extensions. The accessor "getType" gives direct
1014     *         access to the value
1015     */
1016    public Enumeration<ExtensionContextType> getTypeElement() {
1017      if (this.type == null)
1018        if (Configuration.errorOnAutoCreate())
1019          throw new Error("Attempt to auto-create StructureDefinitionContextComponent.type");
1020        else if (Configuration.doAutoCreate())
1021          this.type = new Enumeration<ExtensionContextType>(new ExtensionContextTypeEnumFactory()); // bb
1022      return this.type;
1023    }
1024
1025    public boolean hasTypeElement() {
1026      return this.type != null && !this.type.isEmpty();
1027    }
1028
1029    public boolean hasType() {
1030      return this.type != null && !this.type.isEmpty();
1031    }
1032
1033    /**
1034     * @param value {@link #type} (Defines how to interpret the expression that
1035     *              defines what the context of the extension is.). This is the
1036     *              underlying object with id, value and extensions. The accessor
1037     *              "getType" gives direct access to the value
1038     */
1039    public StructureDefinitionContextComponent setTypeElement(Enumeration<ExtensionContextType> value) {
1040      this.type = value;
1041      return this;
1042    }
1043
1044    /**
1045     * @return Defines how to interpret the expression that defines what the context
1046     *         of the extension is.
1047     */
1048    public ExtensionContextType getType() {
1049      return this.type == null ? null : this.type.getValue();
1050    }
1051
1052    /**
1053     * @param value Defines how to interpret the expression that defines what the
1054     *              context of the extension is.
1055     */
1056    public StructureDefinitionContextComponent setType(ExtensionContextType value) {
1057      if (this.type == null)
1058        this.type = new Enumeration<ExtensionContextType>(new ExtensionContextTypeEnumFactory());
1059      this.type.setValue(value);
1060      return this;
1061    }
1062
1063    /**
1064     * @return {@link #expression} (An expression that defines where an extension
1065     *         can be used in resources.). This is the underlying object with id,
1066     *         value and extensions. The accessor "getExpression" gives direct
1067     *         access to the value
1068     */
1069    public StringType getExpressionElement() {
1070      if (this.expression == null)
1071        if (Configuration.errorOnAutoCreate())
1072          throw new Error("Attempt to auto-create StructureDefinitionContextComponent.expression");
1073        else if (Configuration.doAutoCreate())
1074          this.expression = new StringType(); // bb
1075      return this.expression;
1076    }
1077
1078    public boolean hasExpressionElement() {
1079      return this.expression != null && !this.expression.isEmpty();
1080    }
1081
1082    public boolean hasExpression() {
1083      return this.expression != null && !this.expression.isEmpty();
1084    }
1085
1086    /**
1087     * @param value {@link #expression} (An expression that defines where an
1088     *              extension can be used in resources.). This is the underlying
1089     *              object with id, value and extensions. The accessor
1090     *              "getExpression" gives direct access to the value
1091     */
1092    public StructureDefinitionContextComponent setExpressionElement(StringType value) {
1093      this.expression = value;
1094      return this;
1095    }
1096
1097    /**
1098     * @return An expression that defines where an extension can be used in
1099     *         resources.
1100     */
1101    public String getExpression() {
1102      return this.expression == null ? null : this.expression.getValue();
1103    }
1104
1105    /**
1106     * @param value An expression that defines where an extension can be used in
1107     *              resources.
1108     */
1109    public StructureDefinitionContextComponent setExpression(String value) {
1110      if (this.expression == null)
1111        this.expression = new StringType();
1112      this.expression.setValue(value);
1113      return this;
1114    }
1115
1116    protected void listChildren(List<Property> children) {
1117      super.listChildren(children);
1118      children.add(new Property("type", "code",
1119          "Defines how to interpret the expression that defines what the context of the extension is.", 0, 1, type));
1120      children.add(new Property("expression", "string",
1121          "An expression that defines where an extension can be used in resources.", 0, 1, expression));
1122    }
1123
1124    @Override
1125    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1126      switch (_hash) {
1127      case 3575610:
1128        /* type */ return new Property("type", "code",
1129            "Defines how to interpret the expression that defines what the context of the extension is.", 0, 1, type);
1130      case -1795452264:
1131        /* expression */ return new Property("expression", "string",
1132            "An expression that defines where an extension can be used in resources.", 0, 1, expression);
1133      default:
1134        return super.getNamedProperty(_hash, _name, _checkValid);
1135      }
1136
1137    }
1138
1139    @Override
1140    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1141      switch (hash) {
1142      case 3575610:
1143        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<ExtensionContextType>
1144      case -1795452264:
1145        /* expression */ return this.expression == null ? new Base[0] : new Base[] { this.expression }; // StringType
1146      default:
1147        return super.getProperty(hash, name, checkValid);
1148      }
1149
1150    }
1151
1152    @Override
1153    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1154      switch (hash) {
1155      case 3575610: // type
1156        value = new ExtensionContextTypeEnumFactory().fromType(castToCode(value));
1157        this.type = (Enumeration) value; // Enumeration<ExtensionContextType>
1158        return value;
1159      case -1795452264: // expression
1160        this.expression = castToString(value); // StringType
1161        return value;
1162      default:
1163        return super.setProperty(hash, name, value);
1164      }
1165
1166    }
1167
1168    @Override
1169    public Base setProperty(String name, Base value) throws FHIRException {
1170      if (name.equals("type")) {
1171        value = new ExtensionContextTypeEnumFactory().fromType(castToCode(value));
1172        this.type = (Enumeration) value; // Enumeration<ExtensionContextType>
1173      } else if (name.equals("expression")) {
1174        this.expression = castToString(value); // StringType
1175      } else
1176        return super.setProperty(name, value);
1177      return value;
1178    }
1179
1180  @Override
1181  public void removeChild(String name, Base value) throws FHIRException {
1182      if (name.equals("type")) {
1183        this.type = null;
1184      } else if (name.equals("expression")) {
1185        this.expression = null;
1186      } else
1187        super.removeChild(name, value);
1188      
1189    }
1190
1191    @Override
1192    public Base makeProperty(int hash, String name) throws FHIRException {
1193      switch (hash) {
1194      case 3575610:
1195        return getTypeElement();
1196      case -1795452264:
1197        return getExpressionElement();
1198      default:
1199        return super.makeProperty(hash, name);
1200      }
1201
1202    }
1203
1204    @Override
1205    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1206      switch (hash) {
1207      case 3575610:
1208        /* type */ return new String[] { "code" };
1209      case -1795452264:
1210        /* expression */ return new String[] { "string" };
1211      default:
1212        return super.getTypesForProperty(hash, name);
1213      }
1214
1215    }
1216
1217    @Override
1218    public Base addChild(String name) throws FHIRException {
1219      if (name.equals("type")) {
1220        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.type");
1221      } else if (name.equals("expression")) {
1222        throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.expression");
1223      } else
1224        return super.addChild(name);
1225    }
1226
1227    public StructureDefinitionContextComponent copy() {
1228      StructureDefinitionContextComponent dst = new StructureDefinitionContextComponent();
1229      copyValues(dst);
1230      return dst;
1231    }
1232
1233    public void copyValues(StructureDefinitionContextComponent dst) {
1234      super.copyValues(dst);
1235      dst.type = type == null ? null : type.copy();
1236      dst.expression = expression == null ? null : expression.copy();
1237    }
1238
1239    @Override
1240    public boolean equalsDeep(Base other_) {
1241      if (!super.equalsDeep(other_))
1242        return false;
1243      if (!(other_ instanceof StructureDefinitionContextComponent))
1244        return false;
1245      StructureDefinitionContextComponent o = (StructureDefinitionContextComponent) other_;
1246      return compareDeep(type, o.type, true) && compareDeep(expression, o.expression, true);
1247    }
1248
1249    @Override
1250    public boolean equalsShallow(Base other_) {
1251      if (!super.equalsShallow(other_))
1252        return false;
1253      if (!(other_ instanceof StructureDefinitionContextComponent))
1254        return false;
1255      StructureDefinitionContextComponent o = (StructureDefinitionContextComponent) other_;
1256      return compareValues(type, o.type, true) && compareValues(expression, o.expression, true);
1257    }
1258
1259    public boolean isEmpty() {
1260      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, expression);
1261    }
1262
1263    public String fhirType() {
1264      return "StructureDefinition.context";
1265
1266    }
1267
1268  }
1269
1270  @Block()
1271  public static class StructureDefinitionSnapshotComponent extends BackboneElement implements IBaseBackboneElement {
1272    /**
1273     * Captures constraints on each element within the resource.
1274     */
1275    @Child(name = "element", type = {
1276        ElementDefinition.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1277    @Description(shortDefinition = "Definition of elements in the resource (if no StructureDefinition)", formalDefinition = "Captures constraints on each element within the resource.")
1278    protected List<ElementDefinition> element;
1279
1280    private static final long serialVersionUID = 53896641L;
1281
1282    /**
1283     * Constructor
1284     */
1285    public StructureDefinitionSnapshotComponent() {
1286      super();
1287    }
1288
1289    /**
1290     * @return {@link #element} (Captures constraints on each element within the
1291     *         resource.)
1292     */
1293    public List<ElementDefinition> getElement() {
1294      if (this.element == null)
1295        this.element = new ArrayList<ElementDefinition>();
1296      return this.element;
1297    }
1298
1299    /**
1300     * @return Returns a reference to <code>this</code> for easy method chaining
1301     */
1302    public StructureDefinitionSnapshotComponent setElement(List<ElementDefinition> theElement) {
1303      this.element = theElement;
1304      return this;
1305    }
1306
1307    public boolean hasElement() {
1308      if (this.element == null)
1309        return false;
1310      for (ElementDefinition item : this.element)
1311        if (!item.isEmpty())
1312          return true;
1313      return false;
1314    }
1315
1316    public ElementDefinition addElement() { // 3
1317      ElementDefinition t = new ElementDefinition();
1318      if (this.element == null)
1319        this.element = new ArrayList<ElementDefinition>();
1320      this.element.add(t);
1321      return t;
1322    }
1323
1324    public StructureDefinitionSnapshotComponent addElement(ElementDefinition t) { // 3
1325      if (t == null)
1326        return this;
1327      if (this.element == null)
1328        this.element = new ArrayList<ElementDefinition>();
1329      this.element.add(t);
1330      return this;
1331    }
1332
1333    /**
1334     * @return The first repetition of repeating field {@link #element}, creating it
1335     *         if it does not already exist
1336     */
1337    public ElementDefinition getElementFirstRep() {
1338      if (getElement().isEmpty()) {
1339        addElement();
1340      }
1341      return getElement().get(0);
1342    }
1343
1344    protected void listChildren(List<Property> children) {
1345      super.listChildren(children);
1346      children.add(new Property("element", "ElementDefinition",
1347          "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
1348    }
1349
1350    @Override
1351    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1352      switch (_hash) {
1353      case -1662836996:
1354        /* element */ return new Property("element", "ElementDefinition",
1355            "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element);
1356      default:
1357        return super.getNamedProperty(_hash, _name, _checkValid);
1358      }
1359
1360    }
1361
1362    @Override
1363    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1364      switch (hash) {
1365      case -1662836996:
1366        /* element */ return this.element == null ? new Base[0] : this.element.toArray(new Base[this.element.size()]); // ElementDefinition
1367      default:
1368        return super.getProperty(hash, name, checkValid);
1369      }
1370
1371    }
1372
1373    @Override
1374    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1375      switch (hash) {
1376      case -1662836996: // element
1377        this.getElement().add(castToElementDefinition(value)); // ElementDefinition
1378        return value;
1379      default:
1380        return super.setProperty(hash, name, value);
1381      }
1382
1383    }
1384
1385    @Override
1386    public Base setProperty(String name, Base value) throws FHIRException {
1387      if (name.equals("element")) {
1388        this.getElement().add(castToElementDefinition(value));
1389      } else
1390        return super.setProperty(name, value);
1391      return value;
1392    }
1393
1394  @Override
1395  public void removeChild(String name, Base value) throws FHIRException {
1396      if (name.equals("element")) {
1397        this.getElement().remove(castToElementDefinition(value));
1398      } else
1399        super.removeChild(name, value);
1400      
1401    }
1402
1403    @Override
1404    public Base makeProperty(int hash, String name) throws FHIRException {
1405      switch (hash) {
1406      case -1662836996:
1407        return addElement();
1408      default:
1409        return super.makeProperty(hash, name);
1410      }
1411
1412    }
1413
1414    @Override
1415    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1416      switch (hash) {
1417      case -1662836996:
1418        /* element */ return new String[] { "ElementDefinition" };
1419      default:
1420        return super.getTypesForProperty(hash, name);
1421      }
1422
1423    }
1424
1425    @Override
1426    public Base addChild(String name) throws FHIRException {
1427      if (name.equals("element")) {
1428        return addElement();
1429      } else
1430        return super.addChild(name);
1431    }
1432
1433    public StructureDefinitionSnapshotComponent copy() {
1434      StructureDefinitionSnapshotComponent dst = new StructureDefinitionSnapshotComponent();
1435      copyValues(dst);
1436      return dst;
1437    }
1438
1439    public void copyValues(StructureDefinitionSnapshotComponent dst) {
1440      super.copyValues(dst);
1441      if (element != null) {
1442        dst.element = new ArrayList<ElementDefinition>();
1443        for (ElementDefinition i : element)
1444          dst.element.add(i.copy());
1445      }
1446      ;
1447    }
1448
1449    @Override
1450    public boolean equalsDeep(Base other_) {
1451      if (!super.equalsDeep(other_))
1452        return false;
1453      if (!(other_ instanceof StructureDefinitionSnapshotComponent))
1454        return false;
1455      StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other_;
1456      return compareDeep(element, o.element, true);
1457    }
1458
1459    @Override
1460    public boolean equalsShallow(Base other_) {
1461      if (!super.equalsShallow(other_))
1462        return false;
1463      if (!(other_ instanceof StructureDefinitionSnapshotComponent))
1464        return false;
1465      StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other_;
1466      return true;
1467    }
1468
1469    public boolean isEmpty() {
1470      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(element);
1471    }
1472
1473    public String fhirType() {
1474      return "StructureDefinition.snapshot";
1475
1476    }
1477
1478    public ElementDefinition getElementByPath(String path) {
1479      if (path == null) {
1480        return null;
1481      }
1482      for (ElementDefinition ed : getElement()) {
1483        if (path.equals(ed.getPath()) || (path+"[x]").equals(ed.getPath())) {
1484          return ed;
1485        }
1486      }
1487      return null;
1488    }
1489
1490
1491    public ElementDefinition getElementById(String id) {
1492      if (id == null) {
1493        return null;
1494      }
1495      for (ElementDefinition ed : getElement()) {
1496        if (id.equals(ed.getId())) {
1497          return ed;
1498        }
1499      }
1500      return null;
1501    }
1502
1503  }
1504
1505  @Block()
1506  public static class StructureDefinitionDifferentialComponent extends BackboneElement implements IBaseBackboneElement {
1507    /**
1508     * Captures constraints on each element within the resource.
1509     */
1510    @Child(name = "element", type = {
1511        ElementDefinition.class }, order = 1, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1512    @Description(shortDefinition = "Definition of elements in the resource (if no StructureDefinition)", formalDefinition = "Captures constraints on each element within the resource.")
1513    protected List<ElementDefinition> element;
1514
1515    private static final long serialVersionUID = 53896641L;
1516
1517    /**
1518     * Constructor
1519     */
1520    public StructureDefinitionDifferentialComponent() {
1521      super();
1522    }
1523
1524    /**
1525     * @return {@link #element} (Captures constraints on each element within the
1526     *         resource.)
1527     */
1528    public List<ElementDefinition> getElement() {
1529      if (this.element == null)
1530        this.element = new ArrayList<ElementDefinition>();
1531      return this.element;
1532    }
1533
1534    /**
1535     * @return Returns a reference to <code>this</code> for easy method chaining
1536     */
1537    public StructureDefinitionDifferentialComponent setElement(List<ElementDefinition> theElement) {
1538      this.element = theElement;
1539      return this;
1540    }
1541
1542    public boolean hasElement() {
1543      if (this.element == null)
1544        return false;
1545      for (ElementDefinition item : this.element)
1546        if (!item.isEmpty())
1547          return true;
1548      return false;
1549    }
1550
1551    public ElementDefinition addElement() { // 3
1552      ElementDefinition t = new ElementDefinition();
1553      if (this.element == null)
1554        this.element = new ArrayList<ElementDefinition>();
1555      this.element.add(t);
1556      return t;
1557    }
1558
1559    public StructureDefinitionDifferentialComponent addElement(ElementDefinition t) { // 3
1560      if (t == null)
1561        return this;
1562      if (this.element == null)
1563        this.element = new ArrayList<ElementDefinition>();
1564      this.element.add(t);
1565      return this;
1566    }
1567
1568    /**
1569     * @return The first repetition of repeating field {@link #element}, creating it
1570     *         if it does not already exist
1571     */
1572    public ElementDefinition getElementFirstRep() {
1573      if (getElement().isEmpty()) {
1574        addElement();
1575      }
1576      return getElement().get(0);
1577    }
1578
1579    protected void listChildren(List<Property> children) {
1580      super.listChildren(children);
1581      children.add(new Property("element", "ElementDefinition",
1582          "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
1583    }
1584
1585    @Override
1586    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1587      switch (_hash) {
1588      case -1662836996:
1589        /* element */ return new Property("element", "ElementDefinition",
1590            "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element);
1591      default:
1592        return super.getNamedProperty(_hash, _name, _checkValid);
1593      }
1594
1595    }
1596
1597    @Override
1598    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1599      switch (hash) {
1600      case -1662836996:
1601        /* element */ return this.element == null ? new Base[0] : this.element.toArray(new Base[this.element.size()]); // ElementDefinition
1602      default:
1603        return super.getProperty(hash, name, checkValid);
1604      }
1605
1606    }
1607
1608    @Override
1609    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1610      switch (hash) {
1611      case -1662836996: // element
1612        this.getElement().add(castToElementDefinition(value)); // ElementDefinition
1613        return value;
1614      default:
1615        return super.setProperty(hash, name, value);
1616      }
1617
1618    }
1619
1620    @Override
1621    public Base setProperty(String name, Base value) throws FHIRException {
1622      if (name.equals("element")) {
1623        this.getElement().add(castToElementDefinition(value));
1624      } else
1625        return super.setProperty(name, value);
1626      return value;
1627    }
1628
1629  @Override
1630  public void removeChild(String name, Base value) throws FHIRException {
1631      if (name.equals("element")) {
1632        this.getElement().remove(castToElementDefinition(value));
1633      } else
1634        super.removeChild(name, value);
1635      
1636    }
1637
1638    @Override
1639    public Base makeProperty(int hash, String name) throws FHIRException {
1640      switch (hash) {
1641      case -1662836996:
1642        return addElement();
1643      default:
1644        return super.makeProperty(hash, name);
1645      }
1646
1647    }
1648
1649    @Override
1650    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1651      switch (hash) {
1652      case -1662836996:
1653        /* element */ return new String[] { "ElementDefinition" };
1654      default:
1655        return super.getTypesForProperty(hash, name);
1656      }
1657
1658    }
1659
1660    @Override
1661    public Base addChild(String name) throws FHIRException {
1662      if (name.equals("element")) {
1663        return addElement();
1664      } else
1665        return super.addChild(name);
1666    }
1667
1668    public StructureDefinitionDifferentialComponent copy() {
1669      StructureDefinitionDifferentialComponent dst = new StructureDefinitionDifferentialComponent();
1670      copyValues(dst);
1671      return dst;
1672    }
1673
1674    public void copyValues(StructureDefinitionDifferentialComponent dst) {
1675      super.copyValues(dst);
1676      if (element != null) {
1677        dst.element = new ArrayList<ElementDefinition>();
1678        for (ElementDefinition i : element)
1679          dst.element.add(i.copy());
1680      }
1681      ;
1682    }
1683
1684    @Override
1685    public boolean equalsDeep(Base other_) {
1686      if (!super.equalsDeep(other_))
1687        return false;
1688      if (!(other_ instanceof StructureDefinitionDifferentialComponent))
1689        return false;
1690      StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other_;
1691      return compareDeep(element, o.element, true);
1692    }
1693
1694    @Override
1695    public boolean equalsShallow(Base other_) {
1696      if (!super.equalsShallow(other_))
1697        return false;
1698      if (!(other_ instanceof StructureDefinitionDifferentialComponent))
1699        return false;
1700      StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other_;
1701      return true;
1702    }
1703
1704    public boolean isEmpty() {
1705      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(element);
1706    }
1707
1708    public String fhirType() {
1709      return "StructureDefinition.differential";
1710
1711    }
1712
1713  }
1714
1715  /**
1716   * A formal identifier that is used to identify this structure definition when
1717   * it is represented in other formats, or referenced in a specification, model,
1718   * design or an instance.
1719   */
1720  @Child(name = "identifier", type = {
1721      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1722  @Description(shortDefinition = "Additional identifier for the structure definition", formalDefinition = "A formal identifier that is used to identify this structure definition when it is represented in other formats, or referenced in a specification, model, design or an instance.")
1723  protected List<Identifier> identifier;
1724
1725  /**
1726   * Explanation of why this structure definition is needed and why it has been
1727   * designed as it has.
1728   */
1729  @Child(name = "purpose", type = {
1730      MarkdownType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1731  @Description(shortDefinition = "Why this structure definition is defined", formalDefinition = "Explanation of why this structure definition is needed and why it has been designed as it has.")
1732  protected MarkdownType purpose;
1733
1734  /**
1735   * A copyright statement relating to the structure definition and/or its
1736   * contents. Copyright statements are generally legal restrictions on the use
1737   * and publishing of the structure definition.
1738   */
1739  @Child(name = "copyright", type = {
1740      MarkdownType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1741  @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 structure definition.")
1742  protected MarkdownType copyright;
1743
1744  /**
1745   * A set of key words or terms from external terminologies that may be used to
1746   * assist with indexing and searching of templates nby describing the use of
1747   * this structure definition, or the content it describes.
1748   */
1749  @Child(name = "keyword", type = {
1750      Coding.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1751  @Description(shortDefinition = "Assist with indexing and finding", formalDefinition = "A set of key words or terms from external terminologies that may be used to assist with indexing and searching of templates nby describing the use of this structure definition, or the content it describes.")
1752  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/definition-use")
1753  protected List<Coding> keyword;
1754
1755  /**
1756   * The version of the FHIR specification on which this StructureDefinition is
1757   * based - this is the formal version of the specification, without the revision
1758   * number, e.g. [publication].[major].[minor], which is 4.0.1. for this version.
1759   */
1760  @Child(name = "fhirVersion", type = { CodeType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1761  @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 4.0.1. for this version.")
1762  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/FHIR-version")
1763  protected Enumeration<FHIRVersion> fhirVersion;
1764
1765  /**
1766   * An external specification that the content is mapped to.
1767   */
1768  @Child(name = "mapping", type = {}, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1769  @Description(shortDefinition = "External specification that the content is mapped to", formalDefinition = "An external specification that the content is mapped to.")
1770  protected List<StructureDefinitionMappingComponent> mapping;
1771
1772  /**
1773   * Defines the kind of structure that this definition is describing.
1774   */
1775  @Child(name = "kind", type = { CodeType.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
1776  @Description(shortDefinition = "primitive-type | complex-type | resource | logical", formalDefinition = "Defines the kind of structure that this definition is describing.")
1777  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/structure-definition-kind")
1778  protected Enumeration<StructureDefinitionKind> kind;
1779
1780  /**
1781   * Whether structure this definition describes is abstract or not - that is,
1782   * whether the structure is not intended to be instantiated. For Resources and
1783   * Data types, abstract types will never be exchanged between systems.
1784   */
1785  @Child(name = "abstract", type = { BooleanType.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
1786  @Description(shortDefinition = "Whether the structure is abstract", formalDefinition = "Whether structure this definition describes is abstract or not  - that is, whether the structure is not intended to be instantiated. For Resources and Data types, abstract types will never be exchanged  between systems.")
1787  protected BooleanType abstract_;
1788
1789  /**
1790   * Identifies the types of resource or data type elements to which the extension
1791   * can be applied.
1792   */
1793  @Child(name = "context", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1794  @Description(shortDefinition = "If an extension, where it can be used in instances", formalDefinition = "Identifies the types of resource or data type elements to which the extension can be applied.")
1795  protected List<StructureDefinitionContextComponent> context;
1796
1797  /**
1798   * A set of rules as FHIRPath Invariants about when the extension can be used
1799   * (e.g. co-occurrence variants for the extension). All the rules must be true.
1800   */
1801  @Child(name = "contextInvariant", type = {
1802      StringType.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1803  @Description(shortDefinition = "FHIRPath invariants - when the extension can be used", formalDefinition = "A set of rules as FHIRPath Invariants about when the extension can be used (e.g. co-occurrence variants for the extension). All the rules must be true.")
1804  protected List<StringType> contextInvariant;
1805
1806  /**
1807   * The type this structure describes. If the derivation kind is 'specialization'
1808   * then this is the master definition for a type, and there is always one of
1809   * these (a data type, an extension, a resource, including abstract ones).
1810   * Otherwise the structure definition is a constraint on the stated type (and in
1811   * this case, the type cannot be an abstract type). References are URLs that are
1812   * relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a
1813   * reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs
1814   * are only allowed in logical models.
1815   */
1816  @Child(name = "type", type = { UriType.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
1817  @Description(shortDefinition = "Type defined or constrained by this structure", formalDefinition = "The type this structure describes. If the derivation kind is 'specialization' then this is the master definition for a type, and there is always one of these (a data type, an extension, a resource, including abstract ones). Otherwise the structure definition is a constraint on the stated type (and in this case, the type cannot be an abstract type).  References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.")
1818  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/defined-types")
1819  protected UriType type;
1820
1821  /**
1822   * An absolute URI that is the base structure from which this type is derived,
1823   * either by specialization or constraint.
1824   */
1825  @Child(name = "baseDefinition", type = {
1826      CanonicalType.class }, order = 11, min = 0, max = 1, modifier = false, summary = true)
1827  @Description(shortDefinition = "Definition that this type is constrained/specialized from", formalDefinition = "An absolute URI that is the base structure from which this type is derived, either by specialization or constraint.")
1828  protected CanonicalType baseDefinition;
1829
1830  /**
1831   * How the type relates to the baseDefinition.
1832   */
1833  @Child(name = "derivation", type = { CodeType.class }, order = 12, min = 0, max = 1, modifier = false, summary = true)
1834  @Description(shortDefinition = "specialization | constraint - How relates to base definition", formalDefinition = "How the type relates to the baseDefinition.")
1835  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/type-derivation-rule")
1836  protected Enumeration<TypeDerivationRule> derivation;
1837
1838  /**
1839   * A snapshot view is expressed in a standalone form that can be used and
1840   * interpreted without considering the base StructureDefinition.
1841   */
1842  @Child(name = "snapshot", type = {}, order = 13, min = 0, max = 1, modifier = false, summary = false)
1843  @Description(shortDefinition = "Snapshot view of the structure", formalDefinition = "A snapshot view is expressed in a standalone form that can be used and interpreted without considering the base StructureDefinition.")
1844  protected StructureDefinitionSnapshotComponent snapshot;
1845
1846  /**
1847   * A differential view is expressed relative to the base StructureDefinition - a
1848   * statement of differences that it applies.
1849   */
1850  @Child(name = "differential", type = {}, order = 14, min = 0, max = 1, modifier = false, summary = false)
1851  @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.")
1852  protected StructureDefinitionDifferentialComponent differential;
1853
1854  private static final long serialVersionUID = 316076774L;
1855
1856  /**
1857   * Constructor
1858   */
1859  public StructureDefinition() {
1860    super();
1861  }
1862
1863  /**
1864   * Constructor
1865   */
1866  public StructureDefinition(UriType url, StringType name, Enumeration<PublicationStatus> status,
1867      Enumeration<StructureDefinitionKind> kind, BooleanType abstract_, UriType type) {
1868    super();
1869    this.url = url;
1870    this.name = name;
1871    this.status = status;
1872    this.kind = kind;
1873    this.abstract_ = abstract_;
1874    this.type = type;
1875  }
1876
1877  /**
1878   * @return {@link #url} (An absolute URI that is used to identify this structure
1879   *         definition when it is referenced in a specification, model, design or
1880   *         an instance; also called its canonical identifier. This SHOULD be
1881   *         globally unique and SHOULD be a literal address at which at which an
1882   *         authoritative instance of this structure definition is (or will be)
1883   *         published. This URL can be the target of a canonical reference. It
1884   *         SHALL remain the same when the structure definition is stored on
1885   *         different servers.). This is the underlying object with id, value and
1886   *         extensions. The accessor "getUrl" gives direct access to the value
1887   */
1888  public UriType getUrlElement() {
1889    if (this.url == null)
1890      if (Configuration.errorOnAutoCreate())
1891        throw new Error("Attempt to auto-create StructureDefinition.url");
1892      else if (Configuration.doAutoCreate())
1893        this.url = new UriType(); // bb
1894    return this.url;
1895  }
1896
1897  public boolean hasUrlElement() {
1898    return this.url != null && !this.url.isEmpty();
1899  }
1900
1901  public boolean hasUrl() {
1902    return this.url != null && !this.url.isEmpty();
1903  }
1904
1905  /**
1906   * @param value {@link #url} (An absolute URI that is used to identify this
1907   *              structure definition when it is referenced in a specification,
1908   *              model, design or an instance; also called its canonical
1909   *              identifier. This SHOULD be globally unique and SHOULD be a
1910   *              literal address at which at which an authoritative instance of
1911   *              this structure definition is (or will be) published. This URL
1912   *              can be the target of a canonical reference. It SHALL remain the
1913   *              same when the structure definition is stored on different
1914   *              servers.). This is the underlying object with id, value and
1915   *              extensions. The accessor "getUrl" gives direct access to the
1916   *              value
1917   */
1918  public StructureDefinition setUrlElement(UriType value) {
1919    this.url = value;
1920    return this;
1921  }
1922
1923  /**
1924   * @return An absolute URI that is used to identify this structure definition
1925   *         when it is referenced in a specification, model, design or an
1926   *         instance; also called its canonical identifier. This SHOULD be
1927   *         globally unique and SHOULD be a literal address at which at which an
1928   *         authoritative instance of this structure definition is (or will be)
1929   *         published. This URL can be the target of a canonical reference. It
1930   *         SHALL remain the same when the structure definition is stored on
1931   *         different servers.
1932   */
1933  public String getUrl() {
1934    return this.url == null ? null : this.url.getValue();
1935  }
1936
1937  /**
1938   * @param value An absolute URI that is used to identify this structure
1939   *              definition when it is referenced in a specification, model,
1940   *              design or an instance; also called its canonical identifier.
1941   *              This SHOULD be globally unique and SHOULD be a literal address
1942   *              at which at which an authoritative instance of this structure
1943   *              definition is (or will be) published. This URL can be the target
1944   *              of a canonical reference. It SHALL remain the same when the
1945   *              structure definition is stored on different servers.
1946   */
1947  public StructureDefinition setUrl(String value) {
1948    if (this.url == null)
1949      this.url = new UriType();
1950    this.url.setValue(value);
1951    return this;
1952  }
1953
1954  /**
1955   * @return {@link #identifier} (A formal identifier that is used to identify
1956   *         this structure definition when it is represented in other formats, or
1957   *         referenced in a specification, model, design or an instance.)
1958   */
1959  public List<Identifier> getIdentifier() {
1960    if (this.identifier == null)
1961      this.identifier = new ArrayList<Identifier>();
1962    return this.identifier;
1963  }
1964
1965  /**
1966   * @return Returns a reference to <code>this</code> for easy method chaining
1967   */
1968  public StructureDefinition setIdentifier(List<Identifier> theIdentifier) {
1969    this.identifier = theIdentifier;
1970    return this;
1971  }
1972
1973  public boolean hasIdentifier() {
1974    if (this.identifier == null)
1975      return false;
1976    for (Identifier item : this.identifier)
1977      if (!item.isEmpty())
1978        return true;
1979    return false;
1980  }
1981
1982  public Identifier addIdentifier() { // 3
1983    Identifier t = new Identifier();
1984    if (this.identifier == null)
1985      this.identifier = new ArrayList<Identifier>();
1986    this.identifier.add(t);
1987    return t;
1988  }
1989
1990  public StructureDefinition addIdentifier(Identifier t) { // 3
1991    if (t == null)
1992      return this;
1993    if (this.identifier == null)
1994      this.identifier = new ArrayList<Identifier>();
1995    this.identifier.add(t);
1996    return this;
1997  }
1998
1999  /**
2000   * @return The first repetition of repeating field {@link #identifier}, creating
2001   *         it if it does not already exist
2002   */
2003  public Identifier getIdentifierFirstRep() {
2004    if (getIdentifier().isEmpty()) {
2005      addIdentifier();
2006    }
2007    return getIdentifier().get(0);
2008  }
2009
2010  /**
2011   * @return {@link #version} (The identifier that is used to identify this
2012   *         version of the structure definition when it is referenced in a
2013   *         specification, model, design or instance. This is an arbitrary value
2014   *         managed by the structure definition author and is not expected to be
2015   *         globally unique. For example, it might be a timestamp (e.g. yyyymmdd)
2016   *         if a managed version is not available. There is also no expectation
2017   *         that versions can be placed in a lexicographical sequence.). This is
2018   *         the underlying object with id, value and extensions. The accessor
2019   *         "getVersion" gives direct access to the value
2020   */
2021  public StringType getVersionElement() {
2022    if (this.version == null)
2023      if (Configuration.errorOnAutoCreate())
2024        throw new Error("Attempt to auto-create StructureDefinition.version");
2025      else if (Configuration.doAutoCreate())
2026        this.version = new StringType(); // bb
2027    return this.version;
2028  }
2029
2030  public boolean hasVersionElement() {
2031    return this.version != null && !this.version.isEmpty();
2032  }
2033
2034  public boolean hasVersion() {
2035    return this.version != null && !this.version.isEmpty();
2036  }
2037
2038  /**
2039   * @param value {@link #version} (The identifier that is used to identify this
2040   *              version of the structure definition when it is referenced in a
2041   *              specification, model, design or instance. This is an arbitrary
2042   *              value managed by the structure definition author and is not
2043   *              expected to be globally unique. For example, it might be a
2044   *              timestamp (e.g. yyyymmdd) if a managed version is not available.
2045   *              There is also no expectation that versions can be placed in a
2046   *              lexicographical sequence.). This is the underlying object with
2047   *              id, value and extensions. The accessor "getVersion" gives direct
2048   *              access to the value
2049   */
2050  public StructureDefinition setVersionElement(StringType value) {
2051    this.version = value;
2052    return this;
2053  }
2054
2055  /**
2056   * @return The identifier that is used to identify this version of the structure
2057   *         definition when it is referenced in a specification, model, design or
2058   *         instance. This is an arbitrary value managed by the structure
2059   *         definition author and is not expected to be globally unique. For
2060   *         example, it might be a timestamp (e.g. yyyymmdd) if a managed version
2061   *         is not available. There is also no expectation that versions can be
2062   *         placed in a lexicographical sequence.
2063   */
2064  public String getVersion() {
2065    return this.version == null ? null : this.version.getValue();
2066  }
2067
2068  /**
2069   * @param value The identifier that is used to identify this version of the
2070   *              structure definition when it is referenced in a specification,
2071   *              model, design or instance. This is an arbitrary value managed by
2072   *              the structure definition author and is not expected to be
2073   *              globally unique. For example, it might be a timestamp (e.g.
2074   *              yyyymmdd) if a managed version is not available. There is also
2075   *              no expectation that versions can be placed in a lexicographical
2076   *              sequence.
2077   */
2078  public StructureDefinition setVersion(String value) {
2079    if (Utilities.noString(value))
2080      this.version = null;
2081    else {
2082      if (this.version == null)
2083        this.version = new StringType();
2084      this.version.setValue(value);
2085    }
2086    return this;
2087  }
2088
2089  /**
2090   * @return {@link #name} (A natural language name identifying the structure
2091   *         definition. This name should be usable as an identifier for the
2092   *         module by machine processing applications such as code generation.).
2093   *         This is the underlying object with id, value and extensions. The
2094   *         accessor "getName" gives direct access to the value
2095   */
2096  public StringType getNameElement() {
2097    if (this.name == null)
2098      if (Configuration.errorOnAutoCreate())
2099        throw new Error("Attempt to auto-create StructureDefinition.name");
2100      else if (Configuration.doAutoCreate())
2101        this.name = new StringType(); // bb
2102    return this.name;
2103  }
2104
2105  public boolean hasNameElement() {
2106    return this.name != null && !this.name.isEmpty();
2107  }
2108
2109  public boolean hasName() {
2110    return this.name != null && !this.name.isEmpty();
2111  }
2112
2113  /**
2114   * @param value {@link #name} (A natural language name identifying the structure
2115   *              definition. This name should be usable as an identifier for the
2116   *              module by machine processing applications such as code
2117   *              generation.). This is the underlying object with id, value and
2118   *              extensions. The accessor "getName" gives direct access to the
2119   *              value
2120   */
2121  public StructureDefinition setNameElement(StringType value) {
2122    this.name = value;
2123    return this;
2124  }
2125
2126  /**
2127   * @return A natural language name identifying the structure definition. This
2128   *         name should be usable as an identifier for the module by machine
2129   *         processing applications such as code generation.
2130   */
2131  public String getName() {
2132    return this.name == null ? null : this.name.getValue();
2133  }
2134
2135  /**
2136   * @param value A natural language name identifying the structure definition.
2137   *              This name should be usable as an identifier for the module by
2138   *              machine processing applications such as code generation.
2139   */
2140  public StructureDefinition setName(String value) {
2141    if (this.name == null)
2142      this.name = new StringType();
2143    this.name.setValue(value);
2144    return this;
2145  }
2146
2147  /**
2148   * @return {@link #title} (A short, descriptive, user-friendly title for the
2149   *         structure definition.). This is the underlying object with id, value
2150   *         and extensions. The accessor "getTitle" gives direct access to the
2151   *         value
2152   */
2153  public StringType getTitleElement() {
2154    if (this.title == null)
2155      if (Configuration.errorOnAutoCreate())
2156        throw new Error("Attempt to auto-create StructureDefinition.title");
2157      else if (Configuration.doAutoCreate())
2158        this.title = new StringType(); // bb
2159    return this.title;
2160  }
2161
2162  public boolean hasTitleElement() {
2163    return this.title != null && !this.title.isEmpty();
2164  }
2165
2166  public boolean hasTitle() {
2167    return this.title != null && !this.title.isEmpty();
2168  }
2169
2170  /**
2171   * @param value {@link #title} (A short, descriptive, user-friendly title for
2172   *              the structure definition.). This is the underlying object with
2173   *              id, value and extensions. The accessor "getTitle" gives direct
2174   *              access to the value
2175   */
2176  public StructureDefinition setTitleElement(StringType value) {
2177    this.title = value;
2178    return this;
2179  }
2180
2181  /**
2182   * @return A short, descriptive, user-friendly title for the structure
2183   *         definition.
2184   */
2185  public String getTitle() {
2186    return this.title == null ? null : this.title.getValue();
2187  }
2188
2189  /**
2190   * @param value A short, descriptive, user-friendly title for the structure
2191   *              definition.
2192   */
2193  public StructureDefinition setTitle(String value) {
2194    if (Utilities.noString(value))
2195      this.title = null;
2196    else {
2197      if (this.title == null)
2198        this.title = new StringType();
2199      this.title.setValue(value);
2200    }
2201    return this;
2202  }
2203
2204  /**
2205   * @return {@link #status} (The status of this structure definition. Enables
2206   *         tracking the life-cycle of the content.). This is the underlying
2207   *         object with id, value and extensions. The accessor "getStatus" gives
2208   *         direct access to the value
2209   */
2210  public Enumeration<PublicationStatus> getStatusElement() {
2211    if (this.status == null)
2212      if (Configuration.errorOnAutoCreate())
2213        throw new Error("Attempt to auto-create StructureDefinition.status");
2214      else if (Configuration.doAutoCreate())
2215        this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2216    return this.status;
2217  }
2218
2219  public boolean hasStatusElement() {
2220    return this.status != null && !this.status.isEmpty();
2221  }
2222
2223  public boolean hasStatus() {
2224    return this.status != null && !this.status.isEmpty();
2225  }
2226
2227  /**
2228   * @param value {@link #status} (The status of this structure definition.
2229   *              Enables tracking the life-cycle of the content.). This is the
2230   *              underlying object with id, value and extensions. The accessor
2231   *              "getStatus" gives direct access to the value
2232   */
2233  public StructureDefinition setStatusElement(Enumeration<PublicationStatus> value) {
2234    this.status = value;
2235    return this;
2236  }
2237
2238  /**
2239   * @return The status of this structure definition. Enables tracking the
2240   *         life-cycle of the content.
2241   */
2242  public PublicationStatus getStatus() {
2243    return this.status == null ? null : this.status.getValue();
2244  }
2245
2246  /**
2247   * @param value The status of this structure definition. Enables tracking the
2248   *              life-cycle of the content.
2249   */
2250  public StructureDefinition setStatus(PublicationStatus value) {
2251    if (this.status == null)
2252      this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2253    this.status.setValue(value);
2254    return this;
2255  }
2256
2257  /**
2258   * @return {@link #experimental} (A Boolean value to indicate that this
2259   *         structure definition is authored for testing purposes (or
2260   *         education/evaluation/marketing) and is not intended to be used for
2261   *         genuine usage.). This is the underlying object with id, value and
2262   *         extensions. The accessor "getExperimental" gives direct access to the
2263   *         value
2264   */
2265  public BooleanType getExperimentalElement() {
2266    if (this.experimental == null)
2267      if (Configuration.errorOnAutoCreate())
2268        throw new Error("Attempt to auto-create StructureDefinition.experimental");
2269      else if (Configuration.doAutoCreate())
2270        this.experimental = new BooleanType(); // bb
2271    return this.experimental;
2272  }
2273
2274  public boolean hasExperimentalElement() {
2275    return this.experimental != null && !this.experimental.isEmpty();
2276  }
2277
2278  public boolean hasExperimental() {
2279    return this.experimental != null && !this.experimental.isEmpty();
2280  }
2281
2282  /**
2283   * @param value {@link #experimental} (A Boolean value to indicate that this
2284   *              structure definition is authored for testing purposes (or
2285   *              education/evaluation/marketing) and is not intended to be used
2286   *              for genuine usage.). This is the underlying object with id,
2287   *              value and extensions. The accessor "getExperimental" gives
2288   *              direct access to the value
2289   */
2290  public StructureDefinition setExperimentalElement(BooleanType value) {
2291    this.experimental = value;
2292    return this;
2293  }
2294
2295  /**
2296   * @return A Boolean value to indicate that this structure definition is
2297   *         authored for testing purposes (or education/evaluation/marketing) and
2298   *         is not intended to be used for genuine usage.
2299   */
2300  public boolean getExperimental() {
2301    return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2302  }
2303
2304  /**
2305   * @param value A Boolean value to indicate that this structure definition is
2306   *              authored for testing purposes (or
2307   *              education/evaluation/marketing) and is not intended to be used
2308   *              for genuine usage.
2309   */
2310  public StructureDefinition setExperimental(boolean value) {
2311    if (this.experimental == null)
2312      this.experimental = new BooleanType();
2313    this.experimental.setValue(value);
2314    return this;
2315  }
2316
2317  /**
2318   * @return {@link #date} (The date (and optionally time) when the structure
2319   *         definition was published. The date must change when the business
2320   *         version changes and it must change if the status code changes. In
2321   *         addition, it should change when the substantive content of the
2322   *         structure definition changes.). This is the underlying object with
2323   *         id, value and extensions. The accessor "getDate" gives direct access
2324   *         to the value
2325   */
2326  public DateTimeType getDateElement() {
2327    if (this.date == null)
2328      if (Configuration.errorOnAutoCreate())
2329        throw new Error("Attempt to auto-create StructureDefinition.date");
2330      else if (Configuration.doAutoCreate())
2331        this.date = new DateTimeType(); // bb
2332    return this.date;
2333  }
2334
2335  public boolean hasDateElement() {
2336    return this.date != null && !this.date.isEmpty();
2337  }
2338
2339  public boolean hasDate() {
2340    return this.date != null && !this.date.isEmpty();
2341  }
2342
2343  /**
2344   * @param value {@link #date} (The date (and optionally time) when the structure
2345   *              definition was published. The date must change when the business
2346   *              version changes and it must change if the status code changes.
2347   *              In addition, it should change when the substantive content of
2348   *              the structure definition changes.). This is the underlying
2349   *              object with id, value and extensions. The accessor "getDate"
2350   *              gives direct access to the value
2351   */
2352  public StructureDefinition setDateElement(DateTimeType value) {
2353    this.date = value;
2354    return this;
2355  }
2356
2357  /**
2358   * @return The date (and optionally time) when the structure definition was
2359   *         published. The date must change when the business version changes and
2360   *         it must change if the status code changes. In addition, it should
2361   *         change when the substantive content of the structure definition
2362   *         changes.
2363   */
2364  public Date getDate() {
2365    return this.date == null ? null : this.date.getValue();
2366  }
2367
2368  /**
2369   * @param value The date (and optionally time) when the structure definition was
2370   *              published. The date must change when the business version
2371   *              changes and it must change if the status code changes. In
2372   *              addition, it should change when the substantive content of the
2373   *              structure definition changes.
2374   */
2375  public StructureDefinition setDate(Date value) {
2376    if (value == null)
2377      this.date = null;
2378    else {
2379      if (this.date == null)
2380        this.date = new DateTimeType();
2381      this.date.setValue(value);
2382    }
2383    return this;
2384  }
2385
2386  /**
2387   * @return {@link #publisher} (The name of the organization or individual that
2388   *         published the structure definition.). This is the underlying object
2389   *         with id, value and extensions. The accessor "getPublisher" gives
2390   *         direct access to the value
2391   */
2392  public StringType getPublisherElement() {
2393    if (this.publisher == null)
2394      if (Configuration.errorOnAutoCreate())
2395        throw new Error("Attempt to auto-create StructureDefinition.publisher");
2396      else if (Configuration.doAutoCreate())
2397        this.publisher = new StringType(); // bb
2398    return this.publisher;
2399  }
2400
2401  public boolean hasPublisherElement() {
2402    return this.publisher != null && !this.publisher.isEmpty();
2403  }
2404
2405  public boolean hasPublisher() {
2406    return this.publisher != null && !this.publisher.isEmpty();
2407  }
2408
2409  /**
2410   * @param value {@link #publisher} (The name of the organization or individual
2411   *              that published the structure definition.). This is the
2412   *              underlying object with id, value and extensions. The accessor
2413   *              "getPublisher" gives direct access to the value
2414   */
2415  public StructureDefinition setPublisherElement(StringType value) {
2416    this.publisher = value;
2417    return this;
2418  }
2419
2420  /**
2421   * @return The name of the organization or individual that published the
2422   *         structure definition.
2423   */
2424  public String getPublisher() {
2425    return this.publisher == null ? null : this.publisher.getValue();
2426  }
2427
2428  /**
2429   * @param value The name of the organization or individual that published the
2430   *              structure definition.
2431   */
2432  public StructureDefinition setPublisher(String value) {
2433    if (Utilities.noString(value))
2434      this.publisher = null;
2435    else {
2436      if (this.publisher == null)
2437        this.publisher = new StringType();
2438      this.publisher.setValue(value);
2439    }
2440    return this;
2441  }
2442
2443  /**
2444   * @return {@link #contact} (Contact details to assist a user in finding and
2445   *         communicating with the publisher.)
2446   */
2447  public List<ContactDetail> getContact() {
2448    if (this.contact == null)
2449      this.contact = new ArrayList<ContactDetail>();
2450    return this.contact;
2451  }
2452
2453  /**
2454   * @return Returns a reference to <code>this</code> for easy method chaining
2455   */
2456  public StructureDefinition setContact(List<ContactDetail> theContact) {
2457    this.contact = theContact;
2458    return this;
2459  }
2460
2461  public boolean hasContact() {
2462    if (this.contact == null)
2463      return false;
2464    for (ContactDetail item : this.contact)
2465      if (!item.isEmpty())
2466        return true;
2467    return false;
2468  }
2469
2470  public ContactDetail addContact() { // 3
2471    ContactDetail t = new ContactDetail();
2472    if (this.contact == null)
2473      this.contact = new ArrayList<ContactDetail>();
2474    this.contact.add(t);
2475    return t;
2476  }
2477
2478  public StructureDefinition addContact(ContactDetail t) { // 3
2479    if (t == null)
2480      return this;
2481    if (this.contact == null)
2482      this.contact = new ArrayList<ContactDetail>();
2483    this.contact.add(t);
2484    return this;
2485  }
2486
2487  /**
2488   * @return The first repetition of repeating field {@link #contact}, creating it
2489   *         if it does not already exist
2490   */
2491  public ContactDetail getContactFirstRep() {
2492    if (getContact().isEmpty()) {
2493      addContact();
2494    }
2495    return getContact().get(0);
2496  }
2497
2498  /**
2499   * @return {@link #description} (A free text natural language description of the
2500   *         structure definition from a consumer's perspective.). This is the
2501   *         underlying object with id, value and extensions. The accessor
2502   *         "getDescription" gives direct access to the value
2503   */
2504  public MarkdownType getDescriptionElement() {
2505    if (this.description == null)
2506      if (Configuration.errorOnAutoCreate())
2507        throw new Error("Attempt to auto-create StructureDefinition.description");
2508      else if (Configuration.doAutoCreate())
2509        this.description = new MarkdownType(); // bb
2510    return this.description;
2511  }
2512
2513  public boolean hasDescriptionElement() {
2514    return this.description != null && !this.description.isEmpty();
2515  }
2516
2517  public boolean hasDescription() {
2518    return this.description != null && !this.description.isEmpty();
2519  }
2520
2521  /**
2522   * @param value {@link #description} (A free text natural language description
2523   *              of the structure definition from a consumer's perspective.).
2524   *              This is the underlying object with id, value and extensions. The
2525   *              accessor "getDescription" gives direct access to the value
2526   */
2527  public StructureDefinition setDescriptionElement(MarkdownType value) {
2528    this.description = value;
2529    return this;
2530  }
2531
2532  /**
2533   * @return A free text natural language description of the structure definition
2534   *         from a consumer's perspective.
2535   */
2536  public String getDescription() {
2537    return this.description == null ? null : this.description.getValue();
2538  }
2539
2540  /**
2541   * @param value A free text natural language description of the structure
2542   *              definition from a consumer's perspective.
2543   */
2544  public StructureDefinition setDescription(String value) {
2545    if (value == null)
2546      this.description = null;
2547    else {
2548      if (this.description == null)
2549        this.description = new MarkdownType();
2550      this.description.setValue(value);
2551    }
2552    return this;
2553  }
2554
2555  /**
2556   * @return {@link #useContext} (The content was developed with a focus and
2557   *         intent of supporting the contexts that are listed. These contexts may
2558   *         be general categories (gender, age, ...) or may be references to
2559   *         specific programs (insurance plans, studies, ...) and may be used to
2560   *         assist with indexing and searching for appropriate structure
2561   *         definition instances.)
2562   */
2563  public List<UsageContext> getUseContext() {
2564    if (this.useContext == null)
2565      this.useContext = new ArrayList<UsageContext>();
2566    return this.useContext;
2567  }
2568
2569  /**
2570   * @return Returns a reference to <code>this</code> for easy method chaining
2571   */
2572  public StructureDefinition setUseContext(List<UsageContext> theUseContext) {
2573    this.useContext = theUseContext;
2574    return this;
2575  }
2576
2577  public boolean hasUseContext() {
2578    if (this.useContext == null)
2579      return false;
2580    for (UsageContext item : this.useContext)
2581      if (!item.isEmpty())
2582        return true;
2583    return false;
2584  }
2585
2586  public UsageContext addUseContext() { // 3
2587    UsageContext t = new UsageContext();
2588    if (this.useContext == null)
2589      this.useContext = new ArrayList<UsageContext>();
2590    this.useContext.add(t);
2591    return t;
2592  }
2593
2594  public StructureDefinition addUseContext(UsageContext t) { // 3
2595    if (t == null)
2596      return this;
2597    if (this.useContext == null)
2598      this.useContext = new ArrayList<UsageContext>();
2599    this.useContext.add(t);
2600    return this;
2601  }
2602
2603  /**
2604   * @return The first repetition of repeating field {@link #useContext}, creating
2605   *         it if it does not already exist
2606   */
2607  public UsageContext getUseContextFirstRep() {
2608    if (getUseContext().isEmpty()) {
2609      addUseContext();
2610    }
2611    return getUseContext().get(0);
2612  }
2613
2614  /**
2615   * @return {@link #jurisdiction} (A legal or geographic region in which the
2616   *         structure definition is intended to be used.)
2617   */
2618  public List<CodeableConcept> getJurisdiction() {
2619    if (this.jurisdiction == null)
2620      this.jurisdiction = new ArrayList<CodeableConcept>();
2621    return this.jurisdiction;
2622  }
2623
2624  /**
2625   * @return Returns a reference to <code>this</code> for easy method chaining
2626   */
2627  public StructureDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) {
2628    this.jurisdiction = theJurisdiction;
2629    return this;
2630  }
2631
2632  public boolean hasJurisdiction() {
2633    if (this.jurisdiction == null)
2634      return false;
2635    for (CodeableConcept item : this.jurisdiction)
2636      if (!item.isEmpty())
2637        return true;
2638    return false;
2639  }
2640
2641  public CodeableConcept addJurisdiction() { // 3
2642    CodeableConcept t = new CodeableConcept();
2643    if (this.jurisdiction == null)
2644      this.jurisdiction = new ArrayList<CodeableConcept>();
2645    this.jurisdiction.add(t);
2646    return t;
2647  }
2648
2649  public StructureDefinition addJurisdiction(CodeableConcept t) { // 3
2650    if (t == null)
2651      return this;
2652    if (this.jurisdiction == null)
2653      this.jurisdiction = new ArrayList<CodeableConcept>();
2654    this.jurisdiction.add(t);
2655    return this;
2656  }
2657
2658  /**
2659   * @return The first repetition of repeating field {@link #jurisdiction},
2660   *         creating it if it does not already exist
2661   */
2662  public CodeableConcept getJurisdictionFirstRep() {
2663    if (getJurisdiction().isEmpty()) {
2664      addJurisdiction();
2665    }
2666    return getJurisdiction().get(0);
2667  }
2668
2669  /**
2670   * @return {@link #purpose} (Explanation of why this structure definition is
2671   *         needed and why it has been designed as it has.). This is the
2672   *         underlying object with id, value and extensions. The accessor
2673   *         "getPurpose" gives direct access to the value
2674   */
2675  public MarkdownType getPurposeElement() {
2676    if (this.purpose == null)
2677      if (Configuration.errorOnAutoCreate())
2678        throw new Error("Attempt to auto-create StructureDefinition.purpose");
2679      else if (Configuration.doAutoCreate())
2680        this.purpose = new MarkdownType(); // bb
2681    return this.purpose;
2682  }
2683
2684  public boolean hasPurposeElement() {
2685    return this.purpose != null && !this.purpose.isEmpty();
2686  }
2687
2688  public boolean hasPurpose() {
2689    return this.purpose != null && !this.purpose.isEmpty();
2690  }
2691
2692  /**
2693   * @param value {@link #purpose} (Explanation of why this structure definition
2694   *              is needed and why it has been designed as it has.). This is the
2695   *              underlying object with id, value and extensions. The accessor
2696   *              "getPurpose" gives direct access to the value
2697   */
2698  public StructureDefinition setPurposeElement(MarkdownType value) {
2699    this.purpose = value;
2700    return this;
2701  }
2702
2703  /**
2704   * @return Explanation of why this structure definition is needed and why it has
2705   *         been designed as it has.
2706   */
2707  public String getPurpose() {
2708    return this.purpose == null ? null : this.purpose.getValue();
2709  }
2710
2711  /**
2712   * @param value Explanation of why this structure definition is needed and why
2713   *              it has been designed as it has.
2714   */
2715  public StructureDefinition setPurpose(String value) {
2716    if (value == null)
2717      this.purpose = null;
2718    else {
2719      if (this.purpose == null)
2720        this.purpose = new MarkdownType();
2721      this.purpose.setValue(value);
2722    }
2723    return this;
2724  }
2725
2726  /**
2727   * @return {@link #copyright} (A copyright statement relating to the structure
2728   *         definition and/or its contents. Copyright statements are generally
2729   *         legal restrictions on the use and publishing of the structure
2730   *         definition.). This is the underlying object with id, value and
2731   *         extensions. The accessor "getCopyright" gives direct access to the
2732   *         value
2733   */
2734  public MarkdownType getCopyrightElement() {
2735    if (this.copyright == null)
2736      if (Configuration.errorOnAutoCreate())
2737        throw new Error("Attempt to auto-create StructureDefinition.copyright");
2738      else if (Configuration.doAutoCreate())
2739        this.copyright = new MarkdownType(); // bb
2740    return this.copyright;
2741  }
2742
2743  public boolean hasCopyrightElement() {
2744    return this.copyright != null && !this.copyright.isEmpty();
2745  }
2746
2747  public boolean hasCopyright() {
2748    return this.copyright != null && !this.copyright.isEmpty();
2749  }
2750
2751  /**
2752   * @param value {@link #copyright} (A copyright statement relating to the
2753   *              structure definition and/or its contents. Copyright statements
2754   *              are generally legal restrictions on the use and publishing of
2755   *              the structure definition.). This is the underlying object with
2756   *              id, value and extensions. The accessor "getCopyright" gives
2757   *              direct access to the value
2758   */
2759  public StructureDefinition setCopyrightElement(MarkdownType value) {
2760    this.copyright = value;
2761    return this;
2762  }
2763
2764  /**
2765   * @return A copyright statement relating to the structure definition and/or its
2766   *         contents. Copyright statements are generally legal restrictions on
2767   *         the use and publishing of the structure definition.
2768   */
2769  public String getCopyright() {
2770    return this.copyright == null ? null : this.copyright.getValue();
2771  }
2772
2773  /**
2774   * @param value A copyright statement relating to the structure definition
2775   *              and/or its contents. Copyright statements are generally legal
2776   *              restrictions on the use and publishing of the structure
2777   *              definition.
2778   */
2779  public StructureDefinition setCopyright(String value) {
2780    if (value == null)
2781      this.copyright = null;
2782    else {
2783      if (this.copyright == null)
2784        this.copyright = new MarkdownType();
2785      this.copyright.setValue(value);
2786    }
2787    return this;
2788  }
2789
2790  /**
2791   * @return {@link #keyword} (A set of key words or terms from external
2792   *         terminologies that may be used to assist with indexing and searching
2793   *         of templates nby describing the use of this structure definition, or
2794   *         the content it describes.)
2795   */
2796  public List<Coding> getKeyword() {
2797    if (this.keyword == null)
2798      this.keyword = new ArrayList<Coding>();
2799    return this.keyword;
2800  }
2801
2802  /**
2803   * @return Returns a reference to <code>this</code> for easy method chaining
2804   */
2805  public StructureDefinition setKeyword(List<Coding> theKeyword) {
2806    this.keyword = theKeyword;
2807    return this;
2808  }
2809
2810  public boolean hasKeyword() {
2811    if (this.keyword == null)
2812      return false;
2813    for (Coding item : this.keyword)
2814      if (!item.isEmpty())
2815        return true;
2816    return false;
2817  }
2818
2819  public Coding addKeyword() { // 3
2820    Coding t = new Coding();
2821    if (this.keyword == null)
2822      this.keyword = new ArrayList<Coding>();
2823    this.keyword.add(t);
2824    return t;
2825  }
2826
2827  public StructureDefinition addKeyword(Coding t) { // 3
2828    if (t == null)
2829      return this;
2830    if (this.keyword == null)
2831      this.keyword = new ArrayList<Coding>();
2832    this.keyword.add(t);
2833    return this;
2834  }
2835
2836  /**
2837   * @return The first repetition of repeating field {@link #keyword}, creating it
2838   *         if it does not already exist
2839   */
2840  public Coding getKeywordFirstRep() {
2841    if (getKeyword().isEmpty()) {
2842      addKeyword();
2843    }
2844    return getKeyword().get(0);
2845  }
2846
2847  /**
2848   * @return {@link #fhirVersion} (The version of the FHIR specification on which
2849   *         this StructureDefinition is based - this is the formal version of the
2850   *         specification, without the revision number, e.g.
2851   *         [publication].[major].[minor], which is 4.0.1. for this version.).
2852   *         This is the underlying object with id, value and extensions. The
2853   *         accessor "getFhirVersion" gives direct access to the value
2854   */
2855  public Enumeration<FHIRVersion> getFhirVersionElement() {
2856    if (this.fhirVersion == null)
2857      if (Configuration.errorOnAutoCreate())
2858        throw new Error("Attempt to auto-create StructureDefinition.fhirVersion");
2859      else if (Configuration.doAutoCreate())
2860        this.fhirVersion = new Enumeration<FHIRVersion>(new FHIRVersionEnumFactory()); // bb
2861    return this.fhirVersion;
2862  }
2863
2864  public boolean hasFhirVersionElement() {
2865    return this.fhirVersion != null && !this.fhirVersion.isEmpty();
2866  }
2867
2868  public boolean hasFhirVersion() {
2869    return this.fhirVersion != null && !this.fhirVersion.isEmpty();
2870  }
2871
2872  /**
2873   * @param value {@link #fhirVersion} (The version of the FHIR specification on
2874   *              which this StructureDefinition is based - this is the formal
2875   *              version of the specification, without the revision number, e.g.
2876   *              [publication].[major].[minor], which is 4.0.1. for this
2877   *              version.). This is the underlying object with id, value and
2878   *              extensions. The accessor "getFhirVersion" gives direct access to
2879   *              the value
2880   */
2881  public StructureDefinition setFhirVersionElement(Enumeration<FHIRVersion> value) {
2882    this.fhirVersion = value;
2883    return this;
2884  }
2885
2886  /**
2887   * @return The version of the FHIR specification on which this
2888   *         StructureDefinition is based - this is the formal version of the
2889   *         specification, without the revision number, e.g.
2890   *         [publication].[major].[minor], which is 4.0.1. for this version.
2891   */
2892  public FHIRVersion getFhirVersion() {
2893    return this.fhirVersion == null ? null : this.fhirVersion.getValue();
2894  }
2895
2896  /**
2897   * @param value The version of the FHIR specification on which this
2898   *              StructureDefinition is based - this is the formal version of the
2899   *              specification, without the revision number, e.g.
2900   *              [publication].[major].[minor], which is 4.0.1. for this version.
2901   */
2902  public StructureDefinition setFhirVersion(FHIRVersion value) {
2903    if (value == null)
2904      this.fhirVersion = null;
2905    else {
2906      if (this.fhirVersion == null)
2907        this.fhirVersion = new Enumeration<FHIRVersion>(new FHIRVersionEnumFactory());
2908      this.fhirVersion.setValue(value);
2909    }
2910    return this;
2911  }
2912
2913  /**
2914   * @return {@link #mapping} (An external specification that the content is
2915   *         mapped to.)
2916   */
2917  public List<StructureDefinitionMappingComponent> getMapping() {
2918    if (this.mapping == null)
2919      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2920    return this.mapping;
2921  }
2922
2923  /**
2924   * @return Returns a reference to <code>this</code> for easy method chaining
2925   */
2926  public StructureDefinition setMapping(List<StructureDefinitionMappingComponent> theMapping) {
2927    this.mapping = theMapping;
2928    return this;
2929  }
2930
2931  public boolean hasMapping() {
2932    if (this.mapping == null)
2933      return false;
2934    for (StructureDefinitionMappingComponent item : this.mapping)
2935      if (!item.isEmpty())
2936        return true;
2937    return false;
2938  }
2939
2940  public StructureDefinitionMappingComponent addMapping() { // 3
2941    StructureDefinitionMappingComponent t = new StructureDefinitionMappingComponent();
2942    if (this.mapping == null)
2943      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2944    this.mapping.add(t);
2945    return t;
2946  }
2947
2948  public StructureDefinition addMapping(StructureDefinitionMappingComponent t) { // 3
2949    if (t == null)
2950      return this;
2951    if (this.mapping == null)
2952      this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2953    this.mapping.add(t);
2954    return this;
2955  }
2956
2957  /**
2958   * @return The first repetition of repeating field {@link #mapping}, creating it
2959   *         if it does not already exist
2960   */
2961  public StructureDefinitionMappingComponent getMappingFirstRep() {
2962    if (getMapping().isEmpty()) {
2963      addMapping();
2964    }
2965    return getMapping().get(0);
2966  }
2967
2968  /**
2969   * @return {@link #kind} (Defines the kind of structure that this definition is
2970   *         describing.). This is the underlying object with id, value and
2971   *         extensions. The accessor "getKind" gives direct access to the value
2972   */
2973  public Enumeration<StructureDefinitionKind> getKindElement() {
2974    if (this.kind == null)
2975      if (Configuration.errorOnAutoCreate())
2976        throw new Error("Attempt to auto-create StructureDefinition.kind");
2977      else if (Configuration.doAutoCreate())
2978        this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory()); // bb
2979    return this.kind;
2980  }
2981
2982  public boolean hasKindElement() {
2983    return this.kind != null && !this.kind.isEmpty();
2984  }
2985
2986  public boolean hasKind() {
2987    return this.kind != null && !this.kind.isEmpty();
2988  }
2989
2990  /**
2991   * @param value {@link #kind} (Defines the kind of structure that this
2992   *              definition is describing.). This is the underlying object with
2993   *              id, value and extensions. The accessor "getKind" gives direct
2994   *              access to the value
2995   */
2996  public StructureDefinition setKindElement(Enumeration<StructureDefinitionKind> value) {
2997    this.kind = value;
2998    return this;
2999  }
3000
3001  /**
3002   * @return Defines the kind of structure that this definition is describing.
3003   */
3004  public StructureDefinitionKind getKind() {
3005    return this.kind == null ? null : this.kind.getValue();
3006  }
3007
3008  /**
3009   * @param value Defines the kind of structure that this definition is
3010   *              describing.
3011   */
3012  public StructureDefinition setKind(StructureDefinitionKind value) {
3013    if (this.kind == null)
3014      this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory());
3015    this.kind.setValue(value);
3016    return this;
3017  }
3018
3019  /**
3020   * @return {@link #abstract_} (Whether structure this definition describes is
3021   *         abstract or not - that is, whether the structure is not intended to
3022   *         be instantiated. For Resources and Data types, abstract types will
3023   *         never be exchanged between systems.). This is the underlying object
3024   *         with id, value and extensions. The accessor "getAbstract" gives
3025   *         direct access to the value
3026   */
3027  public BooleanType getAbstractElement() {
3028    if (this.abstract_ == null)
3029      if (Configuration.errorOnAutoCreate())
3030        throw new Error("Attempt to auto-create StructureDefinition.abstract_");
3031      else if (Configuration.doAutoCreate())
3032        this.abstract_ = new BooleanType(); // bb
3033    return this.abstract_;
3034  }
3035
3036  public boolean hasAbstractElement() {
3037    return this.abstract_ != null && !this.abstract_.isEmpty();
3038  }
3039
3040  public boolean hasAbstract() {
3041    return this.abstract_ != null && !this.abstract_.isEmpty();
3042  }
3043
3044  /**
3045   * @param value {@link #abstract_} (Whether structure this definition describes
3046   *              is abstract or not - that is, whether the structure is not
3047   *              intended to be instantiated. For Resources and Data types,
3048   *              abstract types will never be exchanged between systems.). This
3049   *              is the underlying object with id, value and extensions. The
3050   *              accessor "getAbstract" gives direct access to the value
3051   */
3052  public StructureDefinition setAbstractElement(BooleanType value) {
3053    this.abstract_ = value;
3054    return this;
3055  }
3056
3057  /**
3058   * @return Whether structure this definition describes is abstract or not - that
3059   *         is, whether the structure is not intended to be instantiated. For
3060   *         Resources and Data types, abstract types will never be exchanged
3061   *         between systems.
3062   */
3063  public boolean getAbstract() {
3064    return this.abstract_ == null || this.abstract_.isEmpty() ? false : this.abstract_.getValue();
3065  }
3066
3067  /**
3068   * @param value Whether structure this definition describes is abstract or not -
3069   *              that is, whether the structure is not intended to be
3070   *              instantiated. For Resources and Data types, abstract types will
3071   *              never be exchanged between systems.
3072   */
3073  public StructureDefinition setAbstract(boolean value) {
3074    if (this.abstract_ == null)
3075      this.abstract_ = new BooleanType();
3076    this.abstract_.setValue(value);
3077    return this;
3078  }
3079
3080  /**
3081   * @return {@link #context} (Identifies the types of resource or data type
3082   *         elements to which the extension can be applied.)
3083   */
3084  public List<StructureDefinitionContextComponent> getContext() {
3085    if (this.context == null)
3086      this.context = new ArrayList<StructureDefinitionContextComponent>();
3087    return this.context;
3088  }
3089
3090  /**
3091   * @return Returns a reference to <code>this</code> for easy method chaining
3092   */
3093  public StructureDefinition setContext(List<StructureDefinitionContextComponent> theContext) {
3094    this.context = theContext;
3095    return this;
3096  }
3097
3098  public boolean hasContext() {
3099    if (this.context == null)
3100      return false;
3101    for (StructureDefinitionContextComponent item : this.context)
3102      if (!item.isEmpty())
3103        return true;
3104    return false;
3105  }
3106
3107  public StructureDefinitionContextComponent addContext() { // 3
3108    StructureDefinitionContextComponent t = new StructureDefinitionContextComponent();
3109    if (this.context == null)
3110      this.context = new ArrayList<StructureDefinitionContextComponent>();
3111    this.context.add(t);
3112    return t;
3113  }
3114
3115  public StructureDefinition addContext(StructureDefinitionContextComponent t) { // 3
3116    if (t == null)
3117      return this;
3118    if (this.context == null)
3119      this.context = new ArrayList<StructureDefinitionContextComponent>();
3120    this.context.add(t);
3121    return this;
3122  }
3123
3124  /**
3125   * @return The first repetition of repeating field {@link #context}, creating it
3126   *         if it does not already exist
3127   */
3128  public StructureDefinitionContextComponent getContextFirstRep() {
3129    if (getContext().isEmpty()) {
3130      addContext();
3131    }
3132    return getContext().get(0);
3133  }
3134
3135  /**
3136   * @return {@link #contextInvariant} (A set of rules as FHIRPath Invariants
3137   *         about when the extension can be used (e.g. co-occurrence variants for
3138   *         the extension). All the rules must be true.)
3139   */
3140  public List<StringType> getContextInvariant() {
3141    if (this.contextInvariant == null)
3142      this.contextInvariant = new ArrayList<StringType>();
3143    return this.contextInvariant;
3144  }
3145
3146  /**
3147   * @return Returns a reference to <code>this</code> for easy method chaining
3148   */
3149  public StructureDefinition setContextInvariant(List<StringType> theContextInvariant) {
3150    this.contextInvariant = theContextInvariant;
3151    return this;
3152  }
3153
3154  public boolean hasContextInvariant() {
3155    if (this.contextInvariant == null)
3156      return false;
3157    for (StringType item : this.contextInvariant)
3158      if (!item.isEmpty())
3159        return true;
3160    return false;
3161  }
3162
3163  /**
3164   * @return {@link #contextInvariant} (A set of rules as FHIRPath Invariants
3165   *         about when the extension can be used (e.g. co-occurrence variants for
3166   *         the extension). All the rules must be true.)
3167   */
3168  public StringType addContextInvariantElement() {// 2
3169    StringType t = new StringType();
3170    if (this.contextInvariant == null)
3171      this.contextInvariant = new ArrayList<StringType>();
3172    this.contextInvariant.add(t);
3173    return t;
3174  }
3175
3176  /**
3177   * @param value {@link #contextInvariant} (A set of rules as FHIRPath Invariants
3178   *              about when the extension can be used (e.g. co-occurrence
3179   *              variants for the extension). All the rules must be true.)
3180   */
3181  public StructureDefinition addContextInvariant(String value) { // 1
3182    StringType t = new StringType();
3183    t.setValue(value);
3184    if (this.contextInvariant == null)
3185      this.contextInvariant = new ArrayList<StringType>();
3186    this.contextInvariant.add(t);
3187    return this;
3188  }
3189
3190  /**
3191   * @param value {@link #contextInvariant} (A set of rules as FHIRPath Invariants
3192   *              about when the extension can be used (e.g. co-occurrence
3193   *              variants for the extension). All the rules must be true.)
3194   */
3195  public boolean hasContextInvariant(String value) {
3196    if (this.contextInvariant == null)
3197      return false;
3198    for (StringType v : this.contextInvariant)
3199      if (v.getValue().equals(value)) // string
3200        return true;
3201    return false;
3202  }
3203
3204  /**
3205   * @return {@link #type} (The type this structure describes. If the derivation
3206   *         kind is 'specialization' then this is the master definition for a
3207   *         type, and there is always one of these (a data type, an extension, a
3208   *         resource, including abstract ones). Otherwise the structure
3209   *         definition is a constraint on the stated type (and in this case, the
3210   *         type cannot be an abstract type). References are URLs that are
3211   *         relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is
3212   *         a reference to http://hl7.org/fhir/StructureDefinition/string.
3213   *         Absolute URLs are only allowed in logical models.). This is the
3214   *         underlying object with id, value and extensions. The accessor
3215   *         "getType" gives direct access to the value
3216   */
3217  public UriType getTypeElement() {
3218    if (this.type == null)
3219      if (Configuration.errorOnAutoCreate())
3220        throw new Error("Attempt to auto-create StructureDefinition.type");
3221      else if (Configuration.doAutoCreate())
3222        this.type = new UriType(); // bb
3223    return this.type;
3224  }
3225
3226  public boolean hasTypeElement() {
3227    return this.type != null && !this.type.isEmpty();
3228  }
3229
3230  public boolean hasType() {
3231    return this.type != null && !this.type.isEmpty();
3232  }
3233
3234  /**
3235   * @param value {@link #type} (The type this structure describes. If the
3236   *              derivation kind is 'specialization' then this is the master
3237   *              definition for a type, and there is always one of these (a data
3238   *              type, an extension, a resource, including abstract ones).
3239   *              Otherwise the structure definition is a constraint on the stated
3240   *              type (and in this case, the type cannot be an abstract type).
3241   *              References are URLs that are relative to
3242   *              http://hl7.org/fhir/StructureDefinition e.g. "string" is a
3243   *              reference to http://hl7.org/fhir/StructureDefinition/string.
3244   *              Absolute URLs are only allowed in logical models.). This is the
3245   *              underlying object with id, value and extensions. The accessor
3246   *              "getType" gives direct access to the value
3247   */
3248  public StructureDefinition setTypeElement(UriType value) {
3249    this.type = value;
3250    return this;
3251  }
3252
3253  /**
3254   * @return The type this structure describes. If the derivation kind is
3255   *         'specialization' then this is the master definition for a type, and
3256   *         there is always one of these (a data type, an extension, a resource,
3257   *         including abstract ones). Otherwise the structure definition is a
3258   *         constraint on the stated type (and in this case, the type cannot be
3259   *         an abstract type). References are URLs that are relative to
3260   *         http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference
3261   *         to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are
3262   *         only allowed in logical models.
3263   */
3264  public String getType() {
3265    return this.type == null ? null : this.type.getValue();
3266  }
3267
3268  /**
3269   * @param value The type this structure describes. If the derivation kind is
3270   *              'specialization' then this is the master definition for a type,
3271   *              and there is always one of these (a data type, an extension, a
3272   *              resource, including abstract ones). Otherwise the structure
3273   *              definition is a constraint on the stated type (and in this case,
3274   *              the type cannot be an abstract type). References are URLs that
3275   *              are relative to http://hl7.org/fhir/StructureDefinition e.g.
3276   *              "string" is a reference to
3277   *              http://hl7.org/fhir/StructureDefinition/string. Absolute URLs
3278   *              are only allowed in logical models.
3279   */
3280  public StructureDefinition setType(String value) {
3281    if (this.type == null)
3282      this.type = new UriType();
3283    this.type.setValue(value);
3284    return this;
3285  }
3286
3287  /**
3288   * @return {@link #baseDefinition} (An absolute URI that is the base structure
3289   *         from which this type is derived, either by specialization or
3290   *         constraint.). This is the underlying object with id, value and
3291   *         extensions. The accessor "getBaseDefinition" gives direct access to
3292   *         the value
3293   */
3294  public CanonicalType getBaseDefinitionElement() {
3295    if (this.baseDefinition == null)
3296      if (Configuration.errorOnAutoCreate())
3297        throw new Error("Attempt to auto-create StructureDefinition.baseDefinition");
3298      else if (Configuration.doAutoCreate())
3299        this.baseDefinition = new CanonicalType(); // bb
3300    return this.baseDefinition;
3301  }
3302
3303  public boolean hasBaseDefinitionElement() {
3304    return this.baseDefinition != null && !this.baseDefinition.isEmpty();
3305  }
3306
3307  public boolean hasBaseDefinition() {
3308    return this.baseDefinition != null && !this.baseDefinition.isEmpty();
3309  }
3310
3311  /**
3312   * @param value {@link #baseDefinition} (An absolute URI that is the base
3313   *              structure from which this type is derived, either by
3314   *              specialization or constraint.). This is the underlying object
3315   *              with id, value and extensions. The accessor "getBaseDefinition"
3316   *              gives direct access to the value
3317   */
3318  public StructureDefinition setBaseDefinitionElement(CanonicalType value) {
3319    this.baseDefinition = value;
3320    return this;
3321  }
3322
3323  /**
3324   * @return An absolute URI that is the base structure from which this type is
3325   *         derived, either by specialization or constraint.
3326   */
3327  public String getBaseDefinition() {
3328    return this.baseDefinition == null ? null : this.baseDefinition.getValue();
3329  }
3330
3331  /**
3332   * @param value An absolute URI that is the base structure from which this type
3333   *              is derived, either by specialization or constraint.
3334   */
3335  public StructureDefinition setBaseDefinition(String value) {
3336    if (Utilities.noString(value))
3337      this.baseDefinition = null;
3338    else {
3339      if (this.baseDefinition == null)
3340        this.baseDefinition = new CanonicalType();
3341      this.baseDefinition.setValue(value);
3342    }
3343    return this;
3344  }
3345
3346  /**
3347   * @return {@link #derivation} (How the type relates to the baseDefinition.).
3348   *         This is the underlying object with id, value and extensions. The
3349   *         accessor "getDerivation" gives direct access to the value
3350   */
3351  public Enumeration<TypeDerivationRule> getDerivationElement() {
3352    if (this.derivation == null)
3353      if (Configuration.errorOnAutoCreate())
3354        throw new Error("Attempt to auto-create StructureDefinition.derivation");
3355      else if (Configuration.doAutoCreate())
3356        this.derivation = new Enumeration<TypeDerivationRule>(new TypeDerivationRuleEnumFactory()); // bb
3357    return this.derivation;
3358  }
3359
3360  public boolean hasDerivationElement() {
3361    return this.derivation != null && !this.derivation.isEmpty();
3362  }
3363
3364  public boolean hasDerivation() {
3365    return this.derivation != null && !this.derivation.isEmpty();
3366  }
3367
3368  /**
3369   * @param value {@link #derivation} (How the type relates to the
3370   *              baseDefinition.). This is the underlying object with id, value
3371   *              and extensions. The accessor "getDerivation" gives direct access
3372   *              to the value
3373   */
3374  public StructureDefinition setDerivationElement(Enumeration<TypeDerivationRule> value) {
3375    this.derivation = value;
3376    return this;
3377  }
3378
3379  /**
3380   * @return How the type relates to the baseDefinition.
3381   */
3382  public TypeDerivationRule getDerivation() {
3383    return this.derivation == null ? null : this.derivation.getValue();
3384  }
3385
3386  /**
3387   * @param value How the type relates to the baseDefinition.
3388   */
3389  public StructureDefinition setDerivation(TypeDerivationRule value) {
3390    if (value == null)
3391      this.derivation = null;
3392    else {
3393      if (this.derivation == null)
3394        this.derivation = new Enumeration<TypeDerivationRule>(new TypeDerivationRuleEnumFactory());
3395      this.derivation.setValue(value);
3396    }
3397    return this;
3398  }
3399
3400  /**
3401   * @return {@link #snapshot} (A snapshot view is expressed in a standalone form
3402   *         that can be used and interpreted without considering the base
3403   *         StructureDefinition.)
3404   */
3405  public StructureDefinitionSnapshotComponent getSnapshot() {
3406    if (this.snapshot == null)
3407      if (Configuration.errorOnAutoCreate())
3408        throw new Error("Attempt to auto-create StructureDefinition.snapshot");
3409      else if (Configuration.doAutoCreate())
3410        this.snapshot = new StructureDefinitionSnapshotComponent(); // cc
3411    return this.snapshot;
3412  }
3413
3414  public boolean hasSnapshot() {
3415    return this.snapshot != null && !this.snapshot.isEmpty();
3416  }
3417
3418  /**
3419   * @param value {@link #snapshot} (A snapshot view is expressed in a standalone
3420   *              form that can be used and interpreted without considering the
3421   *              base StructureDefinition.)
3422   */
3423  public StructureDefinition setSnapshot(StructureDefinitionSnapshotComponent value) {
3424    this.snapshot = value;
3425    return this;
3426  }
3427
3428  /**
3429   * @return {@link #differential} (A differential view is expressed relative to
3430   *         the base StructureDefinition - a statement of differences that it
3431   *         applies.)
3432   */
3433  public StructureDefinitionDifferentialComponent getDifferential() {
3434    if (this.differential == null)
3435      if (Configuration.errorOnAutoCreate())
3436        throw new Error("Attempt to auto-create StructureDefinition.differential");
3437      else if (Configuration.doAutoCreate())
3438        this.differential = new StructureDefinitionDifferentialComponent(); // cc
3439    return this.differential;
3440  }
3441
3442  public boolean hasDifferential() {
3443    return this.differential != null && !this.differential.isEmpty();
3444  }
3445
3446  /**
3447   * @param value {@link #differential} (A differential view is expressed relative
3448   *              to the base StructureDefinition - a statement of differences
3449   *              that it applies.)
3450   */
3451  public StructureDefinition setDifferential(StructureDefinitionDifferentialComponent value) {
3452    this.differential = value;
3453    return this;
3454  }
3455
3456  protected void listChildren(List<Property> children) {
3457    super.listChildren(children);
3458    children.add(new Property("url", "uri",
3459        "An absolute URI that is used to identify this structure definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure definition is stored on different servers.",
3460        0, 1, url));
3461    children.add(new Property("identifier", "Identifier",
3462        "A formal identifier that is used to identify this structure definition when it is represented in other formats, or referenced in a specification, model, design or an instance.",
3463        0, java.lang.Integer.MAX_VALUE, identifier));
3464    children.add(new Property("version", "string",
3465        "The identifier that is used to identify this version of the structure definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.",
3466        0, 1, version));
3467    children.add(new Property("name", "string",
3468        "A natural language name identifying the structure definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
3469        0, 1, name));
3470    children.add(new Property("title", "string",
3471        "A short, descriptive, user-friendly title for the structure definition.", 0, 1, title));
3472    children.add(new Property("status", "code",
3473        "The status of this structure definition. Enables tracking the life-cycle of the content.", 0, 1, status));
3474    children.add(new Property("experimental", "boolean",
3475        "A Boolean value to indicate that this structure definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.",
3476        0, 1, experimental));
3477    children.add(new Property("date", "dateTime",
3478        "The date  (and optionally time) when the structure definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.",
3479        0, 1, date));
3480    children.add(new Property("publisher", "string",
3481        "The name of the organization or individual that published the structure definition.", 0, 1, publisher));
3482    children.add(new Property("contact", "ContactDetail",
3483        "Contact details to assist a user in finding and communicating with the publisher.", 0,
3484        java.lang.Integer.MAX_VALUE, contact));
3485    children.add(new Property("description", "markdown",
3486        "A free text natural language description of the structure definition from a consumer's perspective.", 0, 1,
3487        description));
3488    children.add(new Property("useContext", "UsageContext",
3489        "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate structure definition instances.",
3490        0, java.lang.Integer.MAX_VALUE, useContext));
3491    children.add(new Property("jurisdiction", "CodeableConcept",
3492        "A legal or geographic region in which the structure definition is intended to be used.", 0,
3493        java.lang.Integer.MAX_VALUE, jurisdiction));
3494    children.add(new Property("purpose", "markdown",
3495        "Explanation of why this structure definition is needed and why it has been designed as it has.", 0, 1,
3496        purpose));
3497    children.add(new Property("copyright", "markdown",
3498        "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 structure definition.",
3499        0, 1, copyright));
3500    children.add(new Property("keyword", "Coding",
3501        "A set of key words or terms from external terminologies that may be used to assist with indexing and searching of templates nby describing the use of this structure definition, or the content it describes.",
3502        0, java.lang.Integer.MAX_VALUE, keyword));
3503    children.add(new Property("fhirVersion", "code",
3504        "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 4.0.1. for this version.",
3505        0, 1, fhirVersion));
3506    children.add(new Property("mapping", "", "An external specification that the content is mapped to.", 0,
3507        java.lang.Integer.MAX_VALUE, mapping));
3508    children.add(
3509        new Property("kind", "code", "Defines the kind of structure that this definition is describing.", 0, 1, kind));
3510    children.add(new Property("abstract", "boolean",
3511        "Whether structure this definition describes is abstract or not  - that is, whether the structure is not intended to be instantiated. For Resources and Data types, abstract types will never be exchanged  between systems.",
3512        0, 1, abstract_));
3513    children.add(new Property("context", "",
3514        "Identifies the types of resource or data type elements to which the extension can be applied.", 0,
3515        java.lang.Integer.MAX_VALUE, context));
3516    children.add(new Property("contextInvariant", "string",
3517        "A set of rules as FHIRPath Invariants about when the extension can be used (e.g. co-occurrence variants for the extension). All the rules must be true.",
3518        0, java.lang.Integer.MAX_VALUE, contextInvariant));
3519    children.add(new Property("type", "uri",
3520        "The type this structure describes. If the derivation kind is 'specialization' then this is the master definition for a type, and there is always one of these (a data type, an extension, a resource, including abstract ones). Otherwise the structure definition is a constraint on the stated type (and in this case, the type cannot be an abstract type).  References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.",
3521        0, 1, type));
3522    children.add(new Property("baseDefinition", "canonical(StructureDefinition)",
3523        "An absolute URI that is the base structure from which this type is derived, either by specialization or constraint.",
3524        0, 1, baseDefinition));
3525    children.add(new Property("derivation", "code", "How the type relates to the baseDefinition.", 0, 1, derivation));
3526    children.add(new Property("snapshot", "",
3527        "A snapshot view is expressed in a standalone form that can be used and interpreted without considering the base StructureDefinition.",
3528        0, 1, snapshot));
3529    children.add(new Property("differential", "",
3530        "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.",
3531        0, 1, differential));
3532  }
3533
3534  @Override
3535  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3536    switch (_hash) {
3537    case 116079:
3538      /* url */ return new Property("url", "uri",
3539          "An absolute URI that is used to identify this structure definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which at which an authoritative instance of this structure definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the structure definition is stored on different servers.",
3540          0, 1, url);
3541    case -1618432855:
3542      /* identifier */ return new Property("identifier", "Identifier",
3543          "A formal identifier that is used to identify this structure definition when it is represented in other formats, or referenced in a specification, model, design or an instance.",
3544          0, java.lang.Integer.MAX_VALUE, identifier);
3545    case 351608024:
3546      /* version */ return new Property("version", "string",
3547          "The identifier that is used to identify this version of the structure definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.",
3548          0, 1, version);
3549    case 3373707:
3550      /* name */ return new Property("name", "string",
3551          "A natural language name identifying the structure definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.",
3552          0, 1, name);
3553    case 110371416:
3554      /* title */ return new Property("title", "string",
3555          "A short, descriptive, user-friendly title for the structure definition.", 0, 1, title);
3556    case -892481550:
3557      /* status */ return new Property("status", "code",
3558          "The status of this structure definition. Enables tracking the life-cycle of the content.", 0, 1, status);
3559    case -404562712:
3560      /* experimental */ return new Property("experimental", "boolean",
3561          "A Boolean value to indicate that this structure definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.",
3562          0, 1, experimental);
3563    case 3076014:
3564      /* date */ return new Property("date", "dateTime",
3565          "The date  (and optionally time) when the structure definition was published. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.",
3566          0, 1, date);
3567    case 1447404028:
3568      /* publisher */ return new Property("publisher", "string",
3569          "The name of the organization or individual that published the structure definition.", 0, 1, publisher);
3570    case 951526432:
3571      /* contact */ return new Property("contact", "ContactDetail",
3572          "Contact details to assist a user in finding and communicating with the publisher.", 0,
3573          java.lang.Integer.MAX_VALUE, contact);
3574    case -1724546052:
3575      /* description */ return new Property("description", "markdown",
3576          "A free text natural language description of the structure definition from a consumer's perspective.", 0, 1,
3577          description);
3578    case -669707736:
3579      /* useContext */ return new Property("useContext", "UsageContext",
3580          "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate structure definition instances.",
3581          0, java.lang.Integer.MAX_VALUE, useContext);
3582    case -507075711:
3583      /* jurisdiction */ return new Property("jurisdiction", "CodeableConcept",
3584          "A legal or geographic region in which the structure definition is intended to be used.", 0,
3585          java.lang.Integer.MAX_VALUE, jurisdiction);
3586    case -220463842:
3587      /* purpose */ return new Property("purpose", "markdown",
3588          "Explanation of why this structure definition is needed and why it has been designed as it has.", 0, 1,
3589          purpose);
3590    case 1522889671:
3591      /* copyright */ return new Property("copyright", "markdown",
3592          "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 structure definition.",
3593          0, 1, copyright);
3594    case -814408215:
3595      /* keyword */ return new Property("keyword", "Coding",
3596          "A set of key words or terms from external terminologies that may be used to assist with indexing and searching of templates nby describing the use of this structure definition, or the content it describes.",
3597          0, java.lang.Integer.MAX_VALUE, keyword);
3598    case 461006061:
3599      /* fhirVersion */ return new Property("fhirVersion", "code",
3600          "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 4.0.1. for this version.",
3601          0, 1, fhirVersion);
3602    case 837556430:
3603      /* mapping */ return new Property("mapping", "", "An external specification that the content is mapped to.", 0,
3604          java.lang.Integer.MAX_VALUE, mapping);
3605    case 3292052:
3606      /* kind */ return new Property("kind", "code",
3607          "Defines the kind of structure that this definition is describing.", 0, 1, kind);
3608    case 1732898850:
3609      /* abstract */ return new Property("abstract", "boolean",
3610          "Whether structure this definition describes is abstract or not  - that is, whether the structure is not intended to be instantiated. For Resources and Data types, abstract types will never be exchanged  between systems.",
3611          0, 1, abstract_);
3612    case 951530927:
3613      /* context */ return new Property("context", "",
3614          "Identifies the types of resource or data type elements to which the extension can be applied.", 0,
3615          java.lang.Integer.MAX_VALUE, context);
3616    case -802505007:
3617      /* contextInvariant */ return new Property("contextInvariant", "string",
3618          "A set of rules as FHIRPath Invariants about when the extension can be used (e.g. co-occurrence variants for the extension). All the rules must be true.",
3619          0, java.lang.Integer.MAX_VALUE, contextInvariant);
3620    case 3575610:
3621      /* type */ return new Property("type", "uri",
3622          "The type this structure describes. If the derivation kind is 'specialization' then this is the master definition for a type, and there is always one of these (a data type, an extension, a resource, including abstract ones). Otherwise the structure definition is a constraint on the stated type (and in this case, the type cannot be an abstract type).  References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.",
3623          0, 1, type);
3624    case 1139771140:
3625      /* baseDefinition */ return new Property("baseDefinition", "canonical(StructureDefinition)",
3626          "An absolute URI that is the base structure from which this type is derived, either by specialization or constraint.",
3627          0, 1, baseDefinition);
3628    case -1353885513:
3629      /* derivation */ return new Property("derivation", "code", "How the type relates to the baseDefinition.", 0, 1,
3630          derivation);
3631    case 284874180:
3632      /* snapshot */ return new Property("snapshot", "",
3633          "A snapshot view is expressed in a standalone form that can be used and interpreted without considering the base StructureDefinition.",
3634          0, 1, snapshot);
3635    case -1196150917:
3636      /* differential */ return new Property("differential", "",
3637          "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.",
3638          0, 1, differential);
3639    default:
3640      return super.getNamedProperty(_hash, _name, _checkValid);
3641    }
3642
3643  }
3644
3645  @Override
3646  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3647    switch (hash) {
3648    case 116079:
3649      /* url */ return this.url == null ? new Base[0] : new Base[] { this.url }; // UriType
3650    case -1618432855:
3651      /* identifier */ return this.identifier == null ? new Base[0]
3652          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3653    case 351608024:
3654      /* version */ return this.version == null ? new Base[0] : new Base[] { this.version }; // StringType
3655    case 3373707:
3656      /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
3657    case 110371416:
3658      /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
3659    case -892481550:
3660      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<PublicationStatus>
3661    case -404562712:
3662      /* experimental */ return this.experimental == null ? new Base[0] : new Base[] { this.experimental }; // BooleanType
3663    case 3076014:
3664      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3665    case 1447404028:
3666      /* publisher */ return this.publisher == null ? new Base[0] : new Base[] { this.publisher }; // StringType
3667    case 951526432:
3668      /* contact */ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
3669    case -1724546052:
3670      /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // MarkdownType
3671    case -669707736:
3672      /* useContext */ return this.useContext == null ? new Base[0]
3673          : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
3674    case -507075711:
3675      /* jurisdiction */ return this.jurisdiction == null ? new Base[0]
3676          : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3677    case -220463842:
3678      /* purpose */ return this.purpose == null ? new Base[0] : new Base[] { this.purpose }; // MarkdownType
3679    case 1522889671:
3680      /* copyright */ return this.copyright == null ? new Base[0] : new Base[] { this.copyright }; // MarkdownType
3681    case -814408215:
3682      /* keyword */ return this.keyword == null ? new Base[0] : this.keyword.toArray(new Base[this.keyword.size()]); // Coding
3683    case 461006061:
3684      /* fhirVersion */ return this.fhirVersion == null ? new Base[0] : new Base[] { this.fhirVersion }; // Enumeration<FHIRVersion>
3685    case 837556430:
3686      /* mapping */ return this.mapping == null ? new Base[0] : this.mapping.toArray(new Base[this.mapping.size()]); // StructureDefinitionMappingComponent
3687    case 3292052:
3688      /* kind */ return this.kind == null ? new Base[0] : new Base[] { this.kind }; // Enumeration<StructureDefinitionKind>
3689    case 1732898850:
3690      /* abstract */ return this.abstract_ == null ? new Base[0] : new Base[] { this.abstract_ }; // BooleanType
3691    case 951530927:
3692      /* context */ return this.context == null ? new Base[0] : this.context.toArray(new Base[this.context.size()]); // StructureDefinitionContextComponent
3693    case -802505007:
3694      /* contextInvariant */ return this.contextInvariant == null ? new Base[0]
3695          : this.contextInvariant.toArray(new Base[this.contextInvariant.size()]); // StringType
3696    case 3575610:
3697      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // UriType
3698    case 1139771140:
3699      /* baseDefinition */ return this.baseDefinition == null ? new Base[0] : new Base[] { this.baseDefinition }; // CanonicalType
3700    case -1353885513:
3701      /* derivation */ return this.derivation == null ? new Base[0] : new Base[] { this.derivation }; // Enumeration<TypeDerivationRule>
3702    case 284874180:
3703      /* snapshot */ return this.snapshot == null ? new Base[0] : new Base[] { this.snapshot }; // StructureDefinitionSnapshotComponent
3704    case -1196150917:
3705      /* differential */ return this.differential == null ? new Base[0] : new Base[] { this.differential }; // StructureDefinitionDifferentialComponent
3706    default:
3707      return super.getProperty(hash, name, checkValid);
3708    }
3709
3710  }
3711
3712  @Override
3713  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3714    switch (hash) {
3715    case 116079: // url
3716      this.url = castToUri(value); // UriType
3717      return value;
3718    case -1618432855: // identifier
3719      this.getIdentifier().add(castToIdentifier(value)); // Identifier
3720      return value;
3721    case 351608024: // version
3722      this.version = castToString(value); // StringType
3723      return value;
3724    case 3373707: // name
3725      this.name = castToString(value); // StringType
3726      return value;
3727    case 110371416: // title
3728      this.title = castToString(value); // StringType
3729      return value;
3730    case -892481550: // status
3731      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3732      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3733      return value;
3734    case -404562712: // experimental
3735      this.experimental = castToBoolean(value); // BooleanType
3736      return value;
3737    case 3076014: // date
3738      this.date = castToDateTime(value); // DateTimeType
3739      return value;
3740    case 1447404028: // publisher
3741      this.publisher = castToString(value); // StringType
3742      return value;
3743    case 951526432: // contact
3744      this.getContact().add(castToContactDetail(value)); // ContactDetail
3745      return value;
3746    case -1724546052: // description
3747      this.description = castToMarkdown(value); // MarkdownType
3748      return value;
3749    case -669707736: // useContext
3750      this.getUseContext().add(castToUsageContext(value)); // UsageContext
3751      return value;
3752    case -507075711: // jurisdiction
3753      this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
3754      return value;
3755    case -220463842: // purpose
3756      this.purpose = castToMarkdown(value); // MarkdownType
3757      return value;
3758    case 1522889671: // copyright
3759      this.copyright = castToMarkdown(value); // MarkdownType
3760      return value;
3761    case -814408215: // keyword
3762      this.getKeyword().add(castToCoding(value)); // Coding
3763      return value;
3764    case 461006061: // fhirVersion
3765      value = new FHIRVersionEnumFactory().fromType(castToCode(value));
3766      this.fhirVersion = (Enumeration) value; // Enumeration<FHIRVersion>
3767      return value;
3768    case 837556430: // mapping
3769      this.getMapping().add((StructureDefinitionMappingComponent) value); // StructureDefinitionMappingComponent
3770      return value;
3771    case 3292052: // kind
3772      value = new StructureDefinitionKindEnumFactory().fromType(castToCode(value));
3773      this.kind = (Enumeration) value; // Enumeration<StructureDefinitionKind>
3774      return value;
3775    case 1732898850: // abstract
3776      this.abstract_ = castToBoolean(value); // BooleanType
3777      return value;
3778    case 951530927: // context
3779      this.getContext().add((StructureDefinitionContextComponent) value); // StructureDefinitionContextComponent
3780      return value;
3781    case -802505007: // contextInvariant
3782      this.getContextInvariant().add(castToString(value)); // StringType
3783      return value;
3784    case 3575610: // type
3785      this.type = castToUri(value); // UriType
3786      return value;
3787    case 1139771140: // baseDefinition
3788      this.baseDefinition = castToCanonical(value); // CanonicalType
3789      return value;
3790    case -1353885513: // derivation
3791      value = new TypeDerivationRuleEnumFactory().fromType(castToCode(value));
3792      this.derivation = (Enumeration) value; // Enumeration<TypeDerivationRule>
3793      return value;
3794    case 284874180: // snapshot
3795      this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
3796      return value;
3797    case -1196150917: // differential
3798      this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
3799      return value;
3800    default:
3801      return super.setProperty(hash, name, value);
3802    }
3803
3804  }
3805
3806  @Override
3807  public Base setProperty(String name, Base value) throws FHIRException {
3808    if (name.equals("url")) {
3809      this.url = castToUri(value); // UriType
3810    } else if (name.equals("identifier")) {
3811      this.getIdentifier().add(castToIdentifier(value));
3812    } else if (name.equals("version")) {
3813      this.version = castToString(value); // StringType
3814    } else if (name.equals("name")) {
3815      this.name = castToString(value); // StringType
3816    } else if (name.equals("title")) {
3817      this.title = castToString(value); // StringType
3818    } else if (name.equals("status")) {
3819      value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3820      this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3821    } else if (name.equals("experimental")) {
3822      this.experimental = castToBoolean(value); // BooleanType
3823    } else if (name.equals("date")) {
3824      this.date = castToDateTime(value); // DateTimeType
3825    } else if (name.equals("publisher")) {
3826      this.publisher = castToString(value); // StringType
3827    } else if (name.equals("contact")) {
3828      this.getContact().add(castToContactDetail(value));
3829    } else if (name.equals("description")) {
3830      this.description = castToMarkdown(value); // MarkdownType
3831    } else if (name.equals("useContext")) {
3832      this.getUseContext().add(castToUsageContext(value));
3833    } else if (name.equals("jurisdiction")) {
3834      this.getJurisdiction().add(castToCodeableConcept(value));
3835    } else if (name.equals("purpose")) {
3836      this.purpose = castToMarkdown(value); // MarkdownType
3837    } else if (name.equals("copyright")) {
3838      this.copyright = castToMarkdown(value); // MarkdownType
3839    } else if (name.equals("keyword")) {
3840      this.getKeyword().add(castToCoding(value));
3841    } else if (name.equals("fhirVersion")) {
3842      value = new FHIRVersionEnumFactory().fromType(castToCode(value));
3843      this.fhirVersion = (Enumeration) value; // Enumeration<FHIRVersion>
3844    } else if (name.equals("mapping")) {
3845      this.getMapping().add((StructureDefinitionMappingComponent) value);
3846    } else if (name.equals("kind")) {
3847      value = new StructureDefinitionKindEnumFactory().fromType(castToCode(value));
3848      this.kind = (Enumeration) value; // Enumeration<StructureDefinitionKind>
3849    } else if (name.equals("abstract")) {
3850      this.abstract_ = castToBoolean(value); // BooleanType
3851    } else if (name.equals("context")) {
3852      this.getContext().add((StructureDefinitionContextComponent) value);
3853    } else if (name.equals("contextInvariant")) {
3854      this.getContextInvariant().add(castToString(value));
3855    } else if (name.equals("type")) {
3856      this.type = castToUri(value); // UriType
3857    } else if (name.equals("baseDefinition")) {
3858      this.baseDefinition = castToCanonical(value); // CanonicalType
3859    } else if (name.equals("derivation")) {
3860      value = new TypeDerivationRuleEnumFactory().fromType(castToCode(value));
3861      this.derivation = (Enumeration) value; // Enumeration<TypeDerivationRule>
3862    } else if (name.equals("snapshot")) {
3863      this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
3864    } else if (name.equals("differential")) {
3865      this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
3866    } else
3867      return super.setProperty(name, value);
3868    return value;
3869  }
3870
3871  @Override
3872  public void removeChild(String name, Base value) throws FHIRException {
3873    if (name.equals("url")) {
3874      this.url = null;
3875    } else if (name.equals("identifier")) {
3876      this.getIdentifier().remove(castToIdentifier(value));
3877    } else if (name.equals("version")) {
3878      this.version = null;
3879    } else if (name.equals("name")) {
3880      this.name = null;
3881    } else if (name.equals("title")) {
3882      this.title = null;
3883    } else if (name.equals("status")) {
3884      this.status = null;
3885    } else if (name.equals("experimental")) {
3886      this.experimental = null;
3887    } else if (name.equals("date")) {
3888      this.date = null;
3889    } else if (name.equals("publisher")) {
3890      this.publisher = null;
3891    } else if (name.equals("contact")) {
3892      this.getContact().remove(castToContactDetail(value));
3893    } else if (name.equals("description")) {
3894      this.description = null;
3895    } else if (name.equals("useContext")) {
3896      this.getUseContext().remove(castToUsageContext(value));
3897    } else if (name.equals("jurisdiction")) {
3898      this.getJurisdiction().remove(castToCodeableConcept(value));
3899    } else if (name.equals("purpose")) {
3900      this.purpose = null;
3901    } else if (name.equals("copyright")) {
3902      this.copyright = null;
3903    } else if (name.equals("keyword")) {
3904      this.getKeyword().remove(castToCoding(value));
3905    } else if (name.equals("fhirVersion")) {
3906      this.fhirVersion = null;
3907    } else if (name.equals("mapping")) {
3908      this.getMapping().remove((StructureDefinitionMappingComponent) value);
3909    } else if (name.equals("kind")) {
3910      this.kind = null;
3911    } else if (name.equals("abstract")) {
3912      this.abstract_ = null;
3913    } else if (name.equals("context")) {
3914      this.getContext().remove((StructureDefinitionContextComponent) value);
3915    } else if (name.equals("contextInvariant")) {
3916      this.getContextInvariant().remove(castToString(value));
3917    } else if (name.equals("type")) {
3918      this.type = null;
3919    } else if (name.equals("baseDefinition")) {
3920      this.baseDefinition = null;
3921    } else if (name.equals("derivation")) {
3922      this.derivation = null;
3923    } else if (name.equals("snapshot")) {
3924      this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
3925    } else if (name.equals("differential")) {
3926      this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
3927    } else
3928      super.removeChild(name, value);
3929    
3930  }
3931
3932  @Override
3933  public Base makeProperty(int hash, String name) throws FHIRException {
3934    switch (hash) {
3935    case 116079:
3936      return getUrlElement();
3937    case -1618432855:
3938      return addIdentifier();
3939    case 351608024:
3940      return getVersionElement();
3941    case 3373707:
3942      return getNameElement();
3943    case 110371416:
3944      return getTitleElement();
3945    case -892481550:
3946      return getStatusElement();
3947    case -404562712:
3948      return getExperimentalElement();
3949    case 3076014:
3950      return getDateElement();
3951    case 1447404028:
3952      return getPublisherElement();
3953    case 951526432:
3954      return addContact();
3955    case -1724546052:
3956      return getDescriptionElement();
3957    case -669707736:
3958      return addUseContext();
3959    case -507075711:
3960      return addJurisdiction();
3961    case -220463842:
3962      return getPurposeElement();
3963    case 1522889671:
3964      return getCopyrightElement();
3965    case -814408215:
3966      return addKeyword();
3967    case 461006061:
3968      return getFhirVersionElement();
3969    case 837556430:
3970      return addMapping();
3971    case 3292052:
3972      return getKindElement();
3973    case 1732898850:
3974      return getAbstractElement();
3975    case 951530927:
3976      return addContext();
3977    case -802505007:
3978      return addContextInvariantElement();
3979    case 3575610:
3980      return getTypeElement();
3981    case 1139771140:
3982      return getBaseDefinitionElement();
3983    case -1353885513:
3984      return getDerivationElement();
3985    case 284874180:
3986      return getSnapshot();
3987    case -1196150917:
3988      return getDifferential();
3989    default:
3990      return super.makeProperty(hash, name);
3991    }
3992
3993  }
3994
3995  @Override
3996  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3997    switch (hash) {
3998    case 116079:
3999      /* url */ return new String[] { "uri" };
4000    case -1618432855:
4001      /* identifier */ return new String[] { "Identifier" };
4002    case 351608024:
4003      /* version */ return new String[] { "string" };
4004    case 3373707:
4005      /* name */ return new String[] { "string" };
4006    case 110371416:
4007      /* title */ return new String[] { "string" };
4008    case -892481550:
4009      /* status */ return new String[] { "code" };
4010    case -404562712:
4011      /* experimental */ return new String[] { "boolean" };
4012    case 3076014:
4013      /* date */ return new String[] { "dateTime" };
4014    case 1447404028:
4015      /* publisher */ return new String[] { "string" };
4016    case 951526432:
4017      /* contact */ return new String[] { "ContactDetail" };
4018    case -1724546052:
4019      /* description */ return new String[] { "markdown" };
4020    case -669707736:
4021      /* useContext */ return new String[] { "UsageContext" };
4022    case -507075711:
4023      /* jurisdiction */ return new String[] { "CodeableConcept" };
4024    case -220463842:
4025      /* purpose */ return new String[] { "markdown" };
4026    case 1522889671:
4027      /* copyright */ return new String[] { "markdown" };
4028    case -814408215:
4029      /* keyword */ return new String[] { "Coding" };
4030    case 461006061:
4031      /* fhirVersion */ return new String[] { "code" };
4032    case 837556430:
4033      /* mapping */ return new String[] {};
4034    case 3292052:
4035      /* kind */ return new String[] { "code" };
4036    case 1732898850:
4037      /* abstract */ return new String[] { "boolean" };
4038    case 951530927:
4039      /* context */ return new String[] {};
4040    case -802505007:
4041      /* contextInvariant */ return new String[] { "string" };
4042    case 3575610:
4043      /* type */ return new String[] { "uri" };
4044    case 1139771140:
4045      /* baseDefinition */ return new String[] { "canonical" };
4046    case -1353885513:
4047      /* derivation */ return new String[] { "code" };
4048    case 284874180:
4049      /* snapshot */ return new String[] {};
4050    case -1196150917:
4051      /* differential */ return new String[] {};
4052    default:
4053      return super.getTypesForProperty(hash, name);
4054    }
4055
4056  }
4057
4058  @Override
4059  public Base addChild(String name) throws FHIRException {
4060    if (name.equals("url")) {
4061      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.url");
4062    } else if (name.equals("identifier")) {
4063      return addIdentifier();
4064    } else if (name.equals("version")) {
4065      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.version");
4066    } else if (name.equals("name")) {
4067      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.name");
4068    } else if (name.equals("title")) {
4069      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.title");
4070    } else if (name.equals("status")) {
4071      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.status");
4072    } else if (name.equals("experimental")) {
4073      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.experimental");
4074    } else if (name.equals("date")) {
4075      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.date");
4076    } else if (name.equals("publisher")) {
4077      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.publisher");
4078    } else if (name.equals("contact")) {
4079      return addContact();
4080    } else if (name.equals("description")) {
4081      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.description");
4082    } else if (name.equals("useContext")) {
4083      return addUseContext();
4084    } else if (name.equals("jurisdiction")) {
4085      return addJurisdiction();
4086    } else if (name.equals("purpose")) {
4087      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.purpose");
4088    } else if (name.equals("copyright")) {
4089      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.copyright");
4090    } else if (name.equals("keyword")) {
4091      return addKeyword();
4092    } else if (name.equals("fhirVersion")) {
4093      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.fhirVersion");
4094    } else if (name.equals("mapping")) {
4095      return addMapping();
4096    } else if (name.equals("kind")) {
4097      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.kind");
4098    } else if (name.equals("abstract")) {
4099      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.abstract");
4100    } else if (name.equals("context")) {
4101      return addContext();
4102    } else if (name.equals("contextInvariant")) {
4103      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.contextInvariant");
4104    } else if (name.equals("type")) {
4105      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.type");
4106    } else if (name.equals("baseDefinition")) {
4107      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.baseDefinition");
4108    } else if (name.equals("derivation")) {
4109      throw new FHIRException("Cannot call addChild on a singleton property StructureDefinition.derivation");
4110    } else if (name.equals("snapshot")) {
4111      this.snapshot = new StructureDefinitionSnapshotComponent();
4112      return this.snapshot;
4113    } else if (name.equals("differential")) {
4114      this.differential = new StructureDefinitionDifferentialComponent();
4115      return this.differential;
4116    } else
4117      return super.addChild(name);
4118  }
4119
4120  public String fhirType() {
4121    return "StructureDefinition";
4122
4123  }
4124
4125  public StructureDefinition copy() {
4126    StructureDefinition dst = new StructureDefinition();
4127    copyValues(dst);
4128    return dst;
4129  }
4130
4131  public void copyValues(StructureDefinition dst) {
4132    super.copyValues(dst);
4133    dst.url = url == null ? null : url.copy();
4134    if (identifier != null) {
4135      dst.identifier = new ArrayList<Identifier>();
4136      for (Identifier i : identifier)
4137        dst.identifier.add(i.copy());
4138    }
4139    ;
4140    dst.version = version == null ? null : version.copy();
4141    dst.name = name == null ? null : name.copy();
4142    dst.title = title == null ? null : title.copy();
4143    dst.status = status == null ? null : status.copy();
4144    dst.experimental = experimental == null ? null : experimental.copy();
4145    dst.date = date == null ? null : date.copy();
4146    dst.publisher = publisher == null ? null : publisher.copy();
4147    if (contact != null) {
4148      dst.contact = new ArrayList<ContactDetail>();
4149      for (ContactDetail i : contact)
4150        dst.contact.add(i.copy());
4151    }
4152    ;
4153    dst.description = description == null ? null : description.copy();
4154    if (useContext != null) {
4155      dst.useContext = new ArrayList<UsageContext>();
4156      for (UsageContext i : useContext)
4157        dst.useContext.add(i.copy());
4158    }
4159    ;
4160    if (jurisdiction != null) {
4161      dst.jurisdiction = new ArrayList<CodeableConcept>();
4162      for (CodeableConcept i : jurisdiction)
4163        dst.jurisdiction.add(i.copy());
4164    }
4165    ;
4166    dst.purpose = purpose == null ? null : purpose.copy();
4167    dst.copyright = copyright == null ? null : copyright.copy();
4168    if (keyword != null) {
4169      dst.keyword = new ArrayList<Coding>();
4170      for (Coding i : keyword)
4171        dst.keyword.add(i.copy());
4172    }
4173    ;
4174    dst.fhirVersion = fhirVersion == null ? null : fhirVersion.copy();
4175    if (mapping != null) {
4176      dst.mapping = new ArrayList<StructureDefinitionMappingComponent>();
4177      for (StructureDefinitionMappingComponent i : mapping)
4178        dst.mapping.add(i.copy());
4179    }
4180    ;
4181    dst.kind = kind == null ? null : kind.copy();
4182    dst.abstract_ = abstract_ == null ? null : abstract_.copy();
4183    if (context != null) {
4184      dst.context = new ArrayList<StructureDefinitionContextComponent>();
4185      for (StructureDefinitionContextComponent i : context)
4186        dst.context.add(i.copy());
4187    }
4188    ;
4189    if (contextInvariant != null) {
4190      dst.contextInvariant = new ArrayList<StringType>();
4191      for (StringType i : contextInvariant)
4192        dst.contextInvariant.add(i.copy());
4193    }
4194    ;
4195    dst.type = type == null ? null : type.copy();
4196    dst.baseDefinition = baseDefinition == null ? null : baseDefinition.copy();
4197    dst.derivation = derivation == null ? null : derivation.copy();
4198    dst.snapshot = snapshot == null ? null : snapshot.copy();
4199    dst.differential = differential == null ? null : differential.copy();
4200  }
4201
4202  protected StructureDefinition typedCopy() {
4203    return copy();
4204  }
4205
4206  @Override
4207  public boolean equalsDeep(Base other_) {
4208    if (!super.equalsDeep(other_))
4209      return false;
4210    if (!(other_ instanceof StructureDefinition))
4211      return false;
4212    StructureDefinition o = (StructureDefinition) other_;
4213    return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true)
4214        && compareDeep(copyright, o.copyright, true) && compareDeep(keyword, o.keyword, true)
4215        && compareDeep(fhirVersion, o.fhirVersion, true) && compareDeep(mapping, o.mapping, true)
4216        && compareDeep(kind, o.kind, true) && compareDeep(abstract_, o.abstract_, true)
4217        && compareDeep(context, o.context, true) && compareDeep(contextInvariant, o.contextInvariant, true)
4218        && compareDeep(type, o.type, true) && compareDeep(baseDefinition, o.baseDefinition, true)
4219        && compareDeep(derivation, o.derivation, true) && compareDeep(snapshot, o.snapshot, true)
4220        && compareDeep(differential, o.differential, true);
4221  }
4222
4223  @Override
4224  public boolean equalsShallow(Base other_) {
4225    if (!super.equalsShallow(other_))
4226      return false;
4227    if (!(other_ instanceof StructureDefinition))
4228      return false;
4229    StructureDefinition o = (StructureDefinition) other_;
4230    return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4231        && compareValues(fhirVersion, o.fhirVersion, true) && compareValues(kind, o.kind, true)
4232        && compareValues(abstract_, o.abstract_, true) && compareValues(contextInvariant, o.contextInvariant, true)
4233        && compareValues(type, o.type, true) && compareValues(derivation, o.derivation, true);
4234  }
4235
4236  public boolean isEmpty() {
4237    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, copyright, keyword, fhirVersion,
4238        mapping, kind, abstract_, context, contextInvariant, type, baseDefinition, derivation, snapshot, differential);
4239  }
4240
4241  @Override
4242  public ResourceType getResourceType() {
4243    return ResourceType.StructureDefinition;
4244  }
4245
4246  /**
4247   * Search parameter: <b>date</b>
4248   * <p>
4249   * Description: <b>The structure definition publication date</b><br>
4250   * Type: <b>date</b><br>
4251   * Path: <b>StructureDefinition.date</b><br>
4252   * </p>
4253   */
4254  @SearchParamDefinition(name = "date", path = "StructureDefinition.date", description = "The structure definition publication date", type = "date")
4255  public static final String SP_DATE = "date";
4256  /**
4257   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4258   * <p>
4259   * Description: <b>The structure definition publication date</b><br>
4260   * Type: <b>date</b><br>
4261   * Path: <b>StructureDefinition.date</b><br>
4262   * </p>
4263   */
4264  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
4265      SP_DATE);
4266
4267  /**
4268   * Search parameter: <b>context-type-value</b>
4269   * <p>
4270   * Description: <b>A use context type and value assigned to the structure
4271   * definition</b><br>
4272   * Type: <b>composite</b><br>
4273   * Path: <b></b><br>
4274   * </p>
4275   */
4276  @SearchParamDefinition(name = "context-type-value", path = "StructureDefinition.useContext", description = "A use context type and value assigned to the structure definition", type = "composite", compositeOf = {
4277      "context-type", "context" })
4278  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
4279  /**
4280   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
4281   * <p>
4282   * Description: <b>A use context type and value assigned to the structure
4283   * definition</b><br>
4284   * Type: <b>composite</b><br>
4285   * Path: <b></b><br>
4286   * </p>
4287   */
4288  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam> CONTEXT_TYPE_VALUE = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.TokenClientParam>(
4289      SP_CONTEXT_TYPE_VALUE);
4290
4291  /**
4292   * Search parameter: <b>jurisdiction</b>
4293   * <p>
4294   * Description: <b>Intended jurisdiction for the structure definition</b><br>
4295   * Type: <b>token</b><br>
4296   * Path: <b>StructureDefinition.jurisdiction</b><br>
4297   * </p>
4298   */
4299  @SearchParamDefinition(name = "jurisdiction", path = "StructureDefinition.jurisdiction", description = "Intended jurisdiction for the structure definition", type = "token")
4300  public static final String SP_JURISDICTION = "jurisdiction";
4301  /**
4302   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4303   * <p>
4304   * Description: <b>Intended jurisdiction for the structure definition</b><br>
4305   * Type: <b>token</b><br>
4306   * Path: <b>StructureDefinition.jurisdiction</b><br>
4307   * </p>
4308   */
4309  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4310      SP_JURISDICTION);
4311
4312  /**
4313   * Search parameter: <b>description</b>
4314   * <p>
4315   * Description: <b>The description of the structure definition</b><br>
4316   * Type: <b>string</b><br>
4317   * Path: <b>StructureDefinition.description</b><br>
4318   * </p>
4319   */
4320  @SearchParamDefinition(name = "description", path = "StructureDefinition.description", description = "The description of the structure definition", type = "string")
4321  public static final String SP_DESCRIPTION = "description";
4322  /**
4323   * <b>Fluent Client</b> search parameter constant for <b>description</b>
4324   * <p>
4325   * Description: <b>The description of the structure definition</b><br>
4326   * Type: <b>string</b><br>
4327   * Path: <b>StructureDefinition.description</b><br>
4328   * </p>
4329   */
4330  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(
4331      SP_DESCRIPTION);
4332
4333  /**
4334   * Search parameter: <b>context-type</b>
4335   * <p>
4336   * Description: <b>A type of use context assigned to the structure
4337   * definition</b><br>
4338   * Type: <b>token</b><br>
4339   * Path: <b>StructureDefinition.useContext.code</b><br>
4340   * </p>
4341   */
4342  @SearchParamDefinition(name = "context-type", path = "StructureDefinition.useContext.code", description = "A type of use context assigned to the structure definition", type = "token")
4343  public static final String SP_CONTEXT_TYPE = "context-type";
4344  /**
4345   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
4346   * <p>
4347   * Description: <b>A type of use context assigned to the structure
4348   * definition</b><br>
4349   * Type: <b>token</b><br>
4350   * Path: <b>StructureDefinition.useContext.code</b><br>
4351   * </p>
4352   */
4353  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4354      SP_CONTEXT_TYPE);
4355
4356  /**
4357   * Search parameter: <b>experimental</b>
4358   * <p>
4359   * Description: <b>For testing purposes, not real usage</b><br>
4360   * Type: <b>token</b><br>
4361   * Path: <b>StructureDefinition.experimental</b><br>
4362   * </p>
4363   */
4364  @SearchParamDefinition(name = "experimental", path = "StructureDefinition.experimental", description = "For testing purposes, not real usage", type = "token")
4365  public static final String SP_EXPERIMENTAL = "experimental";
4366  /**
4367   * <b>Fluent Client</b> search parameter constant for <b>experimental</b>
4368   * <p>
4369   * Description: <b>For testing purposes, not real usage</b><br>
4370   * Type: <b>token</b><br>
4371   * Path: <b>StructureDefinition.experimental</b><br>
4372   * </p>
4373   */
4374  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXPERIMENTAL = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4375      SP_EXPERIMENTAL);
4376
4377  /**
4378   * Search parameter: <b>title</b>
4379   * <p>
4380   * Description: <b>The human-friendly name of the structure definition</b><br>
4381   * Type: <b>string</b><br>
4382   * Path: <b>StructureDefinition.title</b><br>
4383   * </p>
4384   */
4385  @SearchParamDefinition(name = "title", path = "StructureDefinition.title", description = "The human-friendly name of the structure definition", type = "string")
4386  public static final String SP_TITLE = "title";
4387  /**
4388   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4389   * <p>
4390   * Description: <b>The human-friendly name of the structure definition</b><br>
4391   * Type: <b>string</b><br>
4392   * Path: <b>StructureDefinition.title</b><br>
4393   * </p>
4394   */
4395  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(
4396      SP_TITLE);
4397
4398  /**
4399   * Search parameter: <b>type</b>
4400   * <p>
4401   * Description: <b>Type defined or constrained by this structure</b><br>
4402   * Type: <b>uri</b><br>
4403   * Path: <b>StructureDefinition.type</b><br>
4404   * </p>
4405   */
4406  @SearchParamDefinition(name = "type", path = "StructureDefinition.type", description = "Type defined or constrained by this structure", type = "uri")
4407  public static final String SP_TYPE = "type";
4408  /**
4409   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4410   * <p>
4411   * Description: <b>Type defined or constrained by this structure</b><br>
4412   * Type: <b>uri</b><br>
4413   * Path: <b>StructureDefinition.type</b><br>
4414   * </p>
4415   */
4416  public static final ca.uhn.fhir.rest.gclient.UriClientParam TYPE = new ca.uhn.fhir.rest.gclient.UriClientParam(
4417      SP_TYPE);
4418
4419  /**
4420   * Search parameter: <b>context-quantity</b>
4421   * <p>
4422   * Description: <b>A quantity- or range-valued use context assigned to the
4423   * structure definition</b><br>
4424   * Type: <b>quantity</b><br>
4425   * Path: <b>StructureDefinition.useContext.valueQuantity,
4426   * StructureDefinition.useContext.valueRange</b><br>
4427   * </p>
4428   */
4429  @SearchParamDefinition(name = "context-quantity", path = "(StructureDefinition.useContext.value as Quantity) | (StructureDefinition.useContext.value as Range)", description = "A quantity- or range-valued use context assigned to the structure definition", type = "quantity")
4430  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
4431  /**
4432   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
4433   * <p>
4434   * Description: <b>A quantity- or range-valued use context assigned to the
4435   * structure definition</b><br>
4436   * Type: <b>quantity</b><br>
4437   * Path: <b>StructureDefinition.useContext.valueQuantity,
4438   * StructureDefinition.useContext.valueRange</b><br>
4439   * </p>
4440   */
4441  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(
4442      SP_CONTEXT_QUANTITY);
4443
4444  /**
4445   * Search parameter: <b>path</b>
4446   * <p>
4447   * Description: <b>A path that is constrained in the StructureDefinition</b><br>
4448   * Type: <b>token</b><br>
4449   * Path: <b>StructureDefinition.snapshot.element.path,
4450   * StructureDefinition.differential.element.path</b><br>
4451   * </p>
4452   */
4453  @SearchParamDefinition(name = "path", path = "StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path", description = "A path that is constrained in the StructureDefinition", type = "token")
4454  public static final String SP_PATH = "path";
4455  /**
4456   * <b>Fluent Client</b> search parameter constant for <b>path</b>
4457   * <p>
4458   * Description: <b>A path that is constrained in the StructureDefinition</b><br>
4459   * Type: <b>token</b><br>
4460   * Path: <b>StructureDefinition.snapshot.element.path,
4461   * StructureDefinition.differential.element.path</b><br>
4462   * </p>
4463   */
4464  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PATH = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4465      SP_PATH);
4466
4467  /**
4468   * Search parameter: <b>context</b>
4469   * <p>
4470   * Description: <b>A use context assigned to the structure definition</b><br>
4471   * Type: <b>token</b><br>
4472   * Path: <b>StructureDefinition.useContext.valueCodeableConcept</b><br>
4473   * </p>
4474   */
4475  @SearchParamDefinition(name = "context", path = "(StructureDefinition.useContext.value as CodeableConcept)", description = "A use context assigned to the structure definition", type = "token")
4476  public static final String SP_CONTEXT = "context";
4477  /**
4478   * <b>Fluent Client</b> search parameter constant for <b>context</b>
4479   * <p>
4480   * Description: <b>A use context assigned to the structure definition</b><br>
4481   * Type: <b>token</b><br>
4482   * Path: <b>StructureDefinition.useContext.valueCodeableConcept</b><br>
4483   * </p>
4484   */
4485  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4486      SP_CONTEXT);
4487
4488  /**
4489   * Search parameter: <b>base-path</b>
4490   * <p>
4491   * Description: <b>Path that identifies the base element</b><br>
4492   * Type: <b>token</b><br>
4493   * Path: <b>StructureDefinition.snapshot.element.base.path,
4494   * StructureDefinition.differential.element.base.path</b><br>
4495   * </p>
4496   */
4497  @SearchParamDefinition(name = "base-path", path = "StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path", description = "Path that identifies the base element", type = "token")
4498  public static final String SP_BASE_PATH = "base-path";
4499  /**
4500   * <b>Fluent Client</b> search parameter constant for <b>base-path</b>
4501   * <p>
4502   * Description: <b>Path that identifies the base element</b><br>
4503   * Type: <b>token</b><br>
4504   * Path: <b>StructureDefinition.snapshot.element.base.path,
4505   * StructureDefinition.differential.element.base.path</b><br>
4506   * </p>
4507   */
4508  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BASE_PATH = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4509      SP_BASE_PATH);
4510
4511  /**
4512   * Search parameter: <b>keyword</b>
4513   * <p>
4514   * Description: <b>A code for the StructureDefinition</b><br>
4515   * Type: <b>token</b><br>
4516   * Path: <b>StructureDefinition.keyword</b><br>
4517   * </p>
4518   */
4519  @SearchParamDefinition(name = "keyword", path = "StructureDefinition.keyword", description = "A code for the StructureDefinition", type = "token")
4520  public static final String SP_KEYWORD = "keyword";
4521  /**
4522   * <b>Fluent Client</b> search parameter constant for <b>keyword</b>
4523   * <p>
4524   * Description: <b>A code for the StructureDefinition</b><br>
4525   * Type: <b>token</b><br>
4526   * Path: <b>StructureDefinition.keyword</b><br>
4527   * </p>
4528   */
4529  public static final ca.uhn.fhir.rest.gclient.TokenClientParam KEYWORD = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4530      SP_KEYWORD);
4531
4532  /**
4533   * Search parameter: <b>context-type-quantity</b>
4534   * <p>
4535   * Description: <b>A use context type and quantity- or range-based value
4536   * assigned to the structure definition</b><br>
4537   * Type: <b>composite</b><br>
4538   * Path: <b></b><br>
4539   * </p>
4540   */
4541  @SearchParamDefinition(name = "context-type-quantity", path = "StructureDefinition.useContext", description = "A use context type and quantity- or range-based value assigned to the structure definition", type = "composite", compositeOf = {
4542      "context-type", "context-quantity" })
4543  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
4544  /**
4545   * <b>Fluent Client</b> search parameter constant for
4546   * <b>context-type-quantity</b>
4547   * <p>
4548   * Description: <b>A use context type and quantity- or range-based value
4549   * assigned to the structure definition</b><br>
4550   * Type: <b>composite</b><br>
4551   * Path: <b></b><br>
4552   * </p>
4553   */
4554  public static final ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam> CONTEXT_TYPE_QUANTITY = new ca.uhn.fhir.rest.gclient.CompositeClientParam<ca.uhn.fhir.rest.gclient.TokenClientParam, ca.uhn.fhir.rest.gclient.QuantityClientParam>(
4555      SP_CONTEXT_TYPE_QUANTITY);
4556
4557  /**
4558   * Search parameter: <b>identifier</b>
4559   * <p>
4560   * Description: <b>External identifier for the structure definition</b><br>
4561   * Type: <b>token</b><br>
4562   * Path: <b>StructureDefinition.identifier</b><br>
4563   * </p>
4564   */
4565  @SearchParamDefinition(name = "identifier", path = "StructureDefinition.identifier", description = "External identifier for the structure definition", type = "token")
4566  public static final String SP_IDENTIFIER = "identifier";
4567  /**
4568   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4569   * <p>
4570   * Description: <b>External identifier for the structure definition</b><br>
4571   * Type: <b>token</b><br>
4572   * Path: <b>StructureDefinition.identifier</b><br>
4573   * </p>
4574   */
4575  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4576      SP_IDENTIFIER);
4577
4578  /**
4579   * Search parameter: <b>valueset</b>
4580   * <p>
4581   * Description: <b>A vocabulary binding reference</b><br>
4582   * Type: <b>reference</b><br>
4583   * Path: <b>StructureDefinition.snapshot.element.binding.valueSet</b><br>
4584   * </p>
4585   */
4586  @SearchParamDefinition(name = "valueset", path = "StructureDefinition.snapshot.element.binding.valueSet", description = "A vocabulary binding reference", type = "reference", target = {
4587      ValueSet.class })
4588  public static final String SP_VALUESET = "valueset";
4589  /**
4590   * <b>Fluent Client</b> search parameter constant for <b>valueset</b>
4591   * <p>
4592   * Description: <b>A vocabulary binding reference</b><br>
4593   * Type: <b>reference</b><br>
4594   * Path: <b>StructureDefinition.snapshot.element.binding.valueSet</b><br>
4595   * </p>
4596   */
4597  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam VALUESET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4598      SP_VALUESET);
4599
4600  /**
4601   * Constant for fluent queries to be used to add include statements. Specifies
4602   * the path value of "<b>StructureDefinition:valueset</b>".
4603   */
4604  public static final ca.uhn.fhir.model.api.Include INCLUDE_VALUESET = new ca.uhn.fhir.model.api.Include(
4605      "StructureDefinition:valueset").toLocked();
4606
4607  /**
4608   * Search parameter: <b>kind</b>
4609   * <p>
4610   * Description: <b>primitive-type | complex-type | resource | logical</b><br>
4611   * Type: <b>token</b><br>
4612   * Path: <b>StructureDefinition.kind</b><br>
4613   * </p>
4614   */
4615  @SearchParamDefinition(name = "kind", path = "StructureDefinition.kind", description = "primitive-type | complex-type | resource | logical", type = "token")
4616  public static final String SP_KIND = "kind";
4617  /**
4618   * <b>Fluent Client</b> search parameter constant for <b>kind</b>
4619   * <p>
4620   * Description: <b>primitive-type | complex-type | resource | logical</b><br>
4621   * Type: <b>token</b><br>
4622   * Path: <b>StructureDefinition.kind</b><br>
4623   * </p>
4624   */
4625  public static final ca.uhn.fhir.rest.gclient.TokenClientParam KIND = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4626      SP_KIND);
4627
4628  /**
4629   * Search parameter: <b>abstract</b>
4630   * <p>
4631   * Description: <b>Whether the structure is abstract</b><br>
4632   * Type: <b>token</b><br>
4633   * Path: <b>StructureDefinition.abstract</b><br>
4634   * </p>
4635   */
4636  @SearchParamDefinition(name = "abstract", path = "StructureDefinition.abstract", description = "Whether the structure is abstract", type = "token")
4637  public static final String SP_ABSTRACT = "abstract";
4638  /**
4639   * <b>Fluent Client</b> search parameter constant for <b>abstract</b>
4640   * <p>
4641   * Description: <b>Whether the structure is abstract</b><br>
4642   * Type: <b>token</b><br>
4643   * Path: <b>StructureDefinition.abstract</b><br>
4644   * </p>
4645   */
4646  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ABSTRACT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4647      SP_ABSTRACT);
4648
4649  /**
4650   * Search parameter: <b>version</b>
4651   * <p>
4652   * Description: <b>The business version of the structure definition</b><br>
4653   * Type: <b>token</b><br>
4654   * Path: <b>StructureDefinition.version</b><br>
4655   * </p>
4656   */
4657  @SearchParamDefinition(name = "version", path = "StructureDefinition.version", description = "The business version of the structure definition", type = "token")
4658  public static final String SP_VERSION = "version";
4659  /**
4660   * <b>Fluent Client</b> search parameter constant for <b>version</b>
4661   * <p>
4662   * Description: <b>The business version of the structure definition</b><br>
4663   * Type: <b>token</b><br>
4664   * Path: <b>StructureDefinition.version</b><br>
4665   * </p>
4666   */
4667  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4668      SP_VERSION);
4669
4670  /**
4671   * Search parameter: <b>url</b>
4672   * <p>
4673   * Description: <b>The uri that identifies the structure definition</b><br>
4674   * Type: <b>uri</b><br>
4675   * Path: <b>StructureDefinition.url</b><br>
4676   * </p>
4677   */
4678  @SearchParamDefinition(name = "url", path = "StructureDefinition.url", description = "The uri that identifies the structure definition", type = "uri")
4679  public static final String SP_URL = "url";
4680  /**
4681   * <b>Fluent Client</b> search parameter constant for <b>url</b>
4682   * <p>
4683   * Description: <b>The uri that identifies the structure definition</b><br>
4684   * Type: <b>uri</b><br>
4685   * Path: <b>StructureDefinition.url</b><br>
4686   * </p>
4687   */
4688  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
4689
4690  /**
4691   * Search parameter: <b>ext-context</b>
4692   * <p>
4693   * Description: <b>The system is the URL for the context-type: e.g.
4694   * http://hl7.org/fhir/extension-context-type#element|CodeableConcept.text</b><br>
4695   * Type: <b>token</b><br>
4696   * Path: <b>StructureDefinition.context.type</b><br>
4697   * </p>
4698   */
4699  @SearchParamDefinition(name = "ext-context", path = "StructureDefinition.context.type", description = "The system is the URL for the context-type: e.g. http://hl7.org/fhir/extension-context-type#element|CodeableConcept.text", type = "token")
4700  public static final String SP_EXT_CONTEXT = "ext-context";
4701  /**
4702   * <b>Fluent Client</b> search parameter constant for <b>ext-context</b>
4703   * <p>
4704   * Description: <b>The system is the URL for the context-type: e.g.
4705   * http://hl7.org/fhir/extension-context-type#element|CodeableConcept.text</b><br>
4706   * Type: <b>token</b><br>
4707   * Path: <b>StructureDefinition.context.type</b><br>
4708   * </p>
4709   */
4710  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXT_CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4711      SP_EXT_CONTEXT);
4712
4713  /**
4714   * Search parameter: <b>name</b>
4715   * <p>
4716   * Description: <b>Computationally friendly name of the structure
4717   * definition</b><br>
4718   * Type: <b>string</b><br>
4719   * Path: <b>StructureDefinition.name</b><br>
4720   * </p>
4721   */
4722  @SearchParamDefinition(name = "name", path = "StructureDefinition.name", description = "Computationally friendly name of the structure definition", type = "string")
4723  public static final String SP_NAME = "name";
4724  /**
4725   * <b>Fluent Client</b> search parameter constant for <b>name</b>
4726   * <p>
4727   * Description: <b>Computationally friendly name of the structure
4728   * definition</b><br>
4729   * Type: <b>string</b><br>
4730   * Path: <b>StructureDefinition.name</b><br>
4731   * </p>
4732   */
4733  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(
4734      SP_NAME);
4735
4736  /**
4737   * Search parameter: <b>publisher</b>
4738   * <p>
4739   * Description: <b>Name of the publisher of the structure definition</b><br>
4740   * Type: <b>string</b><br>
4741   * Path: <b>StructureDefinition.publisher</b><br>
4742   * </p>
4743   */
4744  @SearchParamDefinition(name = "publisher", path = "StructureDefinition.publisher", description = "Name of the publisher of the structure definition", type = "string")
4745  public static final String SP_PUBLISHER = "publisher";
4746  /**
4747   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
4748   * <p>
4749   * Description: <b>Name of the publisher of the structure definition</b><br>
4750   * Type: <b>string</b><br>
4751   * Path: <b>StructureDefinition.publisher</b><br>
4752   * </p>
4753   */
4754  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(
4755      SP_PUBLISHER);
4756
4757  /**
4758   * Search parameter: <b>derivation</b>
4759   * <p>
4760   * Description: <b>specialization | constraint - How relates to base
4761   * definition</b><br>
4762   * Type: <b>token</b><br>
4763   * Path: <b>StructureDefinition.derivation</b><br>
4764   * </p>
4765   */
4766  @SearchParamDefinition(name = "derivation", path = "StructureDefinition.derivation", description = "specialization | constraint - How relates to base definition", type = "token")
4767  public static final String SP_DERIVATION = "derivation";
4768  /**
4769   * <b>Fluent Client</b> search parameter constant for <b>derivation</b>
4770   * <p>
4771   * Description: <b>specialization | constraint - How relates to base
4772   * definition</b><br>
4773   * Type: <b>token</b><br>
4774   * Path: <b>StructureDefinition.derivation</b><br>
4775   * </p>
4776   */
4777  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DERIVATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4778      SP_DERIVATION);
4779
4780  /**
4781   * Search parameter: <b>status</b>
4782   * <p>
4783   * Description: <b>The current status of the structure definition</b><br>
4784   * Type: <b>token</b><br>
4785   * Path: <b>StructureDefinition.status</b><br>
4786   * </p>
4787   */
4788  @SearchParamDefinition(name = "status", path = "StructureDefinition.status", description = "The current status of the structure definition", type = "token")
4789  public static final String SP_STATUS = "status";
4790  /**
4791   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4792   * <p>
4793   * Description: <b>The current status of the structure definition</b><br>
4794   * Type: <b>token</b><br>
4795   * Path: <b>StructureDefinition.status</b><br>
4796   * </p>
4797   */
4798  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
4799      SP_STATUS);
4800
4801  /**
4802   * Search parameter: <b>base</b>
4803   * <p>
4804   * Description: <b>Definition that this type is constrained/specialized
4805   * from</b><br>
4806   * Type: <b>reference</b><br>
4807   * Path: <b>StructureDefinition.baseDefinition</b><br>
4808   * </p>
4809   */
4810  @SearchParamDefinition(name = "base", path = "StructureDefinition.baseDefinition", description = "Definition that this type is constrained/specialized from", type = "reference", target = {
4811      StructureDefinition.class })
4812  public static final String SP_BASE = "base";
4813  /**
4814   * <b>Fluent Client</b> search parameter constant for <b>base</b>
4815   * <p>
4816   * Description: <b>Definition that this type is constrained/specialized
4817   * from</b><br>
4818   * Type: <b>reference</b><br>
4819   * Path: <b>StructureDefinition.baseDefinition</b><br>
4820   * </p>
4821   */
4822  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam BASE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
4823      SP_BASE);
4824
4825  /**
4826   * Constant for fluent queries to be used to add include statements. Specifies
4827   * the path value of "<b>StructureDefinition:base</b>".
4828   */
4829  public static final ca.uhn.fhir.model.api.Include INCLUDE_BASE = new ca.uhn.fhir.model.api.Include(
4830      "StructureDefinition:base").toLocked();
4831
4832  public String getVersionedUrl() {
4833    return hasVersion() ? getUrl()+"|"+getVersion() : getUrl();
4834  }
4835
4836}