001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.
052 */
053@ResourceDef(name="Questionnaire", profile="http://hl7.org/fhir/StructureDefinition/Questionnaire")
054public class Questionnaire extends MetadataResource {
055
056    public enum EnableWhenBehavior {
057        /**
058         * Enable the question when all the enableWhen criteria are satisfied.
059         */
060        ALL, 
061        /**
062         * Enable the question when any of the enableWhen criteria are satisfied.
063         */
064        ANY, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static EnableWhenBehavior fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("all".equals(codeString))
073          return ALL;
074        if ("any".equals(codeString))
075          return ANY;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case ALL: return "all";
084            case ANY: return "any";
085            case NULL: return null;
086            default: return "?";
087          }
088        }
089        public String getSystem() {
090          switch (this) {
091            case ALL: return "http://hl7.org/fhir/questionnaire-enable-behavior";
092            case ANY: return "http://hl7.org/fhir/questionnaire-enable-behavior";
093            case NULL: return null;
094            default: return "?";
095          }
096        }
097        public String getDefinition() {
098          switch (this) {
099            case ALL: return "Enable the question when all the enableWhen criteria are satisfied.";
100            case ANY: return "Enable the question when any of the enableWhen criteria are satisfied.";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDisplay() {
106          switch (this) {
107            case ALL: return "All";
108            case ANY: return "Any";
109            case NULL: return null;
110            default: return "?";
111          }
112        }
113    }
114
115  public static class EnableWhenBehaviorEnumFactory implements EnumFactory<EnableWhenBehavior> {
116    public EnableWhenBehavior fromCode(String codeString) throws IllegalArgumentException {
117      if (codeString == null || "".equals(codeString))
118            if (codeString == null || "".equals(codeString))
119                return null;
120        if ("all".equals(codeString))
121          return EnableWhenBehavior.ALL;
122        if ("any".equals(codeString))
123          return EnableWhenBehavior.ANY;
124        throw new IllegalArgumentException("Unknown EnableWhenBehavior code '"+codeString+"'");
125        }
126        public Enumeration<EnableWhenBehavior> fromType(Base code) throws FHIRException {
127          if (code == null)
128            return null;
129          if (code.isEmpty())
130            return new Enumeration<EnableWhenBehavior>(this);
131          String codeString = ((PrimitiveType) code).asStringValue();
132          if (codeString == null || "".equals(codeString))
133            return null;
134        if ("all".equals(codeString))
135          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ALL);
136        if ("any".equals(codeString))
137          return new Enumeration<EnableWhenBehavior>(this, EnableWhenBehavior.ANY);
138        throw new FHIRException("Unknown EnableWhenBehavior code '"+codeString+"'");
139        }
140    public String toCode(EnableWhenBehavior code) {
141      if (code == EnableWhenBehavior.ALL)
142        return "all";
143      if (code == EnableWhenBehavior.ANY)
144        return "any";
145      return "?";
146      }
147    public String toSystem(EnableWhenBehavior code) {
148      return code.getSystem();
149      }
150    }
151
152    public enum QuestionnaireAnswerConstraint {
153        /**
154         * Only values listed as answerOption or in the expansion of the answerValueSet are permitted
155         */
156        OPTIONSONLY, 
157        /**
158         * In addition to the values listed as answerOption or in the expansion of the answerValueSet, any other values that correspond to the specified item.type are permitted
159         */
160        OPTIONSORTYPE, 
161        /**
162         * In addition to the values listed as answerOption or in the expansion of the answerValueSet, free-text strings are permitted.  Answers will have a type of 'string'.
163         */
164        OPTIONSORSTRING, 
165        /**
166         * added to help the parsers with the generic types
167         */
168        NULL;
169        public static QuestionnaireAnswerConstraint fromCode(String codeString) throws FHIRException {
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("optionsOnly".equals(codeString))
173          return OPTIONSONLY;
174        if ("optionsOrType".equals(codeString))
175          return OPTIONSORTYPE;
176        if ("optionsOrString".equals(codeString))
177          return OPTIONSORSTRING;
178        if (Configuration.isAcceptInvalidEnums())
179          return null;
180        else
181          throw new FHIRException("Unknown QuestionnaireAnswerConstraint code '"+codeString+"'");
182        }
183        public String toCode() {
184          switch (this) {
185            case OPTIONSONLY: return "optionsOnly";
186            case OPTIONSORTYPE: return "optionsOrType";
187            case OPTIONSORSTRING: return "optionsOrString";
188            case NULL: return null;
189            default: return "?";
190          }
191        }
192        public String getSystem() {
193          switch (this) {
194            case OPTIONSONLY: return "http://hl7.org/fhir/questionnaire-answer-constraint";
195            case OPTIONSORTYPE: return "http://hl7.org/fhir/questionnaire-answer-constraint";
196            case OPTIONSORSTRING: return "http://hl7.org/fhir/questionnaire-answer-constraint";
197            case NULL: return null;
198            default: return "?";
199          }
200        }
201        public String getDefinition() {
202          switch (this) {
203            case OPTIONSONLY: return "Only values listed as answerOption or in the expansion of the answerValueSet are permitted";
204            case OPTIONSORTYPE: return "In addition to the values listed as answerOption or in the expansion of the answerValueSet, any other values that correspond to the specified item.type are permitted";
205            case OPTIONSORSTRING: return "In addition to the values listed as answerOption or in the expansion of the answerValueSet, free-text strings are permitted.  Answers will have a type of 'string'.";
206            case NULL: return null;
207            default: return "?";
208          }
209        }
210        public String getDisplay() {
211          switch (this) {
212            case OPTIONSONLY: return "Options only";
213            case OPTIONSORTYPE: return "Options or 'type'";
214            case OPTIONSORSTRING: return "Options or string";
215            case NULL: return null;
216            default: return "?";
217          }
218        }
219    }
220
221  public static class QuestionnaireAnswerConstraintEnumFactory implements EnumFactory<QuestionnaireAnswerConstraint> {
222    public QuestionnaireAnswerConstraint fromCode(String codeString) throws IllegalArgumentException {
223      if (codeString == null || "".equals(codeString))
224            if (codeString == null || "".equals(codeString))
225                return null;
226        if ("optionsOnly".equals(codeString))
227          return QuestionnaireAnswerConstraint.OPTIONSONLY;
228        if ("optionsOrType".equals(codeString))
229          return QuestionnaireAnswerConstraint.OPTIONSORTYPE;
230        if ("optionsOrString".equals(codeString))
231          return QuestionnaireAnswerConstraint.OPTIONSORSTRING;
232        throw new IllegalArgumentException("Unknown QuestionnaireAnswerConstraint code '"+codeString+"'");
233        }
234        public Enumeration<QuestionnaireAnswerConstraint> fromType(Base code) throws FHIRException {
235          if (code == null)
236            return null;
237          if (code.isEmpty())
238            return new Enumeration<QuestionnaireAnswerConstraint>(this);
239          String codeString = ((PrimitiveType) code).asStringValue();
240          if (codeString == null || "".equals(codeString))
241            return null;
242        if ("optionsOnly".equals(codeString))
243          return new Enumeration<QuestionnaireAnswerConstraint>(this, QuestionnaireAnswerConstraint.OPTIONSONLY);
244        if ("optionsOrType".equals(codeString))
245          return new Enumeration<QuestionnaireAnswerConstraint>(this, QuestionnaireAnswerConstraint.OPTIONSORTYPE);
246        if ("optionsOrString".equals(codeString))
247          return new Enumeration<QuestionnaireAnswerConstraint>(this, QuestionnaireAnswerConstraint.OPTIONSORSTRING);
248        throw new FHIRException("Unknown QuestionnaireAnswerConstraint code '"+codeString+"'");
249        }
250    public String toCode(QuestionnaireAnswerConstraint code) {
251      if (code == QuestionnaireAnswerConstraint.OPTIONSONLY)
252        return "optionsOnly";
253      if (code == QuestionnaireAnswerConstraint.OPTIONSORTYPE)
254        return "optionsOrType";
255      if (code == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
256        return "optionsOrString";
257      return "?";
258      }
259    public String toSystem(QuestionnaireAnswerConstraint code) {
260      return code.getSystem();
261      }
262    }
263
264    public enum QuestionnaireItemDisabledDisplay {
265        /**
266         * The item (and its children) should not be visible to the user at all.
267         */
268        HIDDEN, 
269        /**
270         * The item (and possibly its children) should not be selectable or editable but should still be visible - to allow the user to see what questions *could* have been completed had other answers caused the item to be enabled.
271         */
272        PROTECTED, 
273        /**
274         * added to help the parsers with the generic types
275         */
276        NULL;
277        public static QuestionnaireItemDisabledDisplay fromCode(String codeString) throws FHIRException {
278            if (codeString == null || "".equals(codeString))
279                return null;
280        if ("hidden".equals(codeString))
281          return HIDDEN;
282        if ("protected".equals(codeString))
283          return PROTECTED;
284        if (Configuration.isAcceptInvalidEnums())
285          return null;
286        else
287          throw new FHIRException("Unknown QuestionnaireItemDisabledDisplay code '"+codeString+"'");
288        }
289        public String toCode() {
290          switch (this) {
291            case HIDDEN: return "hidden";
292            case PROTECTED: return "protected";
293            case NULL: return null;
294            default: return "?";
295          }
296        }
297        public String getSystem() {
298          switch (this) {
299            case HIDDEN: return "http://hl7.org/fhir/questionnaire-disabled-display";
300            case PROTECTED: return "http://hl7.org/fhir/questionnaire-disabled-display";
301            case NULL: return null;
302            default: return "?";
303          }
304        }
305        public String getDefinition() {
306          switch (this) {
307            case HIDDEN: return "The item (and its children) should not be visible to the user at all.";
308            case PROTECTED: return "The item (and possibly its children) should not be selectable or editable but should still be visible - to allow the user to see what questions *could* have been completed had other answers caused the item to be enabled.";
309            case NULL: return null;
310            default: return "?";
311          }
312        }
313        public String getDisplay() {
314          switch (this) {
315            case HIDDEN: return "Hidden";
316            case PROTECTED: return "Protected";
317            case NULL: return null;
318            default: return "?";
319          }
320        }
321    }
322
323  public static class QuestionnaireItemDisabledDisplayEnumFactory implements EnumFactory<QuestionnaireItemDisabledDisplay> {
324    public QuestionnaireItemDisabledDisplay fromCode(String codeString) throws IllegalArgumentException {
325      if (codeString == null || "".equals(codeString))
326            if (codeString == null || "".equals(codeString))
327                return null;
328        if ("hidden".equals(codeString))
329          return QuestionnaireItemDisabledDisplay.HIDDEN;
330        if ("protected".equals(codeString))
331          return QuestionnaireItemDisabledDisplay.PROTECTED;
332        throw new IllegalArgumentException("Unknown QuestionnaireItemDisabledDisplay code '"+codeString+"'");
333        }
334        public Enumeration<QuestionnaireItemDisabledDisplay> fromType(Base code) throws FHIRException {
335          if (code == null)
336            return null;
337          if (code.isEmpty())
338            return new Enumeration<QuestionnaireItemDisabledDisplay>(this);
339          String codeString = ((PrimitiveType) code).asStringValue();
340          if (codeString == null || "".equals(codeString))
341            return null;
342        if ("hidden".equals(codeString))
343          return new Enumeration<QuestionnaireItemDisabledDisplay>(this, QuestionnaireItemDisabledDisplay.HIDDEN);
344        if ("protected".equals(codeString))
345          return new Enumeration<QuestionnaireItemDisabledDisplay>(this, QuestionnaireItemDisabledDisplay.PROTECTED);
346        throw new FHIRException("Unknown QuestionnaireItemDisabledDisplay code '"+codeString+"'");
347        }
348    public String toCode(QuestionnaireItemDisabledDisplay code) {
349      if (code == QuestionnaireItemDisabledDisplay.HIDDEN)
350        return "hidden";
351      if (code == QuestionnaireItemDisabledDisplay.PROTECTED)
352        return "protected";
353      return "?";
354      }
355    public String toSystem(QuestionnaireItemDisabledDisplay code) {
356      return code.getSystem();
357      }
358    }
359
360    public enum QuestionnaireItemOperator {
361        /**
362         * True if the determination of 'whether an answer exists for the question' is equal to the enableWhen answer (which must be a boolean).
363         */
364        EXISTS, 
365        /**
366         * True if at least one answer has a value that is equal to the enableWhen answer.
367         */
368        EQUAL, 
369        /**
370         * True if no answer has a value that is equal to the enableWhen answer.
371         */
372        NOT_EQUAL, 
373        /**
374         * True if at least one answer has a value that is greater than the enableWhen answer.
375         */
376        GREATER_THAN, 
377        /**
378         * True if at least one answer has a value that is less than the enableWhen answer.
379         */
380        LESS_THAN, 
381        /**
382         * True if at least one answer has a value that is greater or equal to the enableWhen answer.
383         */
384        GREATER_OR_EQUAL, 
385        /**
386         * True if at least one answer has a value that is less or equal to the enableWhen answer.
387         */
388        LESS_OR_EQUAL, 
389        /**
390         * added to help the parsers with the generic types
391         */
392        NULL;
393        public static QuestionnaireItemOperator fromCode(String codeString) throws FHIRException {
394            if (codeString == null || "".equals(codeString))
395                return null;
396        if ("exists".equals(codeString))
397          return EXISTS;
398        if ("=".equals(codeString))
399          return EQUAL;
400        if ("!=".equals(codeString))
401          return NOT_EQUAL;
402        if (">".equals(codeString))
403          return GREATER_THAN;
404        if ("<".equals(codeString))
405          return LESS_THAN;
406        if (">=".equals(codeString))
407          return GREATER_OR_EQUAL;
408        if ("<=".equals(codeString))
409          return LESS_OR_EQUAL;
410        if (Configuration.isAcceptInvalidEnums())
411          return null;
412        else
413          throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
414        }
415        public String toCode() {
416          switch (this) {
417            case EXISTS: return "exists";
418            case EQUAL: return "=";
419            case NOT_EQUAL: return "!=";
420            case GREATER_THAN: return ">";
421            case LESS_THAN: return "<";
422            case GREATER_OR_EQUAL: return ">=";
423            case LESS_OR_EQUAL: return "<=";
424            case NULL: return null;
425            default: return "?";
426          }
427        }
428        public String getSystem() {
429          switch (this) {
430            case EXISTS: return "http://hl7.org/fhir/questionnaire-enable-operator";
431            case EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
432            case NOT_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
433            case GREATER_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
434            case LESS_THAN: return "http://hl7.org/fhir/questionnaire-enable-operator";
435            case GREATER_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
436            case LESS_OR_EQUAL: return "http://hl7.org/fhir/questionnaire-enable-operator";
437            case NULL: return null;
438            default: return "?";
439          }
440        }
441        public String getDefinition() {
442          switch (this) {
443            case EXISTS: return "True if the determination of 'whether an answer exists for the question' is equal to the enableWhen answer (which must be a boolean).";
444            case EQUAL: return "True if at least one answer has a value that is equal to the enableWhen answer.";
445            case NOT_EQUAL: return "True if no answer has a value that is equal to the enableWhen answer.";
446            case GREATER_THAN: return "True if at least one answer has a value that is greater than the enableWhen answer.";
447            case LESS_THAN: return "True if at least one answer has a value that is less than the enableWhen answer.";
448            case GREATER_OR_EQUAL: return "True if at least one answer has a value that is greater or equal to the enableWhen answer.";
449            case LESS_OR_EQUAL: return "True if at least one answer has a value that is less or equal to the enableWhen answer.";
450            case NULL: return null;
451            default: return "?";
452          }
453        }
454        public String getDisplay() {
455          switch (this) {
456            case EXISTS: return "Exists";
457            case EQUAL: return "Equals";
458            case NOT_EQUAL: return "Not Equals";
459            case GREATER_THAN: return "Greater Than";
460            case LESS_THAN: return "Less Than";
461            case GREATER_OR_EQUAL: return "Greater or Equals";
462            case LESS_OR_EQUAL: return "Less or Equals";
463            case NULL: return null;
464            default: return "?";
465          }
466        }
467    }
468
469  public static class QuestionnaireItemOperatorEnumFactory implements EnumFactory<QuestionnaireItemOperator> {
470    public QuestionnaireItemOperator fromCode(String codeString) throws IllegalArgumentException {
471      if (codeString == null || "".equals(codeString))
472            if (codeString == null || "".equals(codeString))
473                return null;
474        if ("exists".equals(codeString))
475          return QuestionnaireItemOperator.EXISTS;
476        if ("=".equals(codeString))
477          return QuestionnaireItemOperator.EQUAL;
478        if ("!=".equals(codeString))
479          return QuestionnaireItemOperator.NOT_EQUAL;
480        if (">".equals(codeString))
481          return QuestionnaireItemOperator.GREATER_THAN;
482        if ("<".equals(codeString))
483          return QuestionnaireItemOperator.LESS_THAN;
484        if (">=".equals(codeString))
485          return QuestionnaireItemOperator.GREATER_OR_EQUAL;
486        if ("<=".equals(codeString))
487          return QuestionnaireItemOperator.LESS_OR_EQUAL;
488        throw new IllegalArgumentException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
489        }
490        public Enumeration<QuestionnaireItemOperator> fromType(Base code) throws FHIRException {
491          if (code == null)
492            return null;
493          if (code.isEmpty())
494            return new Enumeration<QuestionnaireItemOperator>(this);
495          String codeString = ((PrimitiveType) code).asStringValue();
496          if (codeString == null || "".equals(codeString))
497            return null;
498        if ("exists".equals(codeString))
499          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EXISTS);
500        if ("=".equals(codeString))
501          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.EQUAL);
502        if ("!=".equals(codeString))
503          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.NOT_EQUAL);
504        if (">".equals(codeString))
505          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_THAN);
506        if ("<".equals(codeString))
507          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_THAN);
508        if (">=".equals(codeString))
509          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.GREATER_OR_EQUAL);
510        if ("<=".equals(codeString))
511          return new Enumeration<QuestionnaireItemOperator>(this, QuestionnaireItemOperator.LESS_OR_EQUAL);
512        throw new FHIRException("Unknown QuestionnaireItemOperator code '"+codeString+"'");
513        }
514    public String toCode(QuestionnaireItemOperator code) {
515      if (code == QuestionnaireItemOperator.EXISTS)
516        return "exists";
517      if (code == QuestionnaireItemOperator.EQUAL)
518        return "=";
519      if (code == QuestionnaireItemOperator.NOT_EQUAL)
520        return "!=";
521      if (code == QuestionnaireItemOperator.GREATER_THAN)
522        return ">";
523      if (code == QuestionnaireItemOperator.LESS_THAN)
524        return "<";
525      if (code == QuestionnaireItemOperator.GREATER_OR_EQUAL)
526        return ">=";
527      if (code == QuestionnaireItemOperator.LESS_OR_EQUAL)
528        return "<=";
529      return "?";
530      }
531    public String toSystem(QuestionnaireItemOperator code) {
532      return code.getSystem();
533      }
534    }
535
536    public enum QuestionnaireItemType {
537        /**
538         * An item with no direct answer but should have at least one child item.
539         */
540        GROUP, 
541        /**
542         * Text for display that will not capture an answer or have child items.
543         */
544        DISPLAY, 
545        /**
546         * An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).
547         */
548        QUESTION, 
549        /**
550         * Question with a yes/no answer (valueBoolean).
551         */
552        BOOLEAN, 
553        /**
554         * Question with is a real number answer (valueDecimal).
555         */
556        DECIMAL, 
557        /**
558         * Question with an integer answer (valueInteger).
559         */
560        INTEGER, 
561        /**
562         * Question with a date answer (valueDate).
563         */
564        DATE, 
565        /**
566         * Question with a date and time answer (valueDateTime).
567         */
568        DATETIME, 
569        /**
570         * Question with a time (hour:minute:second) answer independent of date. (valueTime).
571         */
572        TIME, 
573        /**
574         * Question with a short (few words to short sentence) free-text entry answer (valueString).
575         */
576        STRING, 
577        /**
578         * Question with a long (potentially multi-paragraph) free-text entry answer (valueString).
579         */
580        TEXT, 
581        /**
582         * Question with a URL (website, FTP site, etc.) answer (valueUri).
583         */
584        URL, 
585        /**
586         * Question with a Coding - generally drawn from a list of possible answers (valueCoding)
587         */
588        CODING, 
589        /**
590         * Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).
591         */
592        ATTACHMENT, 
593        /**
594         * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).
595         */
596        REFERENCE, 
597        /**
598         * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).
599         */
600        QUANTITY, 
601        /**
602         * added to help the parsers with the generic types
603         */
604        NULL;
605        public static QuestionnaireItemType fromCode(String codeString) throws FHIRException {
606            if (codeString == null || "".equals(codeString))
607                return null;
608        if ("group".equals(codeString))
609          return GROUP;
610        if ("display".equals(codeString))
611          return DISPLAY;
612        if ("question".equals(codeString))
613          return QUESTION;
614        if ("boolean".equals(codeString))
615          return BOOLEAN;
616        if ("decimal".equals(codeString))
617          return DECIMAL;
618        if ("integer".equals(codeString))
619          return INTEGER;
620        if ("date".equals(codeString))
621          return DATE;
622        if ("dateTime".equals(codeString))
623          return DATETIME;
624        if ("time".equals(codeString))
625          return TIME;
626        if ("string".equals(codeString))
627          return STRING;
628        if ("text".equals(codeString))
629          return TEXT;
630        if ("url".equals(codeString))
631          return URL;
632        if ("coding".equals(codeString))
633          return CODING;
634        if ("attachment".equals(codeString))
635          return ATTACHMENT;
636        if ("reference".equals(codeString))
637          return REFERENCE;
638        if ("quantity".equals(codeString))
639          return QUANTITY;
640        if (Configuration.isAcceptInvalidEnums())
641          return null;
642        else
643          throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
644        }
645        public String toCode() {
646          switch (this) {
647            case GROUP: return "group";
648            case DISPLAY: return "display";
649            case QUESTION: return "question";
650            case BOOLEAN: return "boolean";
651            case DECIMAL: return "decimal";
652            case INTEGER: return "integer";
653            case DATE: return "date";
654            case DATETIME: return "dateTime";
655            case TIME: return "time";
656            case STRING: return "string";
657            case TEXT: return "text";
658            case URL: return "url";
659            case CODING: return "coding";
660            case ATTACHMENT: return "attachment";
661            case REFERENCE: return "reference";
662            case QUANTITY: return "quantity";
663            case NULL: return null;
664            default: return "?";
665          }
666        }
667        public String getSystem() {
668          switch (this) {
669            case GROUP: return "http://hl7.org/fhir/item-type";
670            case DISPLAY: return "http://hl7.org/fhir/item-type";
671            case QUESTION: return "http://hl7.org/fhir/item-type";
672            case BOOLEAN: return "http://hl7.org/fhir/item-type";
673            case DECIMAL: return "http://hl7.org/fhir/item-type";
674            case INTEGER: return "http://hl7.org/fhir/item-type";
675            case DATE: return "http://hl7.org/fhir/item-type";
676            case DATETIME: return "http://hl7.org/fhir/item-type";
677            case TIME: return "http://hl7.org/fhir/item-type";
678            case STRING: return "http://hl7.org/fhir/item-type";
679            case TEXT: return "http://hl7.org/fhir/item-type";
680            case URL: return "http://hl7.org/fhir/item-type";
681            case CODING: return "http://hl7.org/fhir/item-type";
682            case ATTACHMENT: return "http://hl7.org/fhir/item-type";
683            case REFERENCE: return "http://hl7.org/fhir/item-type";
684            case QUANTITY: return "http://hl7.org/fhir/item-type";
685            case NULL: return null;
686            default: return "?";
687          }
688        }
689        public String getDefinition() {
690          switch (this) {
691            case GROUP: return "An item with no direct answer but should have at least one child item.";
692            case DISPLAY: return "Text for display that will not capture an answer or have child items.";
693            case QUESTION: return "An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype).";
694            case BOOLEAN: return "Question with a yes/no answer (valueBoolean).";
695            case DECIMAL: return "Question with is a real number answer (valueDecimal).";
696            case INTEGER: return "Question with an integer answer (valueInteger).";
697            case DATE: return "Question with a date answer (valueDate).";
698            case DATETIME: return "Question with a date and time answer (valueDateTime).";
699            case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime).";
700            case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString).";
701            case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString).";
702            case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri).";
703            case CODING: return "Question with a Coding - generally drawn from a list of possible answers (valueCoding)";
704            case ATTACHMENT: return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment).";
705            case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference).";
706            case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit).";
707            case NULL: return null;
708            default: return "?";
709          }
710        }
711        public String getDisplay() {
712          switch (this) {
713            case GROUP: return "Group";
714            case DISPLAY: return "Display";
715            case QUESTION: return "Question";
716            case BOOLEAN: return "Boolean";
717            case DECIMAL: return "Decimal";
718            case INTEGER: return "Integer";
719            case DATE: return "Date";
720            case DATETIME: return "Date Time";
721            case TIME: return "Time";
722            case STRING: return "String";
723            case TEXT: return "Text";
724            case URL: return "Url";
725            case CODING: return "Coding";
726            case ATTACHMENT: return "Attachment";
727            case REFERENCE: return "Reference";
728            case QUANTITY: return "Quantity";
729            case NULL: return null;
730            default: return "?";
731          }
732        }
733    }
734
735  public static class QuestionnaireItemTypeEnumFactory implements EnumFactory<QuestionnaireItemType> {
736    public QuestionnaireItemType fromCode(String codeString) throws IllegalArgumentException {
737      if (codeString == null || "".equals(codeString))
738            if (codeString == null || "".equals(codeString))
739                return null;
740        if ("group".equals(codeString))
741          return QuestionnaireItemType.GROUP;
742        if ("display".equals(codeString))
743          return QuestionnaireItemType.DISPLAY;
744        if ("question".equals(codeString))
745          return QuestionnaireItemType.QUESTION;
746        if ("boolean".equals(codeString))
747          return QuestionnaireItemType.BOOLEAN;
748        if ("decimal".equals(codeString))
749          return QuestionnaireItemType.DECIMAL;
750        if ("integer".equals(codeString))
751          return QuestionnaireItemType.INTEGER;
752        if ("date".equals(codeString))
753          return QuestionnaireItemType.DATE;
754        if ("dateTime".equals(codeString))
755          return QuestionnaireItemType.DATETIME;
756        if ("time".equals(codeString))
757          return QuestionnaireItemType.TIME;
758        if ("string".equals(codeString))
759          return QuestionnaireItemType.STRING;
760        if ("text".equals(codeString))
761          return QuestionnaireItemType.TEXT;
762        if ("url".equals(codeString))
763          return QuestionnaireItemType.URL;
764        if ("coding".equals(codeString))
765          return QuestionnaireItemType.CODING;
766        if ("attachment".equals(codeString))
767          return QuestionnaireItemType.ATTACHMENT;
768        if ("reference".equals(codeString))
769          return QuestionnaireItemType.REFERENCE;
770        if ("quantity".equals(codeString))
771          return QuestionnaireItemType.QUANTITY;
772        throw new IllegalArgumentException("Unknown QuestionnaireItemType code '"+codeString+"'");
773        }
774        public Enumeration<QuestionnaireItemType> fromType(Base code) throws FHIRException {
775          if (code == null)
776            return null;
777          if (code.isEmpty())
778            return new Enumeration<QuestionnaireItemType>(this);
779          String codeString = ((PrimitiveType) code).asStringValue();
780          if (codeString == null || "".equals(codeString))
781            return null;
782        if ("group".equals(codeString))
783          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.GROUP);
784        if ("display".equals(codeString))
785          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DISPLAY);
786        if ("question".equals(codeString))
787          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUESTION);
788        if ("boolean".equals(codeString))
789          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.BOOLEAN);
790        if ("decimal".equals(codeString))
791          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DECIMAL);
792        if ("integer".equals(codeString))
793          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.INTEGER);
794        if ("date".equals(codeString))
795          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATE);
796        if ("dateTime".equals(codeString))
797          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.DATETIME);
798        if ("time".equals(codeString))
799          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TIME);
800        if ("string".equals(codeString))
801          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.STRING);
802        if ("text".equals(codeString))
803          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.TEXT);
804        if ("url".equals(codeString))
805          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.URL);
806        if ("coding".equals(codeString))
807          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.CODING);
808        if ("attachment".equals(codeString))
809          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.ATTACHMENT);
810        if ("reference".equals(codeString))
811          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.REFERENCE);
812        if ("quantity".equals(codeString))
813          return new Enumeration<QuestionnaireItemType>(this, QuestionnaireItemType.QUANTITY);
814        throw new FHIRException("Unknown QuestionnaireItemType code '"+codeString+"'");
815        }
816    public String toCode(QuestionnaireItemType code) {
817      if (code == QuestionnaireItemType.GROUP)
818        return "group";
819      if (code == QuestionnaireItemType.DISPLAY)
820        return "display";
821      if (code == QuestionnaireItemType.QUESTION)
822        return "question";
823      if (code == QuestionnaireItemType.BOOLEAN)
824        return "boolean";
825      if (code == QuestionnaireItemType.DECIMAL)
826        return "decimal";
827      if (code == QuestionnaireItemType.INTEGER)
828        return "integer";
829      if (code == QuestionnaireItemType.DATE)
830        return "date";
831      if (code == QuestionnaireItemType.DATETIME)
832        return "dateTime";
833      if (code == QuestionnaireItemType.TIME)
834        return "time";
835      if (code == QuestionnaireItemType.STRING)
836        return "string";
837      if (code == QuestionnaireItemType.TEXT)
838        return "text";
839      if (code == QuestionnaireItemType.URL)
840        return "url";
841      if (code == QuestionnaireItemType.CODING)
842        return "coding";
843      if (code == QuestionnaireItemType.ATTACHMENT)
844        return "attachment";
845      if (code == QuestionnaireItemType.REFERENCE)
846        return "reference";
847      if (code == QuestionnaireItemType.QUANTITY)
848        return "quantity";
849      return "?";
850      }
851    public String toSystem(QuestionnaireItemType code) {
852      return code.getSystem();
853      }
854    }
855
856    @Block()
857    public static class QuestionnaireItemComponent extends BackboneElement implements IBaseBackboneElement {
858        /**
859         * An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
860         */
861        @Child(name = "linkId", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
862        @Description(shortDefinition="Unique id for item in questionnaire", formalDefinition="An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource." )
863        protected StringType linkId;
864
865        /**
866         * This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.
867         */
868        @Child(name = "definition", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
869        @Description(shortDefinition="ElementDefinition - details for the item", formalDefinition="This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below." )
870        protected UriType definition;
871
872        /**
873         * A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).
874         */
875        @Child(name = "code", type = {Coding.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
876        @Description(shortDefinition="Corresponding concept for this item in a terminology", formalDefinition="A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers)." )
877        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
878        protected List<Coding> code;
879
880        /**
881         * A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
882         */
883        @Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
884        @Description(shortDefinition="E.g. \"1(a)\", \"2.5.3\"", formalDefinition="A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire." )
885        protected StringType prefix;
886
887        /**
888         * The name of a section, the text of a question or text content for a display item.
889         */
890        @Child(name = "text", type = {MarkdownType.class}, order=5, min=0, max=1, modifier=false, summary=false)
891        @Description(shortDefinition="Primary text for the item", formalDefinition="The name of a section, the text of a question or text content for a display item." )
892        protected MarkdownType text;
893
894        /**
895         * The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).
896         */
897        @Child(name = "type", type = {CodeType.class}, order=6, min=1, max=1, modifier=false, summary=false)
898        @Description(shortDefinition="group | display | boolean | decimal | integer | date | dateTime +", formalDefinition="The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.)." )
899        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/item-type")
900        protected Enumeration<QuestionnaireItemType> type;
901
902        /**
903         * A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.
904         */
905        @Child(name = "enableWhen", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false)
906        @Description(shortDefinition="Only allow data when", formalDefinition="A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true." )
907        protected List<QuestionnaireItemEnableWhenComponent> enableWhen;
908
909        /**
910         * Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
911         */
912        @Child(name = "enableBehavior", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
913        @Description(shortDefinition="all | any", formalDefinition="Controls how multiple enableWhen values are interpreted -  whether all or any must be true." )
914        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-behavior")
915        protected Enumeration<EnableWhenBehavior> enableBehavior;
916
917        /**
918         * Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.
919         */
920        @Child(name = "disabledDisplay", type = {CodeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
921        @Description(shortDefinition="hidden | protected", formalDefinition="Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed." )
922        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-disabled-display")
923        protected Enumeration<QuestionnaireItemDisabledDisplay> disabledDisplay;
924
925        /**
926         * An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
927         */
928        @Child(name = "required", type = {BooleanType.class}, order=10, min=0, max=1, modifier=false, summary=false)
929        @Description(shortDefinition="Whether the item must be included in data results", formalDefinition="An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire." )
930        protected BooleanType required;
931
932        /**
933         * An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
934         */
935        @Child(name = "repeats", type = {BooleanType.class}, order=11, min=0, max=1, modifier=false, summary=false)
936        @Description(shortDefinition="Whether the item may repeat", formalDefinition="An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups." )
937        protected BooleanType repeats;
938
939        /**
940         * An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
941         */
942        @Child(name = "readOnly", type = {BooleanType.class}, order=12, min=0, max=1, modifier=false, summary=false)
943        @Description(shortDefinition="Don't allow human editing", formalDefinition="An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire." )
944        protected BooleanType readOnly;
945
946        /**
947         * The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
948         */
949        @Child(name = "maxLength", type = {IntegerType.class}, order=13, min=0, max=1, modifier=false, summary=false)
950        @Description(shortDefinition="No more than this many characters", formalDefinition="The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse." )
951        protected IntegerType maxLength;
952
953        /**
954         * For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.
955         */
956        @Child(name = "answerConstraint", type = {CodeType.class}, order=14, min=0, max=1, modifier=false, summary=false)
957        @Description(shortDefinition="optionsOnly | optionsOrType | optionsOrString", formalDefinition="For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected." )
958        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answer-constraint")
959        protected Enumeration<QuestionnaireAnswerConstraint> answerConstraint;
960
961        /**
962         * A reference to a value set containing a list of values representing permitted answers for a question.
963         */
964        @Child(name = "answerValueSet", type = {CanonicalType.class}, order=15, min=0, max=1, modifier=false, summary=false)
965        @Description(shortDefinition="Valueset containing permitted answers", formalDefinition="A reference to a value set containing a list of values representing permitted answers for a question." )
966        protected CanonicalType answerValueSet;
967
968        /**
969         * One of the permitted answers for the question.
970         */
971        @Child(name = "answerOption", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
972        @Description(shortDefinition="Permitted answer", formalDefinition="One of the permitted answers for the question." )
973        protected List<QuestionnaireItemAnswerOptionComponent> answerOption;
974
975        /**
976         * One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.
977         */
978        @Child(name = "initial", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
979        @Description(shortDefinition="Initial value(s) when item is first rendered", formalDefinition="One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input." )
980        protected List<QuestionnaireItemInitialComponent> initial;
981
982        /**
983         * Text, questions and other groups to be nested beneath a question or group.
984         */
985        @Child(name = "item", type = {QuestionnaireItemComponent.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
986        @Description(shortDefinition="Nested questionnaire items", formalDefinition="Text, questions and other groups to be nested beneath a question or group." )
987        protected List<QuestionnaireItemComponent> item;
988
989        private static final long serialVersionUID = 794112941L;
990
991    /**
992     * Constructor
993     */
994      public QuestionnaireItemComponent() {
995        super();
996      }
997
998    /**
999     * Constructor
1000     */
1001      public QuestionnaireItemComponent(String linkId, QuestionnaireItemType type) {
1002        super();
1003        this.setLinkId(linkId);
1004        this.setType(type);
1005      }
1006
1007        /**
1008         * @return {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
1009         */
1010        public StringType getLinkIdElement() { 
1011          if (this.linkId == null)
1012            if (Configuration.errorOnAutoCreate())
1013              throw new Error("Attempt to auto-create QuestionnaireItemComponent.linkId");
1014            else if (Configuration.doAutoCreate())
1015              this.linkId = new StringType(); // bb
1016          return this.linkId;
1017        }
1018
1019        public boolean hasLinkIdElement() { 
1020          return this.linkId != null && !this.linkId.isEmpty();
1021        }
1022
1023        public boolean hasLinkId() { 
1024          return this.linkId != null && !this.linkId.isEmpty();
1025        }
1026
1027        /**
1028         * @param value {@link #linkId} (An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
1029         */
1030        public QuestionnaireItemComponent setLinkIdElement(StringType value) { 
1031          this.linkId = value;
1032          return this;
1033        }
1034
1035        /**
1036         * @return An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
1037         */
1038        public String getLinkId() { 
1039          return this.linkId == null ? null : this.linkId.getValue();
1040        }
1041
1042        /**
1043         * @param value An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.
1044         */
1045        public QuestionnaireItemComponent setLinkId(String value) { 
1046            if (this.linkId == null)
1047              this.linkId = new StringType();
1048            this.linkId.setValue(value);
1049          return this;
1050        }
1051
1052        /**
1053         * @return {@link #definition} (This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
1054         */
1055        public UriType getDefinitionElement() { 
1056          if (this.definition == null)
1057            if (Configuration.errorOnAutoCreate())
1058              throw new Error("Attempt to auto-create QuestionnaireItemComponent.definition");
1059            else if (Configuration.doAutoCreate())
1060              this.definition = new UriType(); // bb
1061          return this.definition;
1062        }
1063
1064        public boolean hasDefinitionElement() { 
1065          return this.definition != null && !this.definition.isEmpty();
1066        }
1067
1068        public boolean hasDefinition() { 
1069          return this.definition != null && !this.definition.isEmpty();
1070        }
1071
1072        /**
1073         * @param value {@link #definition} (This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
1074         */
1075        public QuestionnaireItemComponent setDefinitionElement(UriType value) { 
1076          this.definition = value;
1077          return this;
1078        }
1079
1080        /**
1081         * @return This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.
1082         */
1083        public String getDefinition() { 
1084          return this.definition == null ? null : this.definition.getValue();
1085        }
1086
1087        /**
1088         * @param value This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.
1089         */
1090        public QuestionnaireItemComponent setDefinition(String value) { 
1091          if (Utilities.noString(value))
1092            this.definition = null;
1093          else {
1094            if (this.definition == null)
1095              this.definition = new UriType();
1096            this.definition.setValue(value);
1097          }
1098          return this;
1099        }
1100
1101        /**
1102         * @return {@link #code} (A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).)
1103         */
1104        public List<Coding> getCode() { 
1105          if (this.code == null)
1106            this.code = new ArrayList<Coding>();
1107          return this.code;
1108        }
1109
1110        /**
1111         * @return Returns a reference to <code>this</code> for easy method chaining
1112         */
1113        public QuestionnaireItemComponent setCode(List<Coding> theCode) { 
1114          this.code = theCode;
1115          return this;
1116        }
1117
1118        public boolean hasCode() { 
1119          if (this.code == null)
1120            return false;
1121          for (Coding item : this.code)
1122            if (!item.isEmpty())
1123              return true;
1124          return false;
1125        }
1126
1127        public Coding addCode() { //3
1128          Coding t = new Coding();
1129          if (this.code == null)
1130            this.code = new ArrayList<Coding>();
1131          this.code.add(t);
1132          return t;
1133        }
1134
1135        public QuestionnaireItemComponent addCode(Coding t) { //3
1136          if (t == null)
1137            return this;
1138          if (this.code == null)
1139            this.code = new ArrayList<Coding>();
1140          this.code.add(t);
1141          return this;
1142        }
1143
1144        /**
1145         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
1146         */
1147        public Coding getCodeFirstRep() { 
1148          if (getCode().isEmpty()) {
1149            addCode();
1150          }
1151          return getCode().get(0);
1152        }
1153
1154        /**
1155         * @return {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1156         */
1157        public StringType getPrefixElement() { 
1158          if (this.prefix == null)
1159            if (Configuration.errorOnAutoCreate())
1160              throw new Error("Attempt to auto-create QuestionnaireItemComponent.prefix");
1161            else if (Configuration.doAutoCreate())
1162              this.prefix = new StringType(); // bb
1163          return this.prefix;
1164        }
1165
1166        public boolean hasPrefixElement() { 
1167          return this.prefix != null && !this.prefix.isEmpty();
1168        }
1169
1170        public boolean hasPrefix() { 
1171          return this.prefix != null && !this.prefix.isEmpty();
1172        }
1173
1174        /**
1175         * @param value {@link #prefix} (A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1176         */
1177        public QuestionnaireItemComponent setPrefixElement(StringType value) { 
1178          this.prefix = value;
1179          return this;
1180        }
1181
1182        /**
1183         * @return A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1184         */
1185        public String getPrefix() { 
1186          return this.prefix == null ? null : this.prefix.getValue();
1187        }
1188
1189        /**
1190         * @param value A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.
1191         */
1192        public QuestionnaireItemComponent setPrefix(String value) { 
1193          if (Utilities.noString(value))
1194            this.prefix = null;
1195          else {
1196            if (this.prefix == null)
1197              this.prefix = new StringType();
1198            this.prefix.setValue(value);
1199          }
1200          return this;
1201        }
1202
1203        /**
1204         * @return {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1205         */
1206        public MarkdownType getTextElement() { 
1207          if (this.text == null)
1208            if (Configuration.errorOnAutoCreate())
1209              throw new Error("Attempt to auto-create QuestionnaireItemComponent.text");
1210            else if (Configuration.doAutoCreate())
1211              this.text = new MarkdownType(); // bb
1212          return this.text;
1213        }
1214
1215        public boolean hasTextElement() { 
1216          return this.text != null && !this.text.isEmpty();
1217        }
1218
1219        public boolean hasText() { 
1220          return this.text != null && !this.text.isEmpty();
1221        }
1222
1223        /**
1224         * @param value {@link #text} (The name of a section, the text of a question or text content for a display item.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
1225         */
1226        public QuestionnaireItemComponent setTextElement(MarkdownType value) { 
1227          this.text = value;
1228          return this;
1229        }
1230
1231        /**
1232         * @return The name of a section, the text of a question or text content for a display item.
1233         */
1234        public String getText() { 
1235          return this.text == null ? null : this.text.getValue();
1236        }
1237
1238        /**
1239         * @param value The name of a section, the text of a question or text content for a display item.
1240         */
1241        public QuestionnaireItemComponent setText(String value) { 
1242          if (value == null)
1243            this.text = null;
1244          else {
1245            if (this.text == null)
1246              this.text = new MarkdownType();
1247            this.text.setValue(value);
1248          }
1249          return this;
1250        }
1251
1252        /**
1253         * @return {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1254         */
1255        public Enumeration<QuestionnaireItemType> getTypeElement() { 
1256          if (this.type == null)
1257            if (Configuration.errorOnAutoCreate())
1258              throw new Error("Attempt to auto-create QuestionnaireItemComponent.type");
1259            else if (Configuration.doAutoCreate())
1260              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory()); // bb
1261          return this.type;
1262        }
1263
1264        public boolean hasTypeElement() { 
1265          return this.type != null && !this.type.isEmpty();
1266        }
1267
1268        public boolean hasType() { 
1269          return this.type != null && !this.type.isEmpty();
1270        }
1271
1272        /**
1273         * @param value {@link #type} (The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1274         */
1275        public QuestionnaireItemComponent setTypeElement(Enumeration<QuestionnaireItemType> value) { 
1276          this.type = value;
1277          return this;
1278        }
1279
1280        /**
1281         * @return The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).
1282         */
1283        public QuestionnaireItemType getType() { 
1284          return this.type == null ? null : this.type.getValue();
1285        }
1286
1287        /**
1288         * @param value The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).
1289         */
1290        public QuestionnaireItemComponent setType(QuestionnaireItemType value) { 
1291            if (this.type == null)
1292              this.type = new Enumeration<QuestionnaireItemType>(new QuestionnaireItemTypeEnumFactory());
1293            this.type.setValue(value);
1294          return this;
1295        }
1296
1297        /**
1298         * @return {@link #enableWhen} (A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.)
1299         */
1300        public List<QuestionnaireItemEnableWhenComponent> getEnableWhen() { 
1301          if (this.enableWhen == null)
1302            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1303          return this.enableWhen;
1304        }
1305
1306        /**
1307         * @return Returns a reference to <code>this</code> for easy method chaining
1308         */
1309        public QuestionnaireItemComponent setEnableWhen(List<QuestionnaireItemEnableWhenComponent> theEnableWhen) { 
1310          this.enableWhen = theEnableWhen;
1311          return this;
1312        }
1313
1314        public boolean hasEnableWhen() { 
1315          if (this.enableWhen == null)
1316            return false;
1317          for (QuestionnaireItemEnableWhenComponent item : this.enableWhen)
1318            if (!item.isEmpty())
1319              return true;
1320          return false;
1321        }
1322
1323        public QuestionnaireItemEnableWhenComponent addEnableWhen() { //3
1324          QuestionnaireItemEnableWhenComponent t = new QuestionnaireItemEnableWhenComponent();
1325          if (this.enableWhen == null)
1326            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1327          this.enableWhen.add(t);
1328          return t;
1329        }
1330
1331        public QuestionnaireItemComponent addEnableWhen(QuestionnaireItemEnableWhenComponent t) { //3
1332          if (t == null)
1333            return this;
1334          if (this.enableWhen == null)
1335            this.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
1336          this.enableWhen.add(t);
1337          return this;
1338        }
1339
1340        /**
1341         * @return The first repetition of repeating field {@link #enableWhen}, creating it if it does not already exist {3}
1342         */
1343        public QuestionnaireItemEnableWhenComponent getEnableWhenFirstRep() { 
1344          if (getEnableWhen().isEmpty()) {
1345            addEnableWhen();
1346          }
1347          return getEnableWhen().get(0);
1348        }
1349
1350        /**
1351         * @return {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1352         */
1353        public Enumeration<EnableWhenBehavior> getEnableBehaviorElement() { 
1354          if (this.enableBehavior == null)
1355            if (Configuration.errorOnAutoCreate())
1356              throw new Error("Attempt to auto-create QuestionnaireItemComponent.enableBehavior");
1357            else if (Configuration.doAutoCreate())
1358              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory()); // bb
1359          return this.enableBehavior;
1360        }
1361
1362        public boolean hasEnableBehaviorElement() { 
1363          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1364        }
1365
1366        public boolean hasEnableBehavior() { 
1367          return this.enableBehavior != null && !this.enableBehavior.isEmpty();
1368        }
1369
1370        /**
1371         * @param value {@link #enableBehavior} (Controls how multiple enableWhen values are interpreted -  whether all or any must be true.). This is the underlying object with id, value and extensions. The accessor "getEnableBehavior" gives direct access to the value
1372         */
1373        public QuestionnaireItemComponent setEnableBehaviorElement(Enumeration<EnableWhenBehavior> value) { 
1374          this.enableBehavior = value;
1375          return this;
1376        }
1377
1378        /**
1379         * @return Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1380         */
1381        public EnableWhenBehavior getEnableBehavior() { 
1382          return this.enableBehavior == null ? null : this.enableBehavior.getValue();
1383        }
1384
1385        /**
1386         * @param value Controls how multiple enableWhen values are interpreted -  whether all or any must be true.
1387         */
1388        public QuestionnaireItemComponent setEnableBehavior(EnableWhenBehavior value) { 
1389          if (value == null)
1390            this.enableBehavior = null;
1391          else {
1392            if (this.enableBehavior == null)
1393              this.enableBehavior = new Enumeration<EnableWhenBehavior>(new EnableWhenBehaviorEnumFactory());
1394            this.enableBehavior.setValue(value);
1395          }
1396          return this;
1397        }
1398
1399        /**
1400         * @return {@link #disabledDisplay} (Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.). This is the underlying object with id, value and extensions. The accessor "getDisabledDisplay" gives direct access to the value
1401         */
1402        public Enumeration<QuestionnaireItemDisabledDisplay> getDisabledDisplayElement() { 
1403          if (this.disabledDisplay == null)
1404            if (Configuration.errorOnAutoCreate())
1405              throw new Error("Attempt to auto-create QuestionnaireItemComponent.disabledDisplay");
1406            else if (Configuration.doAutoCreate())
1407              this.disabledDisplay = new Enumeration<QuestionnaireItemDisabledDisplay>(new QuestionnaireItemDisabledDisplayEnumFactory()); // bb
1408          return this.disabledDisplay;
1409        }
1410
1411        public boolean hasDisabledDisplayElement() { 
1412          return this.disabledDisplay != null && !this.disabledDisplay.isEmpty();
1413        }
1414
1415        public boolean hasDisabledDisplay() { 
1416          return this.disabledDisplay != null && !this.disabledDisplay.isEmpty();
1417        }
1418
1419        /**
1420         * @param value {@link #disabledDisplay} (Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.). This is the underlying object with id, value and extensions. The accessor "getDisabledDisplay" gives direct access to the value
1421         */
1422        public QuestionnaireItemComponent setDisabledDisplayElement(Enumeration<QuestionnaireItemDisabledDisplay> value) { 
1423          this.disabledDisplay = value;
1424          return this;
1425        }
1426
1427        /**
1428         * @return Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.
1429         */
1430        public QuestionnaireItemDisabledDisplay getDisabledDisplay() { 
1431          return this.disabledDisplay == null ? null : this.disabledDisplay.getValue();
1432        }
1433
1434        /**
1435         * @param value Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.
1436         */
1437        public QuestionnaireItemComponent setDisabledDisplay(QuestionnaireItemDisabledDisplay value) { 
1438          if (value == null)
1439            this.disabledDisplay = null;
1440          else {
1441            if (this.disabledDisplay == null)
1442              this.disabledDisplay = new Enumeration<QuestionnaireItemDisabledDisplay>(new QuestionnaireItemDisabledDisplayEnumFactory());
1443            this.disabledDisplay.setValue(value);
1444          }
1445          return this;
1446        }
1447
1448        /**
1449         * @return {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1450         */
1451        public BooleanType getRequiredElement() { 
1452          if (this.required == null)
1453            if (Configuration.errorOnAutoCreate())
1454              throw new Error("Attempt to auto-create QuestionnaireItemComponent.required");
1455            else if (Configuration.doAutoCreate())
1456              this.required = new BooleanType(); // bb
1457          return this.required;
1458        }
1459
1460        public boolean hasRequiredElement() { 
1461          return this.required != null && !this.required.isEmpty();
1462        }
1463
1464        public boolean hasRequired() { 
1465          return this.required != null && !this.required.isEmpty();
1466        }
1467
1468        /**
1469         * @param value {@link #required} (An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getRequired" gives direct access to the value
1470         */
1471        public QuestionnaireItemComponent setRequiredElement(BooleanType value) { 
1472          this.required = value;
1473          return this;
1474        }
1475
1476        /**
1477         * @return An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1478         */
1479        public boolean getRequired() { 
1480          return this.required == null || this.required.isEmpty() ? false : this.required.getValue();
1481        }
1482
1483        /**
1484         * @param value An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.
1485         */
1486        public QuestionnaireItemComponent setRequired(boolean value) { 
1487            if (this.required == null)
1488              this.required = new BooleanType();
1489            this.required.setValue(value);
1490          return this;
1491        }
1492
1493        /**
1494         * @return {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1495         */
1496        public BooleanType getRepeatsElement() { 
1497          if (this.repeats == null)
1498            if (Configuration.errorOnAutoCreate())
1499              throw new Error("Attempt to auto-create QuestionnaireItemComponent.repeats");
1500            else if (Configuration.doAutoCreate())
1501              this.repeats = new BooleanType(); // bb
1502          return this.repeats;
1503        }
1504
1505        public boolean hasRepeatsElement() { 
1506          return this.repeats != null && !this.repeats.isEmpty();
1507        }
1508
1509        public boolean hasRepeats() { 
1510          return this.repeats != null && !this.repeats.isEmpty();
1511        }
1512
1513        /**
1514         * @param value {@link #repeats} (An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.). This is the underlying object with id, value and extensions. The accessor "getRepeats" gives direct access to the value
1515         */
1516        public QuestionnaireItemComponent setRepeatsElement(BooleanType value) { 
1517          this.repeats = value;
1518          return this;
1519        }
1520
1521        /**
1522         * @return An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1523         */
1524        public boolean getRepeats() { 
1525          return this.repeats == null || this.repeats.isEmpty() ? false : this.repeats.getValue();
1526        }
1527
1528        /**
1529         * @param value An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.
1530         */
1531        public QuestionnaireItemComponent setRepeats(boolean value) { 
1532            if (this.repeats == null)
1533              this.repeats = new BooleanType();
1534            this.repeats.setValue(value);
1535          return this;
1536        }
1537
1538        /**
1539         * @return {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1540         */
1541        public BooleanType getReadOnlyElement() { 
1542          if (this.readOnly == null)
1543            if (Configuration.errorOnAutoCreate())
1544              throw new Error("Attempt to auto-create QuestionnaireItemComponent.readOnly");
1545            else if (Configuration.doAutoCreate())
1546              this.readOnly = new BooleanType(); // bb
1547          return this.readOnly;
1548        }
1549
1550        public boolean hasReadOnlyElement() { 
1551          return this.readOnly != null && !this.readOnly.isEmpty();
1552        }
1553
1554        public boolean hasReadOnly() { 
1555          return this.readOnly != null && !this.readOnly.isEmpty();
1556        }
1557
1558        /**
1559         * @param value {@link #readOnly} (An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.). This is the underlying object with id, value and extensions. The accessor "getReadOnly" gives direct access to the value
1560         */
1561        public QuestionnaireItemComponent setReadOnlyElement(BooleanType value) { 
1562          this.readOnly = value;
1563          return this;
1564        }
1565
1566        /**
1567         * @return An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1568         */
1569        public boolean getReadOnly() { 
1570          return this.readOnly == null || this.readOnly.isEmpty() ? false : this.readOnly.getValue();
1571        }
1572
1573        /**
1574         * @param value An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.
1575         */
1576        public QuestionnaireItemComponent setReadOnly(boolean value) { 
1577            if (this.readOnly == null)
1578              this.readOnly = new BooleanType();
1579            this.readOnly.setValue(value);
1580          return this;
1581        }
1582
1583        /**
1584         * @return {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1585         */
1586        public IntegerType getMaxLengthElement() { 
1587          if (this.maxLength == null)
1588            if (Configuration.errorOnAutoCreate())
1589              throw new Error("Attempt to auto-create QuestionnaireItemComponent.maxLength");
1590            else if (Configuration.doAutoCreate())
1591              this.maxLength = new IntegerType(); // bb
1592          return this.maxLength;
1593        }
1594
1595        public boolean hasMaxLengthElement() { 
1596          return this.maxLength != null && !this.maxLength.isEmpty();
1597        }
1598
1599        public boolean hasMaxLength() { 
1600          return this.maxLength != null && !this.maxLength.isEmpty();
1601        }
1602
1603        /**
1604         * @param value {@link #maxLength} (The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
1605         */
1606        public QuestionnaireItemComponent setMaxLengthElement(IntegerType value) { 
1607          this.maxLength = value;
1608          return this;
1609        }
1610
1611        /**
1612         * @return The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1613         */
1614        public int getMaxLength() { 
1615          return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
1616        }
1617
1618        /**
1619         * @param value The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.
1620         */
1621        public QuestionnaireItemComponent setMaxLength(int value) { 
1622            if (this.maxLength == null)
1623              this.maxLength = new IntegerType();
1624            this.maxLength.setValue(value);
1625          return this;
1626        }
1627
1628        /**
1629         * @return {@link #answerConstraint} (For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.). This is the underlying object with id, value and extensions. The accessor "getAnswerConstraint" gives direct access to the value
1630         */
1631        public Enumeration<QuestionnaireAnswerConstraint> getAnswerConstraintElement() { 
1632          if (this.answerConstraint == null)
1633            if (Configuration.errorOnAutoCreate())
1634              throw new Error("Attempt to auto-create QuestionnaireItemComponent.answerConstraint");
1635            else if (Configuration.doAutoCreate())
1636              this.answerConstraint = new Enumeration<QuestionnaireAnswerConstraint>(new QuestionnaireAnswerConstraintEnumFactory()); // bb
1637          return this.answerConstraint;
1638        }
1639
1640        public boolean hasAnswerConstraintElement() { 
1641          return this.answerConstraint != null && !this.answerConstraint.isEmpty();
1642        }
1643
1644        public boolean hasAnswerConstraint() { 
1645          return this.answerConstraint != null && !this.answerConstraint.isEmpty();
1646        }
1647
1648        /**
1649         * @param value {@link #answerConstraint} (For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.). This is the underlying object with id, value and extensions. The accessor "getAnswerConstraint" gives direct access to the value
1650         */
1651        public QuestionnaireItemComponent setAnswerConstraintElement(Enumeration<QuestionnaireAnswerConstraint> value) { 
1652          this.answerConstraint = value;
1653          return this;
1654        }
1655
1656        /**
1657         * @return For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.
1658         */
1659        public QuestionnaireAnswerConstraint getAnswerConstraint() { 
1660          return this.answerConstraint == null ? null : this.answerConstraint.getValue();
1661        }
1662
1663        /**
1664         * @param value For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.
1665         */
1666        public QuestionnaireItemComponent setAnswerConstraint(QuestionnaireAnswerConstraint value) { 
1667          if (value == null)
1668            this.answerConstraint = null;
1669          else {
1670            if (this.answerConstraint == null)
1671              this.answerConstraint = new Enumeration<QuestionnaireAnswerConstraint>(new QuestionnaireAnswerConstraintEnumFactory());
1672            this.answerConstraint.setValue(value);
1673          }
1674          return this;
1675        }
1676
1677        /**
1678         * @return {@link #answerValueSet} (A reference to a value set containing a list of values representing permitted answers for a question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1679         */
1680        public CanonicalType getAnswerValueSetElement() { 
1681          if (this.answerValueSet == null)
1682            if (Configuration.errorOnAutoCreate())
1683              throw new Error("Attempt to auto-create QuestionnaireItemComponent.answerValueSet");
1684            else if (Configuration.doAutoCreate())
1685              this.answerValueSet = new CanonicalType(); // bb
1686          return this.answerValueSet;
1687        }
1688
1689        public boolean hasAnswerValueSetElement() { 
1690          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1691        }
1692
1693        public boolean hasAnswerValueSet() { 
1694          return this.answerValueSet != null && !this.answerValueSet.isEmpty();
1695        }
1696
1697        /**
1698         * @param value {@link #answerValueSet} (A reference to a value set containing a list of values representing permitted answers for a question.). This is the underlying object with id, value and extensions. The accessor "getAnswerValueSet" gives direct access to the value
1699         */
1700        public QuestionnaireItemComponent setAnswerValueSetElement(CanonicalType value) { 
1701          this.answerValueSet = value;
1702          return this;
1703        }
1704
1705        /**
1706         * @return A reference to a value set containing a list of values representing permitted answers for a question.
1707         */
1708        public String getAnswerValueSet() { 
1709          return this.answerValueSet == null ? null : this.answerValueSet.getValue();
1710        }
1711
1712        /**
1713         * @param value A reference to a value set containing a list of values representing permitted answers for a question.
1714         */
1715        public QuestionnaireItemComponent setAnswerValueSet(String value) { 
1716          if (Utilities.noString(value))
1717            this.answerValueSet = null;
1718          else {
1719            if (this.answerValueSet == null)
1720              this.answerValueSet = new CanonicalType();
1721            this.answerValueSet.setValue(value);
1722          }
1723          return this;
1724        }
1725
1726        /**
1727         * @return {@link #answerOption} (One of the permitted answers for the question.)
1728         */
1729        public List<QuestionnaireItemAnswerOptionComponent> getAnswerOption() { 
1730          if (this.answerOption == null)
1731            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1732          return this.answerOption;
1733        }
1734
1735        /**
1736         * @return Returns a reference to <code>this</code> for easy method chaining
1737         */
1738        public QuestionnaireItemComponent setAnswerOption(List<QuestionnaireItemAnswerOptionComponent> theAnswerOption) { 
1739          this.answerOption = theAnswerOption;
1740          return this;
1741        }
1742
1743        public boolean hasAnswerOption() { 
1744          if (this.answerOption == null)
1745            return false;
1746          for (QuestionnaireItemAnswerOptionComponent item : this.answerOption)
1747            if (!item.isEmpty())
1748              return true;
1749          return false;
1750        }
1751
1752        public QuestionnaireItemAnswerOptionComponent addAnswerOption() { //3
1753          QuestionnaireItemAnswerOptionComponent t = new QuestionnaireItemAnswerOptionComponent();
1754          if (this.answerOption == null)
1755            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1756          this.answerOption.add(t);
1757          return t;
1758        }
1759
1760        public QuestionnaireItemComponent addAnswerOption(QuestionnaireItemAnswerOptionComponent t) { //3
1761          if (t == null)
1762            return this;
1763          if (this.answerOption == null)
1764            this.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
1765          this.answerOption.add(t);
1766          return this;
1767        }
1768
1769        /**
1770         * @return The first repetition of repeating field {@link #answerOption}, creating it if it does not already exist {3}
1771         */
1772        public QuestionnaireItemAnswerOptionComponent getAnswerOptionFirstRep() { 
1773          if (getAnswerOption().isEmpty()) {
1774            addAnswerOption();
1775          }
1776          return getAnswerOption().get(0);
1777        }
1778
1779        /**
1780         * @return {@link #initial} (One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.)
1781         */
1782        public List<QuestionnaireItemInitialComponent> getInitial() { 
1783          if (this.initial == null)
1784            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1785          return this.initial;
1786        }
1787
1788        /**
1789         * @return Returns a reference to <code>this</code> for easy method chaining
1790         */
1791        public QuestionnaireItemComponent setInitial(List<QuestionnaireItemInitialComponent> theInitial) { 
1792          this.initial = theInitial;
1793          return this;
1794        }
1795
1796        public boolean hasInitial() { 
1797          if (this.initial == null)
1798            return false;
1799          for (QuestionnaireItemInitialComponent item : this.initial)
1800            if (!item.isEmpty())
1801              return true;
1802          return false;
1803        }
1804
1805        public QuestionnaireItemInitialComponent addInitial() { //3
1806          QuestionnaireItemInitialComponent t = new QuestionnaireItemInitialComponent();
1807          if (this.initial == null)
1808            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1809          this.initial.add(t);
1810          return t;
1811        }
1812
1813        public QuestionnaireItemComponent addInitial(QuestionnaireItemInitialComponent t) { //3
1814          if (t == null)
1815            return this;
1816          if (this.initial == null)
1817            this.initial = new ArrayList<QuestionnaireItemInitialComponent>();
1818          this.initial.add(t);
1819          return this;
1820        }
1821
1822        /**
1823         * @return The first repetition of repeating field {@link #initial}, creating it if it does not already exist {3}
1824         */
1825        public QuestionnaireItemInitialComponent getInitialFirstRep() { 
1826          if (getInitial().isEmpty()) {
1827            addInitial();
1828          }
1829          return getInitial().get(0);
1830        }
1831
1832        /**
1833         * @return {@link #item} (Text, questions and other groups to be nested beneath a question or group.)
1834         */
1835        public List<QuestionnaireItemComponent> getItem() { 
1836          if (this.item == null)
1837            this.item = new ArrayList<QuestionnaireItemComponent>();
1838          return this.item;
1839        }
1840
1841        /**
1842         * @return Returns a reference to <code>this</code> for easy method chaining
1843         */
1844        public QuestionnaireItemComponent setItem(List<QuestionnaireItemComponent> theItem) { 
1845          this.item = theItem;
1846          return this;
1847        }
1848
1849        public boolean hasItem() { 
1850          if (this.item == null)
1851            return false;
1852          for (QuestionnaireItemComponent item : this.item)
1853            if (!item.isEmpty())
1854              return true;
1855          return false;
1856        }
1857
1858        public QuestionnaireItemComponent addItem() { //3
1859          QuestionnaireItemComponent t = new QuestionnaireItemComponent();
1860          if (this.item == null)
1861            this.item = new ArrayList<QuestionnaireItemComponent>();
1862          this.item.add(t);
1863          return t;
1864        }
1865
1866        public QuestionnaireItemComponent addItem(QuestionnaireItemComponent t) { //3
1867          if (t == null)
1868            return this;
1869          if (this.item == null)
1870            this.item = new ArrayList<QuestionnaireItemComponent>();
1871          this.item.add(t);
1872          return this;
1873        }
1874
1875        /**
1876         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
1877         */
1878        public QuestionnaireItemComponent getItemFirstRep() { 
1879          if (getItem().isEmpty()) {
1880            addItem();
1881          }
1882          return getItem().get(0);
1883        }
1884
1885        protected void listChildren(List<Property> children) {
1886          super.listChildren(children);
1887          children.add(new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId));
1888          children.add(new Property("definition", "uri", "This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.", 0, 1, definition));
1889          children.add(new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code));
1890          children.add(new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix));
1891          children.add(new Property("text", "markdown", "The name of a section, the text of a question or text content for a display item.", 0, 1, text));
1892          children.add(new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).", 0, 1, type));
1893          children.add(new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen));
1894          children.add(new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior));
1895          children.add(new Property("disabledDisplay", "code", "Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.", 0, 1, disabledDisplay));
1896          children.add(new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required));
1897          children.add(new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats));
1898          children.add(new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly));
1899          children.add(new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength));
1900          children.add(new Property("answerConstraint", "code", "For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.", 0, 1, answerConstraint));
1901          children.add(new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of values representing permitted answers for a question.", 0, 1, answerValueSet));
1902          children.add(new Property("answerOption", "", "One of the permitted answers for the question.", 0, java.lang.Integer.MAX_VALUE, answerOption));
1903          children.add(new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial));
1904          children.add(new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item));
1905        }
1906
1907        @Override
1908        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1909          switch (_hash) {
1910          case -1102667083: /*linkId*/  return new Property("linkId", "string", "An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.", 0, 1, linkId);
1911          case -1014418093: /*definition*/  return new Property("definition", "uri", "This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in [Comments](questionnaire.html#definition), below.", 0, 1, definition);
1912          case 3059181: /*code*/  return new Property("code", "Coding", "A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).", 0, java.lang.Integer.MAX_VALUE, code);
1913          case -980110702: /*prefix*/  return new Property("prefix", "string", "A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.", 0, 1, prefix);
1914          case 3556653: /*text*/  return new Property("text", "markdown", "The name of a section, the text of a question or text content for a display item.", 0, 1, text);
1915          case 3575610: /*type*/  return new Property("type", "code", "The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, Coding, etc.).", 0, 1, type);
1916          case 1893321565: /*enableWhen*/  return new Property("enableWhen", "", "A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.", 0, java.lang.Integer.MAX_VALUE, enableWhen);
1917          case 1854802165: /*enableBehavior*/  return new Property("enableBehavior", "code", "Controls how multiple enableWhen values are interpreted -  whether all or any must be true.", 0, 1, enableBehavior);
1918          case -1254886746: /*disabledDisplay*/  return new Property("disabledDisplay", "code", "Indicates if and how items that are disabled (because enableWhen evaluates to 'false') should be displayed.", 0, 1, disabledDisplay);
1919          case -393139297: /*required*/  return new Property("required", "boolean", "An indication, if true, that the item must be present in a \"completed\" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.", 0, 1, required);
1920          case 1094288952: /*repeats*/  return new Property("repeats", "boolean", "An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.", 0, 1, repeats);
1921          case -867683742: /*readOnly*/  return new Property("readOnly", "boolean", "An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.", 0, 1, readOnly);
1922          case -791400086: /*maxLength*/  return new Property("maxLength", "integer", "The maximum number of characters that are permitted in the answer to be considered a \"valid\" QuestionnaireResponse.", 0, 1, maxLength);
1923          case 746396731: /*answerConstraint*/  return new Property("answerConstraint", "code", "For items that have a defined set of allowed answers (via answerOption or answerValueset), indicates whether values *other* than those specified can be selected.", 0, 1, answerConstraint);
1924          case -743278833: /*answerValueSet*/  return new Property("answerValueSet", "canonical(ValueSet)", "A reference to a value set containing a list of values representing permitted answers for a question.", 0, 1, answerValueSet);
1925          case -1527878189: /*answerOption*/  return new Property("answerOption", "", "One of the permitted answers for the question.", 0, java.lang.Integer.MAX_VALUE, answerOption);
1926          case 1948342084: /*initial*/  return new Property("initial", "", "One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.", 0, java.lang.Integer.MAX_VALUE, initial);
1927          case 3242771: /*item*/  return new Property("item", "@Questionnaire.item", "Text, questions and other groups to be nested beneath a question or group.", 0, java.lang.Integer.MAX_VALUE, item);
1928          default: return super.getNamedProperty(_hash, _name, _checkValid);
1929          }
1930
1931        }
1932
1933      @Override
1934      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1935        switch (hash) {
1936        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
1937        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // UriType
1938        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
1939        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
1940        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // MarkdownType
1941        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<QuestionnaireItemType>
1942        case 1893321565: /*enableWhen*/ return this.enableWhen == null ? new Base[0] : this.enableWhen.toArray(new Base[this.enableWhen.size()]); // QuestionnaireItemEnableWhenComponent
1943        case 1854802165: /*enableBehavior*/ return this.enableBehavior == null ? new Base[0] : new Base[] {this.enableBehavior}; // Enumeration<EnableWhenBehavior>
1944        case -1254886746: /*disabledDisplay*/ return this.disabledDisplay == null ? new Base[0] : new Base[] {this.disabledDisplay}; // Enumeration<QuestionnaireItemDisabledDisplay>
1945        case -393139297: /*required*/ return this.required == null ? new Base[0] : new Base[] {this.required}; // BooleanType
1946        case 1094288952: /*repeats*/ return this.repeats == null ? new Base[0] : new Base[] {this.repeats}; // BooleanType
1947        case -867683742: /*readOnly*/ return this.readOnly == null ? new Base[0] : new Base[] {this.readOnly}; // BooleanType
1948        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
1949        case 746396731: /*answerConstraint*/ return this.answerConstraint == null ? new Base[0] : new Base[] {this.answerConstraint}; // Enumeration<QuestionnaireAnswerConstraint>
1950        case -743278833: /*answerValueSet*/ return this.answerValueSet == null ? new Base[0] : new Base[] {this.answerValueSet}; // CanonicalType
1951        case -1527878189: /*answerOption*/ return this.answerOption == null ? new Base[0] : this.answerOption.toArray(new Base[this.answerOption.size()]); // QuestionnaireItemAnswerOptionComponent
1952        case 1948342084: /*initial*/ return this.initial == null ? new Base[0] : this.initial.toArray(new Base[this.initial.size()]); // QuestionnaireItemInitialComponent
1953        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
1954        default: return super.getProperty(hash, name, checkValid);
1955        }
1956
1957      }
1958
1959      @Override
1960      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1961        switch (hash) {
1962        case -1102667083: // linkId
1963          this.linkId = TypeConvertor.castToString(value); // StringType
1964          return value;
1965        case -1014418093: // definition
1966          this.definition = TypeConvertor.castToUri(value); // UriType
1967          return value;
1968        case 3059181: // code
1969          this.getCode().add(TypeConvertor.castToCoding(value)); // Coding
1970          return value;
1971        case -980110702: // prefix
1972          this.prefix = TypeConvertor.castToString(value); // StringType
1973          return value;
1974        case 3556653: // text
1975          this.text = TypeConvertor.castToMarkdown(value); // MarkdownType
1976          return value;
1977        case 3575610: // type
1978          value = new QuestionnaireItemTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1979          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
1980          return value;
1981        case 1893321565: // enableWhen
1982          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value); // QuestionnaireItemEnableWhenComponent
1983          return value;
1984        case 1854802165: // enableBehavior
1985          value = new EnableWhenBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
1986          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
1987          return value;
1988        case -1254886746: // disabledDisplay
1989          value = new QuestionnaireItemDisabledDisplayEnumFactory().fromType(TypeConvertor.castToCode(value));
1990          this.disabledDisplay = (Enumeration) value; // Enumeration<QuestionnaireItemDisabledDisplay>
1991          return value;
1992        case -393139297: // required
1993          this.required = TypeConvertor.castToBoolean(value); // BooleanType
1994          return value;
1995        case 1094288952: // repeats
1996          this.repeats = TypeConvertor.castToBoolean(value); // BooleanType
1997          return value;
1998        case -867683742: // readOnly
1999          this.readOnly = TypeConvertor.castToBoolean(value); // BooleanType
2000          return value;
2001        case -791400086: // maxLength
2002          this.maxLength = TypeConvertor.castToInteger(value); // IntegerType
2003          return value;
2004        case 746396731: // answerConstraint
2005          value = new QuestionnaireAnswerConstraintEnumFactory().fromType(TypeConvertor.castToCode(value));
2006          this.answerConstraint = (Enumeration) value; // Enumeration<QuestionnaireAnswerConstraint>
2007          return value;
2008        case -743278833: // answerValueSet
2009          this.answerValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
2010          return value;
2011        case -1527878189: // answerOption
2012          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value); // QuestionnaireItemAnswerOptionComponent
2013          return value;
2014        case 1948342084: // initial
2015          this.getInitial().add((QuestionnaireItemInitialComponent) value); // QuestionnaireItemInitialComponent
2016          return value;
2017        case 3242771: // item
2018          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
2019          return value;
2020        default: return super.setProperty(hash, name, value);
2021        }
2022
2023      }
2024
2025      @Override
2026      public Base setProperty(String name, Base value) throws FHIRException {
2027        if (name.equals("linkId")) {
2028          this.linkId = TypeConvertor.castToString(value); // StringType
2029        } else if (name.equals("definition")) {
2030          this.definition = TypeConvertor.castToUri(value); // UriType
2031        } else if (name.equals("code")) {
2032          this.getCode().add(TypeConvertor.castToCoding(value));
2033        } else if (name.equals("prefix")) {
2034          this.prefix = TypeConvertor.castToString(value); // StringType
2035        } else if (name.equals("text")) {
2036          this.text = TypeConvertor.castToMarkdown(value); // MarkdownType
2037        } else if (name.equals("type")) {
2038          value = new QuestionnaireItemTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
2039          this.type = (Enumeration) value; // Enumeration<QuestionnaireItemType>
2040        } else if (name.equals("enableWhen")) {
2041          this.getEnableWhen().add((QuestionnaireItemEnableWhenComponent) value);
2042        } else if (name.equals("enableBehavior")) {
2043          value = new EnableWhenBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
2044          this.enableBehavior = (Enumeration) value; // Enumeration<EnableWhenBehavior>
2045        } else if (name.equals("disabledDisplay")) {
2046          value = new QuestionnaireItemDisabledDisplayEnumFactory().fromType(TypeConvertor.castToCode(value));
2047          this.disabledDisplay = (Enumeration) value; // Enumeration<QuestionnaireItemDisabledDisplay>
2048        } else if (name.equals("required")) {
2049          this.required = TypeConvertor.castToBoolean(value); // BooleanType
2050        } else if (name.equals("repeats")) {
2051          this.repeats = TypeConvertor.castToBoolean(value); // BooleanType
2052        } else if (name.equals("readOnly")) {
2053          this.readOnly = TypeConvertor.castToBoolean(value); // BooleanType
2054        } else if (name.equals("maxLength")) {
2055          this.maxLength = TypeConvertor.castToInteger(value); // IntegerType
2056        } else if (name.equals("answerConstraint")) {
2057          value = new QuestionnaireAnswerConstraintEnumFactory().fromType(TypeConvertor.castToCode(value));
2058          this.answerConstraint = (Enumeration) value; // Enumeration<QuestionnaireAnswerConstraint>
2059        } else if (name.equals("answerValueSet")) {
2060          this.answerValueSet = TypeConvertor.castToCanonical(value); // CanonicalType
2061        } else if (name.equals("answerOption")) {
2062          this.getAnswerOption().add((QuestionnaireItemAnswerOptionComponent) value);
2063        } else if (name.equals("initial")) {
2064          this.getInitial().add((QuestionnaireItemInitialComponent) value);
2065        } else if (name.equals("item")) {
2066          this.getItem().add((QuestionnaireItemComponent) value);
2067        } else
2068          return super.setProperty(name, value);
2069        return value;
2070      }
2071
2072      @Override
2073      public Base makeProperty(int hash, String name) throws FHIRException {
2074        switch (hash) {
2075        case -1102667083:  return getLinkIdElement();
2076        case -1014418093:  return getDefinitionElement();
2077        case 3059181:  return addCode(); 
2078        case -980110702:  return getPrefixElement();
2079        case 3556653:  return getTextElement();
2080        case 3575610:  return getTypeElement();
2081        case 1893321565:  return addEnableWhen(); 
2082        case 1854802165:  return getEnableBehaviorElement();
2083        case -1254886746:  return getDisabledDisplayElement();
2084        case -393139297:  return getRequiredElement();
2085        case 1094288952:  return getRepeatsElement();
2086        case -867683742:  return getReadOnlyElement();
2087        case -791400086:  return getMaxLengthElement();
2088        case 746396731:  return getAnswerConstraintElement();
2089        case -743278833:  return getAnswerValueSetElement();
2090        case -1527878189:  return addAnswerOption(); 
2091        case 1948342084:  return addInitial(); 
2092        case 3242771:  return addItem(); 
2093        default: return super.makeProperty(hash, name);
2094        }
2095
2096      }
2097
2098      @Override
2099      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2100        switch (hash) {
2101        case -1102667083: /*linkId*/ return new String[] {"string"};
2102        case -1014418093: /*definition*/ return new String[] {"uri"};
2103        case 3059181: /*code*/ return new String[] {"Coding"};
2104        case -980110702: /*prefix*/ return new String[] {"string"};
2105        case 3556653: /*text*/ return new String[] {"markdown"};
2106        case 3575610: /*type*/ return new String[] {"code"};
2107        case 1893321565: /*enableWhen*/ return new String[] {};
2108        case 1854802165: /*enableBehavior*/ return new String[] {"code"};
2109        case -1254886746: /*disabledDisplay*/ return new String[] {"code"};
2110        case -393139297: /*required*/ return new String[] {"boolean"};
2111        case 1094288952: /*repeats*/ return new String[] {"boolean"};
2112        case -867683742: /*readOnly*/ return new String[] {"boolean"};
2113        case -791400086: /*maxLength*/ return new String[] {"integer"};
2114        case 746396731: /*answerConstraint*/ return new String[] {"code"};
2115        case -743278833: /*answerValueSet*/ return new String[] {"canonical"};
2116        case -1527878189: /*answerOption*/ return new String[] {};
2117        case 1948342084: /*initial*/ return new String[] {};
2118        case 3242771: /*item*/ return new String[] {"@Questionnaire.item"};
2119        default: return super.getTypesForProperty(hash, name);
2120        }
2121
2122      }
2123
2124      @Override
2125      public Base addChild(String name) throws FHIRException {
2126        if (name.equals("linkId")) {
2127          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.linkId");
2128        }
2129        else if (name.equals("definition")) {
2130          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.definition");
2131        }
2132        else if (name.equals("code")) {
2133          return addCode();
2134        }
2135        else if (name.equals("prefix")) {
2136          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.prefix");
2137        }
2138        else if (name.equals("text")) {
2139          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.text");
2140        }
2141        else if (name.equals("type")) {
2142          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.type");
2143        }
2144        else if (name.equals("enableWhen")) {
2145          return addEnableWhen();
2146        }
2147        else if (name.equals("enableBehavior")) {
2148          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.enableBehavior");
2149        }
2150        else if (name.equals("disabledDisplay")) {
2151          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.disabledDisplay");
2152        }
2153        else if (name.equals("required")) {
2154          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.required");
2155        }
2156        else if (name.equals("repeats")) {
2157          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.repeats");
2158        }
2159        else if (name.equals("readOnly")) {
2160          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.readOnly");
2161        }
2162        else if (name.equals("maxLength")) {
2163          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.maxLength");
2164        }
2165        else if (name.equals("answerConstraint")) {
2166          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.answerConstraint");
2167        }
2168        else if (name.equals("answerValueSet")) {
2169          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.answerValueSet");
2170        }
2171        else if (name.equals("answerOption")) {
2172          return addAnswerOption();
2173        }
2174        else if (name.equals("initial")) {
2175          return addInitial();
2176        }
2177        else if (name.equals("item")) {
2178          return addItem();
2179        }
2180        else
2181          return super.addChild(name);
2182      }
2183
2184      public QuestionnaireItemComponent copy() {
2185        QuestionnaireItemComponent dst = new QuestionnaireItemComponent();
2186        copyValues(dst);
2187        return dst;
2188      }
2189
2190      public void copyValues(QuestionnaireItemComponent dst) {
2191        super.copyValues(dst);
2192        dst.linkId = linkId == null ? null : linkId.copy();
2193        dst.definition = definition == null ? null : definition.copy();
2194        if (code != null) {
2195          dst.code = new ArrayList<Coding>();
2196          for (Coding i : code)
2197            dst.code.add(i.copy());
2198        };
2199        dst.prefix = prefix == null ? null : prefix.copy();
2200        dst.text = text == null ? null : text.copy();
2201        dst.type = type == null ? null : type.copy();
2202        if (enableWhen != null) {
2203          dst.enableWhen = new ArrayList<QuestionnaireItemEnableWhenComponent>();
2204          for (QuestionnaireItemEnableWhenComponent i : enableWhen)
2205            dst.enableWhen.add(i.copy());
2206        };
2207        dst.enableBehavior = enableBehavior == null ? null : enableBehavior.copy();
2208        dst.disabledDisplay = disabledDisplay == null ? null : disabledDisplay.copy();
2209        dst.required = required == null ? null : required.copy();
2210        dst.repeats = repeats == null ? null : repeats.copy();
2211        dst.readOnly = readOnly == null ? null : readOnly.copy();
2212        dst.maxLength = maxLength == null ? null : maxLength.copy();
2213        dst.answerConstraint = answerConstraint == null ? null : answerConstraint.copy();
2214        dst.answerValueSet = answerValueSet == null ? null : answerValueSet.copy();
2215        if (answerOption != null) {
2216          dst.answerOption = new ArrayList<QuestionnaireItemAnswerOptionComponent>();
2217          for (QuestionnaireItemAnswerOptionComponent i : answerOption)
2218            dst.answerOption.add(i.copy());
2219        };
2220        if (initial != null) {
2221          dst.initial = new ArrayList<QuestionnaireItemInitialComponent>();
2222          for (QuestionnaireItemInitialComponent i : initial)
2223            dst.initial.add(i.copy());
2224        };
2225        if (item != null) {
2226          dst.item = new ArrayList<QuestionnaireItemComponent>();
2227          for (QuestionnaireItemComponent i : item)
2228            dst.item.add(i.copy());
2229        };
2230      }
2231
2232      @Override
2233      public boolean equalsDeep(Base other_) {
2234        if (!super.equalsDeep(other_))
2235          return false;
2236        if (!(other_ instanceof QuestionnaireItemComponent))
2237          return false;
2238        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
2239        return compareDeep(linkId, o.linkId, true) && compareDeep(definition, o.definition, true) && compareDeep(code, o.code, true)
2240           && compareDeep(prefix, o.prefix, true) && compareDeep(text, o.text, true) && compareDeep(type, o.type, true)
2241           && compareDeep(enableWhen, o.enableWhen, true) && compareDeep(enableBehavior, o.enableBehavior, true)
2242           && compareDeep(disabledDisplay, o.disabledDisplay, true) && compareDeep(required, o.required, true)
2243           && compareDeep(repeats, o.repeats, true) && compareDeep(readOnly, o.readOnly, true) && compareDeep(maxLength, o.maxLength, true)
2244           && compareDeep(answerConstraint, o.answerConstraint, true) && compareDeep(answerValueSet, o.answerValueSet, true)
2245           && compareDeep(answerOption, o.answerOption, true) && compareDeep(initial, o.initial, true) && compareDeep(item, o.item, true)
2246          ;
2247      }
2248
2249      @Override
2250      public boolean equalsShallow(Base other_) {
2251        if (!super.equalsShallow(other_))
2252          return false;
2253        if (!(other_ instanceof QuestionnaireItemComponent))
2254          return false;
2255        QuestionnaireItemComponent o = (QuestionnaireItemComponent) other_;
2256        return compareValues(linkId, o.linkId, true) && compareValues(definition, o.definition, true) && compareValues(prefix, o.prefix, true)
2257           && compareValues(text, o.text, true) && compareValues(type, o.type, true) && compareValues(enableBehavior, o.enableBehavior, true)
2258           && compareValues(disabledDisplay, o.disabledDisplay, true) && compareValues(required, o.required, true)
2259           && compareValues(repeats, o.repeats, true) && compareValues(readOnly, o.readOnly, true) && compareValues(maxLength, o.maxLength, true)
2260           && compareValues(answerConstraint, o.answerConstraint, true) && compareValues(answerValueSet, o.answerValueSet, true)
2261          ;
2262      }
2263
2264      public boolean isEmpty() {
2265        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, definition, code
2266          , prefix, text, type, enableWhen, enableBehavior, disabledDisplay, required, repeats
2267          , readOnly, maxLength, answerConstraint, answerValueSet, answerOption, initial, item
2268          );
2269      }
2270
2271  public String fhirType() {
2272    return "Questionnaire.item";
2273
2274  }
2275
2276// added from java-adornments.txt:
2277public QuestionnaireItemComponent getQuestion(String linkId) {
2278        if (linkId == null)
2279          return null;
2280        for (QuestionnaireItemComponent i : getItem()) {
2281          if (i.getLinkId().equals(linkId))
2282            return i;
2283          QuestionnaireItemComponent t = i.getQuestion(linkId);
2284          if (t != null)
2285            return t;
2286        }
2287        return null;
2288      }
2289
2290      public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
2291        if (q1 == null || q2 == null)
2292          return null;
2293        for (QuestionnaireItemComponent i : getItem()) {
2294          QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
2295          if (t != null)
2296            return t;
2297        }
2298        if (containsQuestion(q1) && containsQuestion(q2))
2299          return this;
2300        return null;
2301      }
2302
2303      public boolean containsQuestion(QuestionnaireItemComponent q) {
2304        if (q == this)
2305          return true;
2306        for (QuestionnaireItemComponent i : getItem()) {
2307          if (i.containsQuestion(q))
2308            return true;
2309        }
2310        return false;
2311      }
2312// end addition
2313  }
2314
2315    @Block()
2316    public static class QuestionnaireItemEnableWhenComponent extends BackboneElement implements IBaseBackboneElement {
2317        /**
2318         * The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2319         */
2320        @Child(name = "question", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2321        @Description(shortDefinition="The linkId of question that determines whether item is enabled/disabled", formalDefinition="The linkId for the question whose answer (or lack of answer) governs whether this item is enabled." )
2322        protected StringType question;
2323
2324        /**
2325         * Specifies the criteria by which the question is enabled.
2326         */
2327        @Child(name = "operator", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2328        @Description(shortDefinition="exists | = | != | > | < | >= | <=", formalDefinition="Specifies the criteria by which the question is enabled." )
2329        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-enable-operator")
2330        protected Enumeration<QuestionnaireItemOperator> operator;
2331
2332        /**
2333         * A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.
2334         */
2335        @Child(name = "answer", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, Coding.class, Quantity.class, Reference.class}, order=3, min=1, max=1, modifier=false, summary=false)
2336        @Description(shortDefinition="Value for question comparison based on operator", formalDefinition="A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension." )
2337        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2338        protected DataType answer;
2339
2340        private static final long serialVersionUID = 1909865374L;
2341
2342    /**
2343     * Constructor
2344     */
2345      public QuestionnaireItemEnableWhenComponent() {
2346        super();
2347      }
2348
2349    /**
2350     * Constructor
2351     */
2352      public QuestionnaireItemEnableWhenComponent(String question, QuestionnaireItemOperator operator, DataType answer) {
2353        super();
2354        this.setQuestion(question);
2355        this.setOperator(operator);
2356        this.setAnswer(answer);
2357      }
2358
2359        /**
2360         * @return {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2361         */
2362        public StringType getQuestionElement() { 
2363          if (this.question == null)
2364            if (Configuration.errorOnAutoCreate())
2365              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.question");
2366            else if (Configuration.doAutoCreate())
2367              this.question = new StringType(); // bb
2368          return this.question;
2369        }
2370
2371        public boolean hasQuestionElement() { 
2372          return this.question != null && !this.question.isEmpty();
2373        }
2374
2375        public boolean hasQuestion() { 
2376          return this.question != null && !this.question.isEmpty();
2377        }
2378
2379        /**
2380         * @param value {@link #question} (The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.). This is the underlying object with id, value and extensions. The accessor "getQuestion" gives direct access to the value
2381         */
2382        public QuestionnaireItemEnableWhenComponent setQuestionElement(StringType value) { 
2383          this.question = value;
2384          return this;
2385        }
2386
2387        /**
2388         * @return The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2389         */
2390        public String getQuestion() { 
2391          return this.question == null ? null : this.question.getValue();
2392        }
2393
2394        /**
2395         * @param value The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.
2396         */
2397        public QuestionnaireItemEnableWhenComponent setQuestion(String value) { 
2398            if (this.question == null)
2399              this.question = new StringType();
2400            this.question.setValue(value);
2401          return this;
2402        }
2403
2404        /**
2405         * @return {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2406         */
2407        public Enumeration<QuestionnaireItemOperator> getOperatorElement() { 
2408          if (this.operator == null)
2409            if (Configuration.errorOnAutoCreate())
2410              throw new Error("Attempt to auto-create QuestionnaireItemEnableWhenComponent.operator");
2411            else if (Configuration.doAutoCreate())
2412              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory()); // bb
2413          return this.operator;
2414        }
2415
2416        public boolean hasOperatorElement() { 
2417          return this.operator != null && !this.operator.isEmpty();
2418        }
2419
2420        public boolean hasOperator() { 
2421          return this.operator != null && !this.operator.isEmpty();
2422        }
2423
2424        /**
2425         * @param value {@link #operator} (Specifies the criteria by which the question is enabled.). This is the underlying object with id, value and extensions. The accessor "getOperator" gives direct access to the value
2426         */
2427        public QuestionnaireItemEnableWhenComponent setOperatorElement(Enumeration<QuestionnaireItemOperator> value) { 
2428          this.operator = value;
2429          return this;
2430        }
2431
2432        /**
2433         * @return Specifies the criteria by which the question is enabled.
2434         */
2435        public QuestionnaireItemOperator getOperator() { 
2436          return this.operator == null ? null : this.operator.getValue();
2437        }
2438
2439        /**
2440         * @param value Specifies the criteria by which the question is enabled.
2441         */
2442        public QuestionnaireItemEnableWhenComponent setOperator(QuestionnaireItemOperator value) { 
2443            if (this.operator == null)
2444              this.operator = new Enumeration<QuestionnaireItemOperator>(new QuestionnaireItemOperatorEnumFactory());
2445            this.operator.setValue(value);
2446          return this;
2447        }
2448
2449        /**
2450         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2451         */
2452        public DataType getAnswer() { 
2453          return this.answer;
2454        }
2455
2456        /**
2457         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2458         */
2459        public BooleanType getAnswerBooleanType() throws FHIRException { 
2460          if (this.answer == null)
2461            this.answer = new BooleanType();
2462          if (!(this.answer instanceof BooleanType))
2463            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.answer.getClass().getName()+" was encountered");
2464          return (BooleanType) this.answer;
2465        }
2466
2467        public boolean hasAnswerBooleanType() { 
2468          return this != null && this.answer instanceof BooleanType;
2469        }
2470
2471        /**
2472         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2473         */
2474        public DecimalType getAnswerDecimalType() throws FHIRException { 
2475          if (this.answer == null)
2476            this.answer = new DecimalType();
2477          if (!(this.answer instanceof DecimalType))
2478            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.answer.getClass().getName()+" was encountered");
2479          return (DecimalType) this.answer;
2480        }
2481
2482        public boolean hasAnswerDecimalType() { 
2483          return this != null && this.answer instanceof DecimalType;
2484        }
2485
2486        /**
2487         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2488         */
2489        public IntegerType getAnswerIntegerType() throws FHIRException { 
2490          if (this.answer == null)
2491            this.answer = new IntegerType();
2492          if (!(this.answer instanceof IntegerType))
2493            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.answer.getClass().getName()+" was encountered");
2494          return (IntegerType) this.answer;
2495        }
2496
2497        public boolean hasAnswerIntegerType() { 
2498          return this != null && this.answer instanceof IntegerType;
2499        }
2500
2501        /**
2502         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2503         */
2504        public DateType getAnswerDateType() throws FHIRException { 
2505          if (this.answer == null)
2506            this.answer = new DateType();
2507          if (!(this.answer instanceof DateType))
2508            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.answer.getClass().getName()+" was encountered");
2509          return (DateType) this.answer;
2510        }
2511
2512        public boolean hasAnswerDateType() { 
2513          return this != null && this.answer instanceof DateType;
2514        }
2515
2516        /**
2517         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2518         */
2519        public DateTimeType getAnswerDateTimeType() throws FHIRException { 
2520          if (this.answer == null)
2521            this.answer = new DateTimeType();
2522          if (!(this.answer instanceof DateTimeType))
2523            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2524          return (DateTimeType) this.answer;
2525        }
2526
2527        public boolean hasAnswerDateTimeType() { 
2528          return this != null && this.answer instanceof DateTimeType;
2529        }
2530
2531        /**
2532         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2533         */
2534        public TimeType getAnswerTimeType() throws FHIRException { 
2535          if (this.answer == null)
2536            this.answer = new TimeType();
2537          if (!(this.answer instanceof TimeType))
2538            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.answer.getClass().getName()+" was encountered");
2539          return (TimeType) this.answer;
2540        }
2541
2542        public boolean hasAnswerTimeType() { 
2543          return this != null && this.answer instanceof TimeType;
2544        }
2545
2546        /**
2547         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2548         */
2549        public StringType getAnswerStringType() throws FHIRException { 
2550          if (this.answer == null)
2551            this.answer = new StringType();
2552          if (!(this.answer instanceof StringType))
2553            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.answer.getClass().getName()+" was encountered");
2554          return (StringType) this.answer;
2555        }
2556
2557        public boolean hasAnswerStringType() { 
2558          return this != null && this.answer instanceof StringType;
2559        }
2560
2561        /**
2562         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2563         */
2564        public Coding getAnswerCoding() throws FHIRException { 
2565          if (this.answer == null)
2566            this.answer = new Coding();
2567          if (!(this.answer instanceof Coding))
2568            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.answer.getClass().getName()+" was encountered");
2569          return (Coding) this.answer;
2570        }
2571
2572        public boolean hasAnswerCoding() { 
2573          return this != null && this.answer instanceof Coding;
2574        }
2575
2576        /**
2577         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2578         */
2579        public Quantity getAnswerQuantity() throws FHIRException { 
2580          if (this.answer == null)
2581            this.answer = new Quantity();
2582          if (!(this.answer instanceof Quantity))
2583            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.answer.getClass().getName()+" was encountered");
2584          return (Quantity) this.answer;
2585        }
2586
2587        public boolean hasAnswerQuantity() { 
2588          return this != null && this.answer instanceof Quantity;
2589        }
2590
2591        /**
2592         * @return {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2593         */
2594        public Reference getAnswerReference() throws FHIRException { 
2595          if (this.answer == null)
2596            this.answer = new Reference();
2597          if (!(this.answer instanceof Reference))
2598            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.answer.getClass().getName()+" was encountered");
2599          return (Reference) this.answer;
2600        }
2601
2602        public boolean hasAnswerReference() { 
2603          return this != null && this.answer instanceof Reference;
2604        }
2605
2606        public boolean hasAnswer() { 
2607          return this.answer != null && !this.answer.isEmpty();
2608        }
2609
2610        /**
2611         * @param value {@link #answer} (A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.)
2612         */
2613        public QuestionnaireItemEnableWhenComponent setAnswer(DataType value) { 
2614          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
2615            throw new Error("Not the right type for Questionnaire.item.enableWhen.answer[x]: "+value.fhirType());
2616          this.answer = value;
2617          return this;
2618        }
2619
2620        protected void listChildren(List<Property> children) {
2621          super.listChildren(children);
2622          children.add(new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question));
2623          children.add(new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator));
2624          children.add(new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer));
2625        }
2626
2627        @Override
2628        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2629          switch (_hash) {
2630          case -1165870106: /*question*/  return new Property("question", "string", "The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.", 0, 1, question);
2631          case -500553564: /*operator*/  return new Property("operator", "code", "Specifies the criteria by which the question is enabled.", 0, 1, operator);
2632          case 1693524994: /*answer[x]*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2633          case -1412808770: /*answer*/  return new Property("answer[x]", "boolean|decimal|integer|date|dateTime|time|string|Coding|Quantity|Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2634          case 1194603146: /*answerBoolean*/  return new Property("answer[x]", "boolean", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2635          case -1622812237: /*answerDecimal*/  return new Property("answer[x]", "decimal", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2636          case -1207023712: /*answerInteger*/  return new Property("answer[x]", "integer", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2637          case 958960780: /*answerDate*/  return new Property("answer[x]", "date", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2638          case -1835321991: /*answerDateTime*/  return new Property("answer[x]", "dateTime", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2639          case 959444907: /*answerTime*/  return new Property("answer[x]", "time", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2640          case -1409727121: /*answerString*/  return new Property("answer[x]", "string", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2641          case -1872828216: /*answerCoding*/  return new Property("answer[x]", "Coding", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2642          case -618108311: /*answerQuantity*/  return new Property("answer[x]", "Quantity", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2643          case -1726221011: /*answerReference*/  return new Property("answer[x]", "Reference(Any)", "A value that the referenced question is tested using the specified operator in order for the item to be enabled.  If there are multiple answers, a match on any of the answers suffices.  If different behavior is desired (all must match, at least 2 must match, etc.), consider using the enableWhenExpression extension.", 0, 1, answer);
2644          default: return super.getNamedProperty(_hash, _name, _checkValid);
2645          }
2646
2647        }
2648
2649      @Override
2650      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2651        switch (hash) {
2652        case -1165870106: /*question*/ return this.question == null ? new Base[0] : new Base[] {this.question}; // StringType
2653        case -500553564: /*operator*/ return this.operator == null ? new Base[0] : new Base[] {this.operator}; // Enumeration<QuestionnaireItemOperator>
2654        case -1412808770: /*answer*/ return this.answer == null ? new Base[0] : new Base[] {this.answer}; // DataType
2655        default: return super.getProperty(hash, name, checkValid);
2656        }
2657
2658      }
2659
2660      @Override
2661      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2662        switch (hash) {
2663        case -1165870106: // question
2664          this.question = TypeConvertor.castToString(value); // StringType
2665          return value;
2666        case -500553564: // operator
2667          value = new QuestionnaireItemOperatorEnumFactory().fromType(TypeConvertor.castToCode(value));
2668          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2669          return value;
2670        case -1412808770: // answer
2671          this.answer = TypeConvertor.castToType(value); // DataType
2672          return value;
2673        default: return super.setProperty(hash, name, value);
2674        }
2675
2676      }
2677
2678      @Override
2679      public Base setProperty(String name, Base value) throws FHIRException {
2680        if (name.equals("question")) {
2681          this.question = TypeConvertor.castToString(value); // StringType
2682        } else if (name.equals("operator")) {
2683          value = new QuestionnaireItemOperatorEnumFactory().fromType(TypeConvertor.castToCode(value));
2684          this.operator = (Enumeration) value; // Enumeration<QuestionnaireItemOperator>
2685        } else if (name.equals("answer[x]")) {
2686          this.answer = TypeConvertor.castToType(value); // DataType
2687        } else
2688          return super.setProperty(name, value);
2689        return value;
2690      }
2691
2692      @Override
2693      public Base makeProperty(int hash, String name) throws FHIRException {
2694        switch (hash) {
2695        case -1165870106:  return getQuestionElement();
2696        case -500553564:  return getOperatorElement();
2697        case 1693524994:  return getAnswer();
2698        case -1412808770:  return getAnswer();
2699        default: return super.makeProperty(hash, name);
2700        }
2701
2702      }
2703
2704      @Override
2705      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2706        switch (hash) {
2707        case -1165870106: /*question*/ return new String[] {"string"};
2708        case -500553564: /*operator*/ return new String[] {"code"};
2709        case -1412808770: /*answer*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "Coding", "Quantity", "Reference"};
2710        default: return super.getTypesForProperty(hash, name);
2711        }
2712
2713      }
2714
2715      @Override
2716      public Base addChild(String name) throws FHIRException {
2717        if (name.equals("question")) {
2718          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.enableWhen.question");
2719        }
2720        else if (name.equals("operator")) {
2721          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.enableWhen.operator");
2722        }
2723        else if (name.equals("answerBoolean")) {
2724          this.answer = new BooleanType();
2725          return this.answer;
2726        }
2727        else if (name.equals("answerDecimal")) {
2728          this.answer = new DecimalType();
2729          return this.answer;
2730        }
2731        else if (name.equals("answerInteger")) {
2732          this.answer = new IntegerType();
2733          return this.answer;
2734        }
2735        else if (name.equals("answerDate")) {
2736          this.answer = new DateType();
2737          return this.answer;
2738        }
2739        else if (name.equals("answerDateTime")) {
2740          this.answer = new DateTimeType();
2741          return this.answer;
2742        }
2743        else if (name.equals("answerTime")) {
2744          this.answer = new TimeType();
2745          return this.answer;
2746        }
2747        else if (name.equals("answerString")) {
2748          this.answer = new StringType();
2749          return this.answer;
2750        }
2751        else if (name.equals("answerCoding")) {
2752          this.answer = new Coding();
2753          return this.answer;
2754        }
2755        else if (name.equals("answerQuantity")) {
2756          this.answer = new Quantity();
2757          return this.answer;
2758        }
2759        else if (name.equals("answerReference")) {
2760          this.answer = new Reference();
2761          return this.answer;
2762        }
2763        else
2764          return super.addChild(name);
2765      }
2766
2767      public QuestionnaireItemEnableWhenComponent copy() {
2768        QuestionnaireItemEnableWhenComponent dst = new QuestionnaireItemEnableWhenComponent();
2769        copyValues(dst);
2770        return dst;
2771      }
2772
2773      public void copyValues(QuestionnaireItemEnableWhenComponent dst) {
2774        super.copyValues(dst);
2775        dst.question = question == null ? null : question.copy();
2776        dst.operator = operator == null ? null : operator.copy();
2777        dst.answer = answer == null ? null : answer.copy();
2778      }
2779
2780      @Override
2781      public boolean equalsDeep(Base other_) {
2782        if (!super.equalsDeep(other_))
2783          return false;
2784        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2785          return false;
2786        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2787        return compareDeep(question, o.question, true) && compareDeep(operator, o.operator, true) && compareDeep(answer, o.answer, true)
2788          ;
2789      }
2790
2791      @Override
2792      public boolean equalsShallow(Base other_) {
2793        if (!super.equalsShallow(other_))
2794          return false;
2795        if (!(other_ instanceof QuestionnaireItemEnableWhenComponent))
2796          return false;
2797        QuestionnaireItemEnableWhenComponent o = (QuestionnaireItemEnableWhenComponent) other_;
2798        return compareValues(question, o.question, true) && compareValues(operator, o.operator, true);
2799      }
2800
2801      public boolean isEmpty() {
2802        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(question, operator, answer
2803          );
2804      }
2805
2806  public String fhirType() {
2807    return "Questionnaire.item.enableWhen";
2808
2809  }
2810
2811  }
2812
2813    @Block()
2814    public static class QuestionnaireItemAnswerOptionComponent extends BackboneElement implements IBaseBackboneElement {
2815        /**
2816         * A potential answer that's allowed as the answer to this question.
2817         */
2818        @Child(name = "value", type = {IntegerType.class, DateType.class, TimeType.class, StringType.class, Coding.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
2819        @Description(shortDefinition="Answer value", formalDefinition="A potential answer that's allowed as the answer to this question." )
2820        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
2821        protected DataType value;
2822
2823        /**
2824         * Indicates whether the answer value is selected when the list of possible answers is initially shown.
2825         */
2826        @Child(name = "initialSelected", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2827        @Description(shortDefinition="Whether option is selected by default", formalDefinition="Indicates whether the answer value is selected when the list of possible answers is initially shown." )
2828        protected BooleanType initialSelected;
2829
2830        private static final long serialVersionUID = -504460934L;
2831
2832    /**
2833     * Constructor
2834     */
2835      public QuestionnaireItemAnswerOptionComponent() {
2836        super();
2837      }
2838
2839    /**
2840     * Constructor
2841     */
2842      public QuestionnaireItemAnswerOptionComponent(DataType value) {
2843        super();
2844        this.setValue(value);
2845      }
2846
2847        /**
2848         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2849         */
2850        public DataType getValue() { 
2851          return this.value;
2852        }
2853
2854        /**
2855         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2856         */
2857        public IntegerType getValueIntegerType() throws FHIRException { 
2858          if (this.value == null)
2859            this.value = new IntegerType();
2860          if (!(this.value instanceof IntegerType))
2861            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2862          return (IntegerType) this.value;
2863        }
2864
2865        public boolean hasValueIntegerType() { 
2866          return this != null && this.value instanceof IntegerType;
2867        }
2868
2869        /**
2870         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2871         */
2872        public DateType getValueDateType() throws FHIRException { 
2873          if (this.value == null)
2874            this.value = new DateType();
2875          if (!(this.value instanceof DateType))
2876            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2877          return (DateType) this.value;
2878        }
2879
2880        public boolean hasValueDateType() { 
2881          return this != null && this.value instanceof DateType;
2882        }
2883
2884        /**
2885         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2886         */
2887        public TimeType getValueTimeType() throws FHIRException { 
2888          if (this.value == null)
2889            this.value = new TimeType();
2890          if (!(this.value instanceof TimeType))
2891            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2892          return (TimeType) this.value;
2893        }
2894
2895        public boolean hasValueTimeType() { 
2896          return this != null && this.value instanceof TimeType;
2897        }
2898
2899        /**
2900         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2901         */
2902        public StringType getValueStringType() throws FHIRException { 
2903          if (this.value == null)
2904            this.value = new StringType();
2905          if (!(this.value instanceof StringType))
2906            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2907          return (StringType) this.value;
2908        }
2909
2910        public boolean hasValueStringType() { 
2911          return this != null && this.value instanceof StringType;
2912        }
2913
2914        /**
2915         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2916         */
2917        public Coding getValueCoding() throws FHIRException { 
2918          if (this.value == null)
2919            this.value = new Coding();
2920          if (!(this.value instanceof Coding))
2921            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2922          return (Coding) this.value;
2923        }
2924
2925        public boolean hasValueCoding() { 
2926          return this != null && this.value instanceof Coding;
2927        }
2928
2929        /**
2930         * @return {@link #value} (A potential answer that's allowed as the answer to this question.)
2931         */
2932        public Reference getValueReference() throws FHIRException { 
2933          if (this.value == null)
2934            this.value = new Reference();
2935          if (!(this.value instanceof Reference))
2936            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
2937          return (Reference) this.value;
2938        }
2939
2940        public boolean hasValueReference() { 
2941          return this != null && this.value instanceof Reference;
2942        }
2943
2944        public boolean hasValue() { 
2945          return this.value != null && !this.value.isEmpty();
2946        }
2947
2948        /**
2949         * @param value {@link #value} (A potential answer that's allowed as the answer to this question.)
2950         */
2951        public QuestionnaireItemAnswerOptionComponent setValue(DataType value) { 
2952          if (value != null && !(value instanceof IntegerType || value instanceof DateType || value instanceof TimeType || value instanceof StringType || value instanceof Coding || value instanceof Reference))
2953            throw new Error("Not the right type for Questionnaire.item.answerOption.value[x]: "+value.fhirType());
2954          this.value = value;
2955          return this;
2956        }
2957
2958        /**
2959         * @return {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2960         */
2961        public BooleanType getInitialSelectedElement() { 
2962          if (this.initialSelected == null)
2963            if (Configuration.errorOnAutoCreate())
2964              throw new Error("Attempt to auto-create QuestionnaireItemAnswerOptionComponent.initialSelected");
2965            else if (Configuration.doAutoCreate())
2966              this.initialSelected = new BooleanType(); // bb
2967          return this.initialSelected;
2968        }
2969
2970        public boolean hasInitialSelectedElement() { 
2971          return this.initialSelected != null && !this.initialSelected.isEmpty();
2972        }
2973
2974        public boolean hasInitialSelected() { 
2975          return this.initialSelected != null && !this.initialSelected.isEmpty();
2976        }
2977
2978        /**
2979         * @param value {@link #initialSelected} (Indicates whether the answer value is selected when the list of possible answers is initially shown.). This is the underlying object with id, value and extensions. The accessor "getInitialSelected" gives direct access to the value
2980         */
2981        public QuestionnaireItemAnswerOptionComponent setInitialSelectedElement(BooleanType value) { 
2982          this.initialSelected = value;
2983          return this;
2984        }
2985
2986        /**
2987         * @return Indicates whether the answer value is selected when the list of possible answers is initially shown.
2988         */
2989        public boolean getInitialSelected() { 
2990          return this.initialSelected == null || this.initialSelected.isEmpty() ? false : this.initialSelected.getValue();
2991        }
2992
2993        /**
2994         * @param value Indicates whether the answer value is selected when the list of possible answers is initially shown.
2995         */
2996        public QuestionnaireItemAnswerOptionComponent setInitialSelected(boolean value) { 
2997            if (this.initialSelected == null)
2998              this.initialSelected = new BooleanType();
2999            this.initialSelected.setValue(value);
3000          return this;
3001        }
3002
3003        protected void listChildren(List<Property> children) {
3004          super.listChildren(children);
3005          children.add(new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value));
3006          children.add(new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected));
3007        }
3008
3009        @Override
3010        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3011          switch (_hash) {
3012          case -1410166417: /*value[x]*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3013          case 111972721: /*value*/  return new Property("value[x]", "integer|date|time|string|Coding|Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3014          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3015          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3016          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3017          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3018          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3019          case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference(Any)", "A potential answer that's allowed as the answer to this question.", 0, 1, value);
3020          case -1310184961: /*initialSelected*/  return new Property("initialSelected", "boolean", "Indicates whether the answer value is selected when the list of possible answers is initially shown.", 0, 1, initialSelected);
3021          default: return super.getNamedProperty(_hash, _name, _checkValid);
3022          }
3023
3024        }
3025
3026      @Override
3027      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3028        switch (hash) {
3029        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3030        case -1310184961: /*initialSelected*/ return this.initialSelected == null ? new Base[0] : new Base[] {this.initialSelected}; // BooleanType
3031        default: return super.getProperty(hash, name, checkValid);
3032        }
3033
3034      }
3035
3036      @Override
3037      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3038        switch (hash) {
3039        case 111972721: // value
3040          this.value = TypeConvertor.castToType(value); // DataType
3041          return value;
3042        case -1310184961: // initialSelected
3043          this.initialSelected = TypeConvertor.castToBoolean(value); // BooleanType
3044          return value;
3045        default: return super.setProperty(hash, name, value);
3046        }
3047
3048      }
3049
3050      @Override
3051      public Base setProperty(String name, Base value) throws FHIRException {
3052        if (name.equals("value[x]")) {
3053          this.value = TypeConvertor.castToType(value); // DataType
3054        } else if (name.equals("initialSelected")) {
3055          this.initialSelected = TypeConvertor.castToBoolean(value); // BooleanType
3056        } else
3057          return super.setProperty(name, value);
3058        return value;
3059      }
3060
3061      @Override
3062      public Base makeProperty(int hash, String name) throws FHIRException {
3063        switch (hash) {
3064        case -1410166417:  return getValue();
3065        case 111972721:  return getValue();
3066        case -1310184961:  return getInitialSelectedElement();
3067        default: return super.makeProperty(hash, name);
3068        }
3069
3070      }
3071
3072      @Override
3073      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3074        switch (hash) {
3075        case 111972721: /*value*/ return new String[] {"integer", "date", "time", "string", "Coding", "Reference"};
3076        case -1310184961: /*initialSelected*/ return new String[] {"boolean"};
3077        default: return super.getTypesForProperty(hash, name);
3078        }
3079
3080      }
3081
3082      @Override
3083      public Base addChild(String name) throws FHIRException {
3084        if (name.equals("valueInteger")) {
3085          this.value = new IntegerType();
3086          return this.value;
3087        }
3088        else if (name.equals("valueDate")) {
3089          this.value = new DateType();
3090          return this.value;
3091        }
3092        else if (name.equals("valueTime")) {
3093          this.value = new TimeType();
3094          return this.value;
3095        }
3096        else if (name.equals("valueString")) {
3097          this.value = new StringType();
3098          return this.value;
3099        }
3100        else if (name.equals("valueCoding")) {
3101          this.value = new Coding();
3102          return this.value;
3103        }
3104        else if (name.equals("valueReference")) {
3105          this.value = new Reference();
3106          return this.value;
3107        }
3108        else if (name.equals("initialSelected")) {
3109          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.item.answerOption.initialSelected");
3110        }
3111        else
3112          return super.addChild(name);
3113      }
3114
3115      public QuestionnaireItemAnswerOptionComponent copy() {
3116        QuestionnaireItemAnswerOptionComponent dst = new QuestionnaireItemAnswerOptionComponent();
3117        copyValues(dst);
3118        return dst;
3119      }
3120
3121      public void copyValues(QuestionnaireItemAnswerOptionComponent dst) {
3122        super.copyValues(dst);
3123        dst.value = value == null ? null : value.copy();
3124        dst.initialSelected = initialSelected == null ? null : initialSelected.copy();
3125      }
3126
3127      @Override
3128      public boolean equalsDeep(Base other_) {
3129        if (!super.equalsDeep(other_))
3130          return false;
3131        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
3132          return false;
3133        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
3134        return compareDeep(value, o.value, true) && compareDeep(initialSelected, o.initialSelected, true)
3135          ;
3136      }
3137
3138      @Override
3139      public boolean equalsShallow(Base other_) {
3140        if (!super.equalsShallow(other_))
3141          return false;
3142        if (!(other_ instanceof QuestionnaireItemAnswerOptionComponent))
3143          return false;
3144        QuestionnaireItemAnswerOptionComponent o = (QuestionnaireItemAnswerOptionComponent) other_;
3145        return compareValues(initialSelected, o.initialSelected, true);
3146      }
3147
3148      public boolean isEmpty() {
3149        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, initialSelected);
3150      }
3151
3152  public String fhirType() {
3153    return "Questionnaire.item.answerOption";
3154
3155  }
3156
3157  }
3158
3159    @Block()
3160    public static class QuestionnaireItemInitialComponent extends BackboneElement implements IBaseBackboneElement {
3161        /**
3162         * The actual value to for an initial answer.
3163         */
3164        @Child(name = "value", type = {BooleanType.class, DecimalType.class, IntegerType.class, DateType.class, DateTimeType.class, TimeType.class, StringType.class, UriType.class, Attachment.class, Coding.class, Quantity.class, Reference.class}, order=1, min=1, max=1, modifier=false, summary=false)
3165        @Description(shortDefinition="Actual value for initializing the question", formalDefinition="The actual value to for an initial answer." )
3166        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-answers")
3167        protected DataType value;
3168
3169        private static final long serialVersionUID = -1135414639L;
3170
3171    /**
3172     * Constructor
3173     */
3174      public QuestionnaireItemInitialComponent() {
3175        super();
3176      }
3177
3178    /**
3179     * Constructor
3180     */
3181      public QuestionnaireItemInitialComponent(DataType value) {
3182        super();
3183        this.setValue(value);
3184      }
3185
3186        /**
3187         * @return {@link #value} (The actual value to for an initial answer.)
3188         */
3189        public DataType getValue() { 
3190          return this.value;
3191        }
3192
3193        /**
3194         * @return {@link #value} (The actual value to for an initial answer.)
3195         */
3196        public BooleanType getValueBooleanType() throws FHIRException { 
3197          if (this.value == null)
3198            this.value = new BooleanType();
3199          if (!(this.value instanceof BooleanType))
3200            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3201          return (BooleanType) this.value;
3202        }
3203
3204        public boolean hasValueBooleanType() { 
3205          return this != null && this.value instanceof BooleanType;
3206        }
3207
3208        /**
3209         * @return {@link #value} (The actual value to for an initial answer.)
3210         */
3211        public DecimalType getValueDecimalType() throws FHIRException { 
3212          if (this.value == null)
3213            this.value = new DecimalType();
3214          if (!(this.value instanceof DecimalType))
3215            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
3216          return (DecimalType) this.value;
3217        }
3218
3219        public boolean hasValueDecimalType() { 
3220          return this != null && this.value instanceof DecimalType;
3221        }
3222
3223        /**
3224         * @return {@link #value} (The actual value to for an initial answer.)
3225         */
3226        public IntegerType getValueIntegerType() throws FHIRException { 
3227          if (this.value == null)
3228            this.value = new IntegerType();
3229          if (!(this.value instanceof IntegerType))
3230            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3231          return (IntegerType) this.value;
3232        }
3233
3234        public boolean hasValueIntegerType() { 
3235          return this != null && this.value instanceof IntegerType;
3236        }
3237
3238        /**
3239         * @return {@link #value} (The actual value to for an initial answer.)
3240         */
3241        public DateType getValueDateType() throws FHIRException { 
3242          if (this.value == null)
3243            this.value = new DateType();
3244          if (!(this.value instanceof DateType))
3245            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
3246          return (DateType) this.value;
3247        }
3248
3249        public boolean hasValueDateType() { 
3250          return this != null && this.value instanceof DateType;
3251        }
3252
3253        /**
3254         * @return {@link #value} (The actual value to for an initial answer.)
3255         */
3256        public DateTimeType getValueDateTimeType() throws FHIRException { 
3257          if (this.value == null)
3258            this.value = new DateTimeType();
3259          if (!(this.value instanceof DateTimeType))
3260            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3261          return (DateTimeType) this.value;
3262        }
3263
3264        public boolean hasValueDateTimeType() { 
3265          return this != null && this.value instanceof DateTimeType;
3266        }
3267
3268        /**
3269         * @return {@link #value} (The actual value to for an initial answer.)
3270         */
3271        public TimeType getValueTimeType() throws FHIRException { 
3272          if (this.value == null)
3273            this.value = new TimeType();
3274          if (!(this.value instanceof TimeType))
3275            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
3276          return (TimeType) this.value;
3277        }
3278
3279        public boolean hasValueTimeType() { 
3280          return this != null && this.value instanceof TimeType;
3281        }
3282
3283        /**
3284         * @return {@link #value} (The actual value to for an initial answer.)
3285         */
3286        public StringType getValueStringType() throws FHIRException { 
3287          if (this.value == null)
3288            this.value = new StringType();
3289          if (!(this.value instanceof StringType))
3290            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3291          return (StringType) this.value;
3292        }
3293
3294        public boolean hasValueStringType() { 
3295          return this != null && this.value instanceof StringType;
3296        }
3297
3298        /**
3299         * @return {@link #value} (The actual value to for an initial answer.)
3300         */
3301        public UriType getValueUriType() throws FHIRException { 
3302          if (this.value == null)
3303            this.value = new UriType();
3304          if (!(this.value instanceof UriType))
3305            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
3306          return (UriType) this.value;
3307        }
3308
3309        public boolean hasValueUriType() { 
3310          return this != null && this.value instanceof UriType;
3311        }
3312
3313        /**
3314         * @return {@link #value} (The actual value to for an initial answer.)
3315         */
3316        public Attachment getValueAttachment() throws FHIRException { 
3317          if (this.value == null)
3318            this.value = new Attachment();
3319          if (!(this.value instanceof Attachment))
3320            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3321          return (Attachment) this.value;
3322        }
3323
3324        public boolean hasValueAttachment() { 
3325          return this != null && this.value instanceof Attachment;
3326        }
3327
3328        /**
3329         * @return {@link #value} (The actual value to for an initial answer.)
3330         */
3331        public Coding getValueCoding() throws FHIRException { 
3332          if (this.value == null)
3333            this.value = new Coding();
3334          if (!(this.value instanceof Coding))
3335            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3336          return (Coding) this.value;
3337        }
3338
3339        public boolean hasValueCoding() { 
3340          return this != null && this.value instanceof Coding;
3341        }
3342
3343        /**
3344         * @return {@link #value} (The actual value to for an initial answer.)
3345         */
3346        public Quantity getValueQuantity() throws FHIRException { 
3347          if (this.value == null)
3348            this.value = new Quantity();
3349          if (!(this.value instanceof Quantity))
3350            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3351          return (Quantity) this.value;
3352        }
3353
3354        public boolean hasValueQuantity() { 
3355          return this != null && this.value instanceof Quantity;
3356        }
3357
3358        /**
3359         * @return {@link #value} (The actual value to for an initial answer.)
3360         */
3361        public Reference getValueReference() throws FHIRException { 
3362          if (this.value == null)
3363            this.value = new Reference();
3364          if (!(this.value instanceof Reference))
3365            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3366          return (Reference) this.value;
3367        }
3368
3369        public boolean hasValueReference() { 
3370          return this != null && this.value instanceof Reference;
3371        }
3372
3373        public boolean hasValue() { 
3374          return this.value != null && !this.value.isEmpty();
3375        }
3376
3377        /**
3378         * @param value {@link #value} (The actual value to for an initial answer.)
3379         */
3380        public QuestionnaireItemInitialComponent setValue(DataType value) { 
3381          if (value != null && !(value instanceof BooleanType || value instanceof DecimalType || value instanceof IntegerType || value instanceof DateType || value instanceof DateTimeType || value instanceof TimeType || value instanceof StringType || value instanceof UriType || value instanceof Attachment || value instanceof Coding || value instanceof Quantity || value instanceof Reference))
3382            throw new Error("Not the right type for Questionnaire.item.initial.value[x]: "+value.fhirType());
3383          this.value = value;
3384          return this;
3385        }
3386
3387        protected void listChildren(List<Property> children) {
3388          super.listChildren(children);
3389          children.add(new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value));
3390        }
3391
3392        @Override
3393        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3394          switch (_hash) {
3395          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3396          case 111972721: /*value*/  return new Property("value[x]", "boolean|decimal|integer|date|dateTime|time|string|uri|Attachment|Coding|Quantity|Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3397          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "The actual value to for an initial answer.", 0, 1, value);
3398          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "decimal", "The actual value to for an initial answer.", 0, 1, value);
3399          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "The actual value to for an initial answer.", 0, 1, value);
3400          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "The actual value to for an initial answer.", 0, 1, value);
3401          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The actual value to for an initial answer.", 0, 1, value);
3402          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "The actual value to for an initial answer.", 0, 1, value);
3403          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "The actual value to for an initial answer.", 0, 1, value);
3404          case -1410172357: /*valueUri*/  return new Property("value[x]", "uri", "The actual value to for an initial answer.", 0, 1, value);
3405          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "The actual value to for an initial answer.", 0, 1, value);
3406          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "The actual value to for an initial answer.", 0, 1, value);
3407          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "The actual value to for an initial answer.", 0, 1, value);
3408          case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference(Any)", "The actual value to for an initial answer.", 0, 1, value);
3409          default: return super.getNamedProperty(_hash, _name, _checkValid);
3410          }
3411
3412        }
3413
3414      @Override
3415      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3416        switch (hash) {
3417        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3418        default: return super.getProperty(hash, name, checkValid);
3419        }
3420
3421      }
3422
3423      @Override
3424      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3425        switch (hash) {
3426        case 111972721: // value
3427          this.value = TypeConvertor.castToType(value); // DataType
3428          return value;
3429        default: return super.setProperty(hash, name, value);
3430        }
3431
3432      }
3433
3434      @Override
3435      public Base setProperty(String name, Base value) throws FHIRException {
3436        if (name.equals("value[x]")) {
3437          this.value = TypeConvertor.castToType(value); // DataType
3438        } else
3439          return super.setProperty(name, value);
3440        return value;
3441      }
3442
3443      @Override
3444      public Base makeProperty(int hash, String name) throws FHIRException {
3445        switch (hash) {
3446        case -1410166417:  return getValue();
3447        case 111972721:  return getValue();
3448        default: return super.makeProperty(hash, name);
3449        }
3450
3451      }
3452
3453      @Override
3454      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3455        switch (hash) {
3456        case 111972721: /*value*/ return new String[] {"boolean", "decimal", "integer", "date", "dateTime", "time", "string", "uri", "Attachment", "Coding", "Quantity", "Reference"};
3457        default: return super.getTypesForProperty(hash, name);
3458        }
3459
3460      }
3461
3462      @Override
3463      public Base addChild(String name) throws FHIRException {
3464        if (name.equals("valueBoolean")) {
3465          this.value = new BooleanType();
3466          return this.value;
3467        }
3468        else if (name.equals("valueDecimal")) {
3469          this.value = new DecimalType();
3470          return this.value;
3471        }
3472        else if (name.equals("valueInteger")) {
3473          this.value = new IntegerType();
3474          return this.value;
3475        }
3476        else if (name.equals("valueDate")) {
3477          this.value = new DateType();
3478          return this.value;
3479        }
3480        else if (name.equals("valueDateTime")) {
3481          this.value = new DateTimeType();
3482          return this.value;
3483        }
3484        else if (name.equals("valueTime")) {
3485          this.value = new TimeType();
3486          return this.value;
3487        }
3488        else if (name.equals("valueString")) {
3489          this.value = new StringType();
3490          return this.value;
3491        }
3492        else if (name.equals("valueUri")) {
3493          this.value = new UriType();
3494          return this.value;
3495        }
3496        else if (name.equals("valueAttachment")) {
3497          this.value = new Attachment();
3498          return this.value;
3499        }
3500        else if (name.equals("valueCoding")) {
3501          this.value = new Coding();
3502          return this.value;
3503        }
3504        else if (name.equals("valueQuantity")) {
3505          this.value = new Quantity();
3506          return this.value;
3507        }
3508        else if (name.equals("valueReference")) {
3509          this.value = new Reference();
3510          return this.value;
3511        }
3512        else
3513          return super.addChild(name);
3514      }
3515
3516      public QuestionnaireItemInitialComponent copy() {
3517        QuestionnaireItemInitialComponent dst = new QuestionnaireItemInitialComponent();
3518        copyValues(dst);
3519        return dst;
3520      }
3521
3522      public void copyValues(QuestionnaireItemInitialComponent dst) {
3523        super.copyValues(dst);
3524        dst.value = value == null ? null : value.copy();
3525      }
3526
3527      @Override
3528      public boolean equalsDeep(Base other_) {
3529        if (!super.equalsDeep(other_))
3530          return false;
3531        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3532          return false;
3533        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3534        return compareDeep(value, o.value, true);
3535      }
3536
3537      @Override
3538      public boolean equalsShallow(Base other_) {
3539        if (!super.equalsShallow(other_))
3540          return false;
3541        if (!(other_ instanceof QuestionnaireItemInitialComponent))
3542          return false;
3543        QuestionnaireItemInitialComponent o = (QuestionnaireItemInitialComponent) other_;
3544        return true;
3545      }
3546
3547      public boolean isEmpty() {
3548        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value);
3549      }
3550
3551  public String fhirType() {
3552    return "Questionnaire.item.initial";
3553
3554  }
3555
3556  }
3557
3558    /**
3559     * An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3560     */
3561    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
3562    @Description(shortDefinition="Canonical identifier for this questionnaire, represented as a URI (globally unique)", formalDefinition="An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers." )
3563    protected UriType url;
3564
3565    /**
3566     * A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.
3567     */
3568    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3569    @Description(shortDefinition="Additional identifier for the questionnaire", formalDefinition="A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance." )
3570    protected List<Identifier> identifier;
3571
3572    /**
3573     * The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.
3574     */
3575    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3576    @Description(shortDefinition="Business version of the questionnaire", formalDefinition="The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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." )
3577    protected StringType version;
3578
3579    /**
3580     * A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3581     */
3582    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3583    @Description(shortDefinition="Name for this questionnaire (computer friendly)", formalDefinition="A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
3584    protected StringType name;
3585
3586    /**
3587     * A short, descriptive, user-friendly title for the questionnaire.
3588     */
3589    @Child(name = "title", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3590    @Description(shortDefinition="Name for this questionnaire (human friendly)", formalDefinition="A short, descriptive, user-friendly title for the questionnaire." )
3591    protected StringType title;
3592
3593    /**
3594     * The URL of a Questionnaire that this Questionnaire is based on.
3595     */
3596    @Child(name = "derivedFrom", type = {CanonicalType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3597    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL of a Questionnaire that this Questionnaire is based on." )
3598    protected List<CanonicalType> derivedFrom;
3599
3600    /**
3601     * The status of this questionnaire. Enables tracking the life-cycle of the content.
3602     */
3603    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
3604    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The status of this questionnaire. Enables tracking the life-cycle of the content." )
3605    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
3606    protected Enumeration<PublicationStatus> status;
3607
3608    /**
3609     * A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
3610     */
3611    @Child(name = "experimental", type = {BooleanType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3612    @Description(shortDefinition="For testing purposes, not real usage", formalDefinition="A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage." )
3613    protected BooleanType experimental;
3614
3615    /**
3616     * The types of subjects that can be the subject of responses created for the questionnaire.
3617     */
3618    @Child(name = "subjectType", type = {CodeType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3619    @Description(shortDefinition="Resource that can be subject of QuestionnaireResponse", formalDefinition="The types of subjects that can be the subject of responses created for the questionnaire." )
3620    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
3621    protected List<CodeType> subjectType;
3622
3623    /**
3624     * The date  (and optionally time) when the questionnaire 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 questionnaire changes.
3625     */
3626    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
3627    @Description(shortDefinition="Date last formally published", formalDefinition="The date  (and optionally time) when the questionnaire 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 questionnaire changes." )
3628    protected DateTimeType date;
3629
3630    /**
3631     * The name of the organization or individual that published the questionnaire.
3632     */
3633    @Child(name = "publisher", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
3634    @Description(shortDefinition="Name of the publisher (organization or individual)", formalDefinition="The name of the organization or individual that published the questionnaire." )
3635    protected StringType publisher;
3636
3637    /**
3638     * Contact details to assist a user in finding and communicating with the publisher.
3639     */
3640    @Child(name = "contact", type = {ContactDetail.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3641    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
3642    protected List<ContactDetail> contact;
3643
3644    /**
3645     * A free text natural language description of the questionnaire from a consumer's perspective.
3646     */
3647    @Child(name = "description", type = {MarkdownType.class}, order=12, min=0, max=1, modifier=false, summary=false)
3648    @Description(shortDefinition="Natural language description of the questionnaire", formalDefinition="A free text natural language description of the questionnaire from a consumer's perspective." )
3649    protected MarkdownType description;
3650
3651    /**
3652     * 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 questionnaire instances.
3653     */
3654    @Child(name = "useContext", type = {UsageContext.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3655    @Description(shortDefinition="The context that the content is intended to support", formalDefinition="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 questionnaire instances." )
3656    protected List<UsageContext> useContext;
3657
3658    /**
3659     * A legal or geographic region in which the questionnaire is intended to be used.
3660     */
3661    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3662    @Description(shortDefinition="Intended jurisdiction for questionnaire (if applicable)", formalDefinition="A legal or geographic region in which the questionnaire is intended to be used." )
3663    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
3664    protected List<CodeableConcept> jurisdiction;
3665
3666    /**
3667     * Explanation of why this questionnaire is needed and why it has been designed as it has.
3668     */
3669    @Child(name = "purpose", type = {MarkdownType.class}, order=15, min=0, max=1, modifier=false, summary=false)
3670    @Description(shortDefinition="Why this questionnaire is defined", formalDefinition="Explanation of why this questionnaire is needed and why it has been designed as it has." )
3671    protected MarkdownType purpose;
3672
3673    /**
3674     * A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
3675     */
3676    @Child(name = "copyright", type = {MarkdownType.class}, order=16, min=0, max=1, modifier=false, summary=false)
3677    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire." )
3678    protected MarkdownType copyright;
3679
3680    /**
3681     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3682     */
3683    @Child(name = "approvalDate", type = {DateType.class}, order=17, min=0, max=1, modifier=false, summary=false)
3684    @Description(shortDefinition="When the questionnaire was approved by publisher", formalDefinition="The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
3685    protected DateType approvalDate;
3686
3687    /**
3688     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
3689     */
3690    @Child(name = "lastReviewDate", type = {DateType.class}, order=18, min=0, max=1, modifier=false, summary=false)
3691    @Description(shortDefinition="When the questionnaire was last reviewed", formalDefinition="The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date." )
3692    protected DateType lastReviewDate;
3693
3694    /**
3695     * The period during which the questionnaire content was or is planned to be in active use.
3696     */
3697    @Child(name = "effectivePeriod", type = {Period.class}, order=19, min=0, max=1, modifier=false, summary=true)
3698    @Description(shortDefinition="When the questionnaire is expected to be used", formalDefinition="The period during which the questionnaire content was or is planned to be in active use." )
3699    protected Period effectivePeriod;
3700
3701    /**
3702     * An identifier for this question or group of questions in a particular terminology such as LOINC.
3703     */
3704    @Child(name = "code", type = {Coding.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3705    @Description(shortDefinition="Concept that represents the overall questionnaire", formalDefinition="An identifier for this question or group of questions in a particular terminology such as LOINC." )
3706    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/questionnaire-questions")
3707    protected List<Coding> code;
3708
3709    /**
3710     * A particular question, question grouping or display text that is part of the questionnaire.
3711     */
3712    @Child(name = "item", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3713    @Description(shortDefinition="Questions and sections within the Questionnaire", formalDefinition="A particular question, question grouping or display text that is part of the questionnaire." )
3714    protected List<QuestionnaireItemComponent> item;
3715
3716    private static final long serialVersionUID = -2135957722L;
3717
3718  /**
3719   * Constructor
3720   */
3721    public Questionnaire() {
3722      super();
3723    }
3724
3725  /**
3726   * Constructor
3727   */
3728    public Questionnaire(PublicationStatus status) {
3729      super();
3730      this.setStatus(status);
3731    }
3732
3733    /**
3734     * @return {@link #url} (An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3735     */
3736    public UriType getUrlElement() { 
3737      if (this.url == null)
3738        if (Configuration.errorOnAutoCreate())
3739          throw new Error("Attempt to auto-create Questionnaire.url");
3740        else if (Configuration.doAutoCreate())
3741          this.url = new UriType(); // bb
3742      return this.url;
3743    }
3744
3745    public boolean hasUrlElement() { 
3746      return this.url != null && !this.url.isEmpty();
3747    }
3748
3749    public boolean hasUrl() { 
3750      return this.url != null && !this.url.isEmpty();
3751    }
3752
3753    /**
3754     * @param value {@link #url} (An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3755     */
3756    public Questionnaire setUrlElement(UriType value) { 
3757      this.url = value;
3758      return this;
3759    }
3760
3761    /**
3762     * @return An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3763     */
3764    public String getUrl() { 
3765      return this.url == null ? null : this.url.getValue();
3766    }
3767
3768    /**
3769     * @param value An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.
3770     */
3771    public Questionnaire setUrl(String value) { 
3772      if (Utilities.noString(value))
3773        this.url = null;
3774      else {
3775        if (this.url == null)
3776          this.url = new UriType();
3777        this.url.setValue(value);
3778      }
3779      return this;
3780    }
3781
3782    /**
3783     * @return {@link #identifier} (A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.)
3784     */
3785    public List<Identifier> getIdentifier() { 
3786      if (this.identifier == null)
3787        this.identifier = new ArrayList<Identifier>();
3788      return this.identifier;
3789    }
3790
3791    /**
3792     * @return Returns a reference to <code>this</code> for easy method chaining
3793     */
3794    public Questionnaire setIdentifier(List<Identifier> theIdentifier) { 
3795      this.identifier = theIdentifier;
3796      return this;
3797    }
3798
3799    public boolean hasIdentifier() { 
3800      if (this.identifier == null)
3801        return false;
3802      for (Identifier item : this.identifier)
3803        if (!item.isEmpty())
3804          return true;
3805      return false;
3806    }
3807
3808    public Identifier addIdentifier() { //3
3809      Identifier t = new Identifier();
3810      if (this.identifier == null)
3811        this.identifier = new ArrayList<Identifier>();
3812      this.identifier.add(t);
3813      return t;
3814    }
3815
3816    public Questionnaire addIdentifier(Identifier t) { //3
3817      if (t == null)
3818        return this;
3819      if (this.identifier == null)
3820        this.identifier = new ArrayList<Identifier>();
3821      this.identifier.add(t);
3822      return this;
3823    }
3824
3825    /**
3826     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
3827     */
3828    public Identifier getIdentifierFirstRep() { 
3829      if (getIdentifier().isEmpty()) {
3830        addIdentifier();
3831      }
3832      return getIdentifier().get(0);
3833    }
3834
3835    /**
3836     * @return {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3837     */
3838    public StringType getVersionElement() { 
3839      if (this.version == null)
3840        if (Configuration.errorOnAutoCreate())
3841          throw new Error("Attempt to auto-create Questionnaire.version");
3842        else if (Configuration.doAutoCreate())
3843          this.version = new StringType(); // bb
3844      return this.version;
3845    }
3846
3847    public boolean hasVersionElement() { 
3848      return this.version != null && !this.version.isEmpty();
3849    }
3850
3851    public boolean hasVersion() { 
3852      return this.version != null && !this.version.isEmpty();
3853    }
3854
3855    /**
3856     * @param value {@link #version} (The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3857     */
3858    public Questionnaire setVersionElement(StringType value) { 
3859      this.version = value;
3860      return this;
3861    }
3862
3863    /**
3864     * @return The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.
3865     */
3866    public String getVersion() { 
3867      return this.version == null ? null : this.version.getValue();
3868    }
3869
3870    /**
3871     * @param value The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.
3872     */
3873    public Questionnaire setVersion(String value) { 
3874      if (Utilities.noString(value))
3875        this.version = null;
3876      else {
3877        if (this.version == null)
3878          this.version = new StringType();
3879        this.version.setValue(value);
3880      }
3881      return this;
3882    }
3883
3884    /**
3885     * @return {@link #name} (A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3886     */
3887    public StringType getNameElement() { 
3888      if (this.name == null)
3889        if (Configuration.errorOnAutoCreate())
3890          throw new Error("Attempt to auto-create Questionnaire.name");
3891        else if (Configuration.doAutoCreate())
3892          this.name = new StringType(); // bb
3893      return this.name;
3894    }
3895
3896    public boolean hasNameElement() { 
3897      return this.name != null && !this.name.isEmpty();
3898    }
3899
3900    public boolean hasName() { 
3901      return this.name != null && !this.name.isEmpty();
3902    }
3903
3904    /**
3905     * @param value {@link #name} (A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3906     */
3907    public Questionnaire setNameElement(StringType value) { 
3908      this.name = value;
3909      return this;
3910    }
3911
3912    /**
3913     * @return A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3914     */
3915    public String getName() { 
3916      return this.name == null ? null : this.name.getValue();
3917    }
3918
3919    /**
3920     * @param value A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3921     */
3922    public Questionnaire setName(String value) { 
3923      if (Utilities.noString(value))
3924        this.name = null;
3925      else {
3926        if (this.name == null)
3927          this.name = new StringType();
3928        this.name.setValue(value);
3929      }
3930      return this;
3931    }
3932
3933    /**
3934     * @return {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3935     */
3936    public StringType getTitleElement() { 
3937      if (this.title == null)
3938        if (Configuration.errorOnAutoCreate())
3939          throw new Error("Attempt to auto-create Questionnaire.title");
3940        else if (Configuration.doAutoCreate())
3941          this.title = new StringType(); // bb
3942      return this.title;
3943    }
3944
3945    public boolean hasTitleElement() { 
3946      return this.title != null && !this.title.isEmpty();
3947    }
3948
3949    public boolean hasTitle() { 
3950      return this.title != null && !this.title.isEmpty();
3951    }
3952
3953    /**
3954     * @param value {@link #title} (A short, descriptive, user-friendly title for the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3955     */
3956    public Questionnaire setTitleElement(StringType value) { 
3957      this.title = value;
3958      return this;
3959    }
3960
3961    /**
3962     * @return A short, descriptive, user-friendly title for the questionnaire.
3963     */
3964    public String getTitle() { 
3965      return this.title == null ? null : this.title.getValue();
3966    }
3967
3968    /**
3969     * @param value A short, descriptive, user-friendly title for the questionnaire.
3970     */
3971    public Questionnaire setTitle(String value) { 
3972      if (Utilities.noString(value))
3973        this.title = null;
3974      else {
3975        if (this.title == null)
3976          this.title = new StringType();
3977        this.title.setValue(value);
3978      }
3979      return this;
3980    }
3981
3982    /**
3983     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
3984     */
3985    public List<CanonicalType> getDerivedFrom() { 
3986      if (this.derivedFrom == null)
3987        this.derivedFrom = new ArrayList<CanonicalType>();
3988      return this.derivedFrom;
3989    }
3990
3991    /**
3992     * @return Returns a reference to <code>this</code> for easy method chaining
3993     */
3994    public Questionnaire setDerivedFrom(List<CanonicalType> theDerivedFrom) { 
3995      this.derivedFrom = theDerivedFrom;
3996      return this;
3997    }
3998
3999    public boolean hasDerivedFrom() { 
4000      if (this.derivedFrom == null)
4001        return false;
4002      for (CanonicalType item : this.derivedFrom)
4003        if (!item.isEmpty())
4004          return true;
4005      return false;
4006    }
4007
4008    /**
4009     * @return {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
4010     */
4011    public CanonicalType addDerivedFromElement() {//2 
4012      CanonicalType t = new CanonicalType();
4013      if (this.derivedFrom == null)
4014        this.derivedFrom = new ArrayList<CanonicalType>();
4015      this.derivedFrom.add(t);
4016      return t;
4017    }
4018
4019    /**
4020     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
4021     */
4022    public Questionnaire addDerivedFrom(String value) { //1
4023      CanonicalType t = new CanonicalType();
4024      t.setValue(value);
4025      if (this.derivedFrom == null)
4026        this.derivedFrom = new ArrayList<CanonicalType>();
4027      this.derivedFrom.add(t);
4028      return this;
4029    }
4030
4031    /**
4032     * @param value {@link #derivedFrom} (The URL of a Questionnaire that this Questionnaire is based on.)
4033     */
4034    public boolean hasDerivedFrom(String value) { 
4035      if (this.derivedFrom == null)
4036        return false;
4037      for (CanonicalType v : this.derivedFrom)
4038        if (v.getValue().equals(value)) // canonical
4039          return true;
4040      return false;
4041    }
4042
4043    /**
4044     * @return {@link #status} (The status of this questionnaire. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4045     */
4046    public Enumeration<PublicationStatus> getStatusElement() { 
4047      if (this.status == null)
4048        if (Configuration.errorOnAutoCreate())
4049          throw new Error("Attempt to auto-create Questionnaire.status");
4050        else if (Configuration.doAutoCreate())
4051          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
4052      return this.status;
4053    }
4054
4055    public boolean hasStatusElement() { 
4056      return this.status != null && !this.status.isEmpty();
4057    }
4058
4059    public boolean hasStatus() { 
4060      return this.status != null && !this.status.isEmpty();
4061    }
4062
4063    /**
4064     * @param value {@link #status} (The status of this questionnaire. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4065     */
4066    public Questionnaire setStatusElement(Enumeration<PublicationStatus> value) { 
4067      this.status = value;
4068      return this;
4069    }
4070
4071    /**
4072     * @return The status of this questionnaire. Enables tracking the life-cycle of the content.
4073     */
4074    public PublicationStatus getStatus() { 
4075      return this.status == null ? null : this.status.getValue();
4076    }
4077
4078    /**
4079     * @param value The status of this questionnaire. Enables tracking the life-cycle of the content.
4080     */
4081    public Questionnaire setStatus(PublicationStatus value) { 
4082        if (this.status == null)
4083          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
4084        this.status.setValue(value);
4085      return this;
4086    }
4087
4088    /**
4089     * @return {@link #experimental} (A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
4090     */
4091    public BooleanType getExperimentalElement() { 
4092      if (this.experimental == null)
4093        if (Configuration.errorOnAutoCreate())
4094          throw new Error("Attempt to auto-create Questionnaire.experimental");
4095        else if (Configuration.doAutoCreate())
4096          this.experimental = new BooleanType(); // bb
4097      return this.experimental;
4098    }
4099
4100    public boolean hasExperimentalElement() { 
4101      return this.experimental != null && !this.experimental.isEmpty();
4102    }
4103
4104    public boolean hasExperimental() { 
4105      return this.experimental != null && !this.experimental.isEmpty();
4106    }
4107
4108    /**
4109     * @param value {@link #experimental} (A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
4110     */
4111    public Questionnaire setExperimentalElement(BooleanType value) { 
4112      this.experimental = value;
4113      return this;
4114    }
4115
4116    /**
4117     * @return A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
4118     */
4119    public boolean getExperimental() { 
4120      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
4121    }
4122
4123    /**
4124     * @param value A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
4125     */
4126    public Questionnaire setExperimental(boolean value) { 
4127        if (this.experimental == null)
4128          this.experimental = new BooleanType();
4129        this.experimental.setValue(value);
4130      return this;
4131    }
4132
4133    /**
4134     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
4135     */
4136    public List<CodeType> getSubjectType() { 
4137      if (this.subjectType == null)
4138        this.subjectType = new ArrayList<CodeType>();
4139      return this.subjectType;
4140    }
4141
4142    /**
4143     * @return Returns a reference to <code>this</code> for easy method chaining
4144     */
4145    public Questionnaire setSubjectType(List<CodeType> theSubjectType) { 
4146      this.subjectType = theSubjectType;
4147      return this;
4148    }
4149
4150    public boolean hasSubjectType() { 
4151      if (this.subjectType == null)
4152        return false;
4153      for (CodeType item : this.subjectType)
4154        if (!item.isEmpty())
4155          return true;
4156      return false;
4157    }
4158
4159    /**
4160     * @return {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
4161     */
4162    public CodeType addSubjectTypeElement() {//2 
4163      CodeType t = new CodeType();
4164      if (this.subjectType == null)
4165        this.subjectType = new ArrayList<CodeType>();
4166      this.subjectType.add(t);
4167      return t;
4168    }
4169
4170    /**
4171     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
4172     */
4173    public Questionnaire addSubjectType(String value) { //1
4174      CodeType t = new CodeType();
4175      t.setValue(value);
4176      if (this.subjectType == null)
4177        this.subjectType = new ArrayList<CodeType>();
4178      this.subjectType.add(t);
4179      return this;
4180    }
4181
4182    /**
4183     * @param value {@link #subjectType} (The types of subjects that can be the subject of responses created for the questionnaire.)
4184     */
4185    public boolean hasSubjectType(String value) { 
4186      if (this.subjectType == null)
4187        return false;
4188      for (CodeType v : this.subjectType)
4189        if (v.getValue().equals(value)) // code
4190          return true;
4191      return false;
4192    }
4193
4194    /**
4195     * @return {@link #date} (The date  (and optionally time) when the questionnaire 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 questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
4196     */
4197    public DateTimeType getDateElement() { 
4198      if (this.date == null)
4199        if (Configuration.errorOnAutoCreate())
4200          throw new Error("Attempt to auto-create Questionnaire.date");
4201        else if (Configuration.doAutoCreate())
4202          this.date = new DateTimeType(); // bb
4203      return this.date;
4204    }
4205
4206    public boolean hasDateElement() { 
4207      return this.date != null && !this.date.isEmpty();
4208    }
4209
4210    public boolean hasDate() { 
4211      return this.date != null && !this.date.isEmpty();
4212    }
4213
4214    /**
4215     * @param value {@link #date} (The date  (and optionally time) when the questionnaire 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 questionnaire changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
4216     */
4217    public Questionnaire setDateElement(DateTimeType value) { 
4218      this.date = value;
4219      return this;
4220    }
4221
4222    /**
4223     * @return The date  (and optionally time) when the questionnaire 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 questionnaire changes.
4224     */
4225    public Date getDate() { 
4226      return this.date == null ? null : this.date.getValue();
4227    }
4228
4229    /**
4230     * @param value The date  (and optionally time) when the questionnaire 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 questionnaire changes.
4231     */
4232    public Questionnaire setDate(Date value) { 
4233      if (value == null)
4234        this.date = null;
4235      else {
4236        if (this.date == null)
4237          this.date = new DateTimeType();
4238        this.date.setValue(value);
4239      }
4240      return this;
4241    }
4242
4243    /**
4244     * @return {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
4245     */
4246    public StringType getPublisherElement() { 
4247      if (this.publisher == null)
4248        if (Configuration.errorOnAutoCreate())
4249          throw new Error("Attempt to auto-create Questionnaire.publisher");
4250        else if (Configuration.doAutoCreate())
4251          this.publisher = new StringType(); // bb
4252      return this.publisher;
4253    }
4254
4255    public boolean hasPublisherElement() { 
4256      return this.publisher != null && !this.publisher.isEmpty();
4257    }
4258
4259    public boolean hasPublisher() { 
4260      return this.publisher != null && !this.publisher.isEmpty();
4261    }
4262
4263    /**
4264     * @param value {@link #publisher} (The name of the organization or individual that published the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
4265     */
4266    public Questionnaire setPublisherElement(StringType value) { 
4267      this.publisher = value;
4268      return this;
4269    }
4270
4271    /**
4272     * @return The name of the organization or individual that published the questionnaire.
4273     */
4274    public String getPublisher() { 
4275      return this.publisher == null ? null : this.publisher.getValue();
4276    }
4277
4278    /**
4279     * @param value The name of the organization or individual that published the questionnaire.
4280     */
4281    public Questionnaire setPublisher(String value) { 
4282      if (Utilities.noString(value))
4283        this.publisher = null;
4284      else {
4285        if (this.publisher == null)
4286          this.publisher = new StringType();
4287        this.publisher.setValue(value);
4288      }
4289      return this;
4290    }
4291
4292    /**
4293     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
4294     */
4295    public List<ContactDetail> getContact() { 
4296      if (this.contact == null)
4297        this.contact = new ArrayList<ContactDetail>();
4298      return this.contact;
4299    }
4300
4301    /**
4302     * @return Returns a reference to <code>this</code> for easy method chaining
4303     */
4304    public Questionnaire setContact(List<ContactDetail> theContact) { 
4305      this.contact = theContact;
4306      return this;
4307    }
4308
4309    public boolean hasContact() { 
4310      if (this.contact == null)
4311        return false;
4312      for (ContactDetail item : this.contact)
4313        if (!item.isEmpty())
4314          return true;
4315      return false;
4316    }
4317
4318    public ContactDetail addContact() { //3
4319      ContactDetail t = new ContactDetail();
4320      if (this.contact == null)
4321        this.contact = new ArrayList<ContactDetail>();
4322      this.contact.add(t);
4323      return t;
4324    }
4325
4326    public Questionnaire addContact(ContactDetail t) { //3
4327      if (t == null)
4328        return this;
4329      if (this.contact == null)
4330        this.contact = new ArrayList<ContactDetail>();
4331      this.contact.add(t);
4332      return this;
4333    }
4334
4335    /**
4336     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
4337     */
4338    public ContactDetail getContactFirstRep() { 
4339      if (getContact().isEmpty()) {
4340        addContact();
4341      }
4342      return getContact().get(0);
4343    }
4344
4345    /**
4346     * @return {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4347     */
4348    public MarkdownType getDescriptionElement() { 
4349      if (this.description == null)
4350        if (Configuration.errorOnAutoCreate())
4351          throw new Error("Attempt to auto-create Questionnaire.description");
4352        else if (Configuration.doAutoCreate())
4353          this.description = new MarkdownType(); // bb
4354      return this.description;
4355    }
4356
4357    public boolean hasDescriptionElement() { 
4358      return this.description != null && !this.description.isEmpty();
4359    }
4360
4361    public boolean hasDescription() { 
4362      return this.description != null && !this.description.isEmpty();
4363    }
4364
4365    /**
4366     * @param value {@link #description} (A free text natural language description of the questionnaire from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4367     */
4368    public Questionnaire setDescriptionElement(MarkdownType value) { 
4369      this.description = value;
4370      return this;
4371    }
4372
4373    /**
4374     * @return A free text natural language description of the questionnaire from a consumer's perspective.
4375     */
4376    public String getDescription() { 
4377      return this.description == null ? null : this.description.getValue();
4378    }
4379
4380    /**
4381     * @param value A free text natural language description of the questionnaire from a consumer's perspective.
4382     */
4383    public Questionnaire setDescription(String value) { 
4384      if (value == null)
4385        this.description = null;
4386      else {
4387        if (this.description == null)
4388          this.description = new MarkdownType();
4389        this.description.setValue(value);
4390      }
4391      return this;
4392    }
4393
4394    /**
4395     * @return {@link #useContext} (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 questionnaire instances.)
4396     */
4397    public List<UsageContext> getUseContext() { 
4398      if (this.useContext == null)
4399        this.useContext = new ArrayList<UsageContext>();
4400      return this.useContext;
4401    }
4402
4403    /**
4404     * @return Returns a reference to <code>this</code> for easy method chaining
4405     */
4406    public Questionnaire setUseContext(List<UsageContext> theUseContext) { 
4407      this.useContext = theUseContext;
4408      return this;
4409    }
4410
4411    public boolean hasUseContext() { 
4412      if (this.useContext == null)
4413        return false;
4414      for (UsageContext item : this.useContext)
4415        if (!item.isEmpty())
4416          return true;
4417      return false;
4418    }
4419
4420    public UsageContext addUseContext() { //3
4421      UsageContext t = new UsageContext();
4422      if (this.useContext == null)
4423        this.useContext = new ArrayList<UsageContext>();
4424      this.useContext.add(t);
4425      return t;
4426    }
4427
4428    public Questionnaire addUseContext(UsageContext t) { //3
4429      if (t == null)
4430        return this;
4431      if (this.useContext == null)
4432        this.useContext = new ArrayList<UsageContext>();
4433      this.useContext.add(t);
4434      return this;
4435    }
4436
4437    /**
4438     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
4439     */
4440    public UsageContext getUseContextFirstRep() { 
4441      if (getUseContext().isEmpty()) {
4442        addUseContext();
4443      }
4444      return getUseContext().get(0);
4445    }
4446
4447    /**
4448     * @return {@link #jurisdiction} (A legal or geographic region in which the questionnaire is intended to be used.)
4449     */
4450    public List<CodeableConcept> getJurisdiction() { 
4451      if (this.jurisdiction == null)
4452        this.jurisdiction = new ArrayList<CodeableConcept>();
4453      return this.jurisdiction;
4454    }
4455
4456    /**
4457     * @return Returns a reference to <code>this</code> for easy method chaining
4458     */
4459    public Questionnaire setJurisdiction(List<CodeableConcept> theJurisdiction) { 
4460      this.jurisdiction = theJurisdiction;
4461      return this;
4462    }
4463
4464    public boolean hasJurisdiction() { 
4465      if (this.jurisdiction == null)
4466        return false;
4467      for (CodeableConcept item : this.jurisdiction)
4468        if (!item.isEmpty())
4469          return true;
4470      return false;
4471    }
4472
4473    public CodeableConcept addJurisdiction() { //3
4474      CodeableConcept t = new CodeableConcept();
4475      if (this.jurisdiction == null)
4476        this.jurisdiction = new ArrayList<CodeableConcept>();
4477      this.jurisdiction.add(t);
4478      return t;
4479    }
4480
4481    public Questionnaire addJurisdiction(CodeableConcept t) { //3
4482      if (t == null)
4483        return this;
4484      if (this.jurisdiction == null)
4485        this.jurisdiction = new ArrayList<CodeableConcept>();
4486      this.jurisdiction.add(t);
4487      return this;
4488    }
4489
4490    /**
4491     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist {3}
4492     */
4493    public CodeableConcept getJurisdictionFirstRep() { 
4494      if (getJurisdiction().isEmpty()) {
4495        addJurisdiction();
4496      }
4497      return getJurisdiction().get(0);
4498    }
4499
4500    /**
4501     * @return {@link #purpose} (Explanation of why this questionnaire is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4502     */
4503    public MarkdownType getPurposeElement() { 
4504      if (this.purpose == null)
4505        if (Configuration.errorOnAutoCreate())
4506          throw new Error("Attempt to auto-create Questionnaire.purpose");
4507        else if (Configuration.doAutoCreate())
4508          this.purpose = new MarkdownType(); // bb
4509      return this.purpose;
4510    }
4511
4512    public boolean hasPurposeElement() { 
4513      return this.purpose != null && !this.purpose.isEmpty();
4514    }
4515
4516    public boolean hasPurpose() { 
4517      return this.purpose != null && !this.purpose.isEmpty();
4518    }
4519
4520    /**
4521     * @param value {@link #purpose} (Explanation of why this questionnaire is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4522     */
4523    public Questionnaire setPurposeElement(MarkdownType value) { 
4524      this.purpose = value;
4525      return this;
4526    }
4527
4528    /**
4529     * @return Explanation of why this questionnaire is needed and why it has been designed as it has.
4530     */
4531    public String getPurpose() { 
4532      return this.purpose == null ? null : this.purpose.getValue();
4533    }
4534
4535    /**
4536     * @param value Explanation of why this questionnaire is needed and why it has been designed as it has.
4537     */
4538    public Questionnaire setPurpose(String value) { 
4539      if (value == null)
4540        this.purpose = null;
4541      else {
4542        if (this.purpose == null)
4543          this.purpose = new MarkdownType();
4544        this.purpose.setValue(value);
4545      }
4546      return this;
4547    }
4548
4549    /**
4550     * @return {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4551     */
4552    public MarkdownType getCopyrightElement() { 
4553      if (this.copyright == null)
4554        if (Configuration.errorOnAutoCreate())
4555          throw new Error("Attempt to auto-create Questionnaire.copyright");
4556        else if (Configuration.doAutoCreate())
4557          this.copyright = new MarkdownType(); // bb
4558      return this.copyright;
4559    }
4560
4561    public boolean hasCopyrightElement() { 
4562      return this.copyright != null && !this.copyright.isEmpty();
4563    }
4564
4565    public boolean hasCopyright() { 
4566      return this.copyright != null && !this.copyright.isEmpty();
4567    }
4568
4569    /**
4570     * @param value {@link #copyright} (A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4571     */
4572    public Questionnaire setCopyrightElement(MarkdownType value) { 
4573      this.copyright = value;
4574      return this;
4575    }
4576
4577    /**
4578     * @return A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4579     */
4580    public String getCopyright() { 
4581      return this.copyright == null ? null : this.copyright.getValue();
4582    }
4583
4584    /**
4585     * @param value A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.
4586     */
4587    public Questionnaire setCopyright(String value) { 
4588      if (value == null)
4589        this.copyright = null;
4590      else {
4591        if (this.copyright == null)
4592          this.copyright = new MarkdownType();
4593        this.copyright.setValue(value);
4594      }
4595      return this;
4596    }
4597
4598    /**
4599     * @return {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4600     */
4601    public DateType getApprovalDateElement() { 
4602      if (this.approvalDate == null)
4603        if (Configuration.errorOnAutoCreate())
4604          throw new Error("Attempt to auto-create Questionnaire.approvalDate");
4605        else if (Configuration.doAutoCreate())
4606          this.approvalDate = new DateType(); // bb
4607      return this.approvalDate;
4608    }
4609
4610    public boolean hasApprovalDateElement() { 
4611      return this.approvalDate != null && !this.approvalDate.isEmpty();
4612    }
4613
4614    public boolean hasApprovalDate() { 
4615      return this.approvalDate != null && !this.approvalDate.isEmpty();
4616    }
4617
4618    /**
4619     * @param value {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
4620     */
4621    public Questionnaire setApprovalDateElement(DateType value) { 
4622      this.approvalDate = value;
4623      return this;
4624    }
4625
4626    /**
4627     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4628     */
4629    public Date getApprovalDate() { 
4630      return this.approvalDate == null ? null : this.approvalDate.getValue();
4631    }
4632
4633    /**
4634     * @param value The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
4635     */
4636    public Questionnaire setApprovalDate(Date value) { 
4637      if (value == null)
4638        this.approvalDate = null;
4639      else {
4640        if (this.approvalDate == null)
4641          this.approvalDate = new DateType();
4642        this.approvalDate.setValue(value);
4643      }
4644      return this;
4645    }
4646
4647    /**
4648     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4649     */
4650    public DateType getLastReviewDateElement() { 
4651      if (this.lastReviewDate == null)
4652        if (Configuration.errorOnAutoCreate())
4653          throw new Error("Attempt to auto-create Questionnaire.lastReviewDate");
4654        else if (Configuration.doAutoCreate())
4655          this.lastReviewDate = new DateType(); // bb
4656      return this.lastReviewDate;
4657    }
4658
4659    public boolean hasLastReviewDateElement() { 
4660      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4661    }
4662
4663    public boolean hasLastReviewDate() { 
4664      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
4665    }
4666
4667    /**
4668     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
4669     */
4670    public Questionnaire setLastReviewDateElement(DateType value) { 
4671      this.lastReviewDate = value;
4672      return this;
4673    }
4674
4675    /**
4676     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4677     */
4678    public Date getLastReviewDate() { 
4679      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
4680    }
4681
4682    /**
4683     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
4684     */
4685    public Questionnaire setLastReviewDate(Date value) { 
4686      if (value == null)
4687        this.lastReviewDate = null;
4688      else {
4689        if (this.lastReviewDate == null)
4690          this.lastReviewDate = new DateType();
4691        this.lastReviewDate.setValue(value);
4692      }
4693      return this;
4694    }
4695
4696    /**
4697     * @return {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4698     */
4699    public Period getEffectivePeriod() { 
4700      if (this.effectivePeriod == null)
4701        if (Configuration.errorOnAutoCreate())
4702          throw new Error("Attempt to auto-create Questionnaire.effectivePeriod");
4703        else if (Configuration.doAutoCreate())
4704          this.effectivePeriod = new Period(); // cc
4705      return this.effectivePeriod;
4706    }
4707
4708    public boolean hasEffectivePeriod() { 
4709      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
4710    }
4711
4712    /**
4713     * @param value {@link #effectivePeriod} (The period during which the questionnaire content was or is planned to be in active use.)
4714     */
4715    public Questionnaire setEffectivePeriod(Period value) { 
4716      this.effectivePeriod = value;
4717      return this;
4718    }
4719
4720    /**
4721     * @return {@link #code} (An identifier for this question or group of questions in a particular terminology such as LOINC.)
4722     */
4723    public List<Coding> getCode() { 
4724      if (this.code == null)
4725        this.code = new ArrayList<Coding>();
4726      return this.code;
4727    }
4728
4729    /**
4730     * @return Returns a reference to <code>this</code> for easy method chaining
4731     */
4732    public Questionnaire setCode(List<Coding> theCode) { 
4733      this.code = theCode;
4734      return this;
4735    }
4736
4737    public boolean hasCode() { 
4738      if (this.code == null)
4739        return false;
4740      for (Coding item : this.code)
4741        if (!item.isEmpty())
4742          return true;
4743      return false;
4744    }
4745
4746    public Coding addCode() { //3
4747      Coding t = new Coding();
4748      if (this.code == null)
4749        this.code = new ArrayList<Coding>();
4750      this.code.add(t);
4751      return t;
4752    }
4753
4754    public Questionnaire addCode(Coding t) { //3
4755      if (t == null)
4756        return this;
4757      if (this.code == null)
4758        this.code = new ArrayList<Coding>();
4759      this.code.add(t);
4760      return this;
4761    }
4762
4763    /**
4764     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
4765     */
4766    public Coding getCodeFirstRep() { 
4767      if (getCode().isEmpty()) {
4768        addCode();
4769      }
4770      return getCode().get(0);
4771    }
4772
4773    /**
4774     * @return {@link #item} (A particular question, question grouping or display text that is part of the questionnaire.)
4775     */
4776    public List<QuestionnaireItemComponent> getItem() { 
4777      if (this.item == null)
4778        this.item = new ArrayList<QuestionnaireItemComponent>();
4779      return this.item;
4780    }
4781
4782    /**
4783     * @return Returns a reference to <code>this</code> for easy method chaining
4784     */
4785    public Questionnaire setItem(List<QuestionnaireItemComponent> theItem) { 
4786      this.item = theItem;
4787      return this;
4788    }
4789
4790    public boolean hasItem() { 
4791      if (this.item == null)
4792        return false;
4793      for (QuestionnaireItemComponent item : this.item)
4794        if (!item.isEmpty())
4795          return true;
4796      return false;
4797    }
4798
4799    public QuestionnaireItemComponent addItem() { //3
4800      QuestionnaireItemComponent t = new QuestionnaireItemComponent();
4801      if (this.item == null)
4802        this.item = new ArrayList<QuestionnaireItemComponent>();
4803      this.item.add(t);
4804      return t;
4805    }
4806
4807    public Questionnaire addItem(QuestionnaireItemComponent t) { //3
4808      if (t == null)
4809        return this;
4810      if (this.item == null)
4811        this.item = new ArrayList<QuestionnaireItemComponent>();
4812      this.item.add(t);
4813      return this;
4814    }
4815
4816    /**
4817     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
4818     */
4819    public QuestionnaireItemComponent getItemFirstRep() { 
4820      if (getItem().isEmpty()) {
4821        addItem();
4822      }
4823      return getItem().get(0);
4824    }
4825
4826    /**
4827     * not supported on this implementation
4828     */
4829    @Override
4830    public int getTopicMax() { 
4831      return 0;
4832    }
4833    /**
4834     * @return {@link #topic} (Descriptive topics related to the content of the questionnaire. Topics provide a high-level categorization of the questionnaire that can be useful for filtering and searching.)
4835     */
4836    public List<CodeableConcept> getTopic() { 
4837      return new ArrayList<>();
4838    }
4839    /**
4840     * @return Returns a reference to <code>this</code> for easy method chaining
4841     */
4842    public Questionnaire setTopic(List<CodeableConcept> theTopic) { 
4843      throw new Error("The resource type \"Questionnaire\" does not implement the property \"topic\"");
4844    }
4845    public boolean hasTopic() { 
4846      return false;
4847    }
4848
4849    public CodeableConcept addTopic() { //3
4850      throw new Error("The resource type \"Questionnaire\" does not implement the property \"topic\"");
4851    }
4852    public Questionnaire addTopic(CodeableConcept t) { //3
4853      throw new Error("The resource type \"Questionnaire\" does not implement the property \"topic\"");
4854    }
4855    /**
4856     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist {2}
4857     */
4858    public CodeableConcept getTopicFirstRep() { 
4859      throw new Error("The resource type \"Questionnaire\" does not implement the property \"topic\"");
4860    }
4861    /**
4862     * not supported on this implementation
4863     */
4864    @Override
4865    public int getAuthorMax() { 
4866      return 0;
4867    }
4868    /**
4869     * @return {@link #author} (An individiual or organization primarily involved in the creation and maintenance of the questionnaire.)
4870     */
4871    public List<ContactDetail> getAuthor() { 
4872      return new ArrayList<>();
4873    }
4874    /**
4875     * @return Returns a reference to <code>this</code> for easy method chaining
4876     */
4877    public Questionnaire setAuthor(List<ContactDetail> theAuthor) { 
4878      throw new Error("The resource type \"Questionnaire\" does not implement the property \"author\"");
4879    }
4880    public boolean hasAuthor() { 
4881      return false;
4882    }
4883
4884    public ContactDetail addAuthor() { //3
4885      throw new Error("The resource type \"Questionnaire\" does not implement the property \"author\"");
4886    }
4887    public Questionnaire addAuthor(ContactDetail t) { //3
4888      throw new Error("The resource type \"Questionnaire\" does not implement the property \"author\"");
4889    }
4890    /**
4891     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist {2}
4892     */
4893    public ContactDetail getAuthorFirstRep() { 
4894      throw new Error("The resource type \"Questionnaire\" does not implement the property \"author\"");
4895    }
4896    /**
4897     * not supported on this implementation
4898     */
4899    @Override
4900    public int getEditorMax() { 
4901      return 0;
4902    }
4903    /**
4904     * @return {@link #editor} (An individual or organization primarily responsible for internal coherence of the questionnaire.)
4905     */
4906    public List<ContactDetail> getEditor() { 
4907      return new ArrayList<>();
4908    }
4909    /**
4910     * @return Returns a reference to <code>this</code> for easy method chaining
4911     */
4912    public Questionnaire setEditor(List<ContactDetail> theEditor) { 
4913      throw new Error("The resource type \"Questionnaire\" does not implement the property \"editor\"");
4914    }
4915    public boolean hasEditor() { 
4916      return false;
4917    }
4918
4919    public ContactDetail addEditor() { //3
4920      throw new Error("The resource type \"Questionnaire\" does not implement the property \"editor\"");
4921    }
4922    public Questionnaire addEditor(ContactDetail t) { //3
4923      throw new Error("The resource type \"Questionnaire\" does not implement the property \"editor\"");
4924    }
4925    /**
4926     * @return The first repetition of repeating field {@link #editor}, creating it if it does not already exist {2}
4927     */
4928    public ContactDetail getEditorFirstRep() { 
4929      throw new Error("The resource type \"Questionnaire\" does not implement the property \"editor\"");
4930    }
4931    /**
4932     * not supported on this implementation
4933     */
4934    @Override
4935    public int getReviewerMax() { 
4936      return 0;
4937    }
4938    /**
4939     * @return {@link #reviewer} (An individual or organization primarily responsible for review of some aspect of the questionnaire.)
4940     */
4941    public List<ContactDetail> getReviewer() { 
4942      return new ArrayList<>();
4943    }
4944    /**
4945     * @return Returns a reference to <code>this</code> for easy method chaining
4946     */
4947    public Questionnaire setReviewer(List<ContactDetail> theReviewer) { 
4948      throw new Error("The resource type \"Questionnaire\" does not implement the property \"reviewer\"");
4949    }
4950    public boolean hasReviewer() { 
4951      return false;
4952    }
4953
4954    public ContactDetail addReviewer() { //3
4955      throw new Error("The resource type \"Questionnaire\" does not implement the property \"reviewer\"");
4956    }
4957    public Questionnaire addReviewer(ContactDetail t) { //3
4958      throw new Error("The resource type \"Questionnaire\" does not implement the property \"reviewer\"");
4959    }
4960    /**
4961     * @return The first repetition of repeating field {@link #reviewer}, creating it if it does not already exist {2}
4962     */
4963    public ContactDetail getReviewerFirstRep() { 
4964      throw new Error("The resource type \"Questionnaire\" does not implement the property \"reviewer\"");
4965    }
4966    /**
4967     * not supported on this implementation
4968     */
4969    @Override
4970    public int getEndorserMax() { 
4971      return 0;
4972    }
4973    /**
4974     * @return {@link #endorser} (An individual or organization responsible for officially endorsing the questionnaire for use in some setting.)
4975     */
4976    public List<ContactDetail> getEndorser() { 
4977      return new ArrayList<>();
4978    }
4979    /**
4980     * @return Returns a reference to <code>this</code> for easy method chaining
4981     */
4982    public Questionnaire setEndorser(List<ContactDetail> theEndorser) { 
4983      throw new Error("The resource type \"Questionnaire\" does not implement the property \"endorser\"");
4984    }
4985    public boolean hasEndorser() { 
4986      return false;
4987    }
4988
4989    public ContactDetail addEndorser() { //3
4990      throw new Error("The resource type \"Questionnaire\" does not implement the property \"endorser\"");
4991    }
4992    public Questionnaire addEndorser(ContactDetail t) { //3
4993      throw new Error("The resource type \"Questionnaire\" does not implement the property \"endorser\"");
4994    }
4995    /**
4996     * @return The first repetition of repeating field {@link #endorser}, creating it if it does not already exist {2}
4997     */
4998    public ContactDetail getEndorserFirstRep() { 
4999      throw new Error("The resource type \"Questionnaire\" does not implement the property \"endorser\"");
5000    }
5001    /**
5002     * not supported on this implementation
5003     */
5004    @Override
5005    public int getRelatedArtifactMax() { 
5006      return 0;
5007    }
5008    /**
5009     * @return {@link #relatedArtifact} (Related artifacts such as additional documentation, justification, dependencies, bibliographic references, and predecessor and successor artifacts.)
5010     */
5011    public List<RelatedArtifact> getRelatedArtifact() { 
5012      return new ArrayList<>();
5013    }
5014    /**
5015     * @return Returns a reference to <code>this</code> for easy method chaining
5016     */
5017    public Questionnaire setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
5018      throw new Error("The resource type \"Questionnaire\" does not implement the property \"relatedArtifact\"");
5019    }
5020    public boolean hasRelatedArtifact() { 
5021      return false;
5022    }
5023
5024    public RelatedArtifact addRelatedArtifact() { //3
5025      throw new Error("The resource type \"Questionnaire\" does not implement the property \"relatedArtifact\"");
5026    }
5027    public Questionnaire addRelatedArtifact(RelatedArtifact t) { //3
5028      throw new Error("The resource type \"Questionnaire\" does not implement the property \"relatedArtifact\"");
5029    }
5030    /**
5031     * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist {2}
5032     */
5033    public RelatedArtifact getRelatedArtifactFirstRep() { 
5034      throw new Error("The resource type \"Questionnaire\" does not implement the property \"relatedArtifact\"");
5035    }
5036      protected void listChildren(List<Property> children) {
5037        super.listChildren(children);
5038        children.add(new Property("url", "uri", "An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url));
5039        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
5040        children.add(new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.", 0, 1, version));
5041        children.add(new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
5042        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title));
5043        children.add(new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom));
5044        children.add(new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status));
5045        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
5046        children.add(new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType));
5047        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire 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 questionnaire changes.", 0, 1, date));
5048        children.add(new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher));
5049        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
5050        children.add(new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description));
5051        children.add(new Property("useContext", "UsageContext", "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 questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
5052        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
5053        children.add(new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose));
5054        children.add(new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright));
5055        children.add(new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
5056        children.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate));
5057        children.add(new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod));
5058        children.add(new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code));
5059        children.add(new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item));
5060      }
5061
5062      @Override
5063      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5064        switch (_hash) {
5065        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this questionnaire 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 an authoritative instance of this questionnaire is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the questionnaire is stored on different servers.", 0, 1, url);
5066        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
5067        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire 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.", 0, 1, version);
5068        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
5069        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the questionnaire.", 0, 1, title);
5070        case 1077922663: /*derivedFrom*/  return new Property("derivedFrom", "canonical(Questionnaire)", "The URL of a Questionnaire that this Questionnaire is based on.", 0, java.lang.Integer.MAX_VALUE, derivedFrom);
5071        case -892481550: /*status*/  return new Property("status", "code", "The status of this questionnaire. Enables tracking the life-cycle of the content.", 0, 1, status);
5072        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
5073        case -603200890: /*subjectType*/  return new Property("subjectType", "code", "The types of subjects that can be the subject of responses created for the questionnaire.", 0, java.lang.Integer.MAX_VALUE, subjectType);
5074        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the questionnaire 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 questionnaire changes.", 0, 1, date);
5075        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual that published the questionnaire.", 0, 1, publisher);
5076        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
5077        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the questionnaire from a consumer's perspective.", 0, 1, description);
5078        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "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 questionnaire instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
5079        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the questionnaire is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
5080        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this questionnaire is needed and why it has been designed as it has.", 0, 1, purpose);
5081        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.", 0, 1, copyright);
5082        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
5083        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate);
5084        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the questionnaire content was or is planned to be in active use.", 0, 1, effectivePeriod);
5085        case 3059181: /*code*/  return new Property("code", "Coding", "An identifier for this question or group of questions in a particular terminology such as LOINC.", 0, java.lang.Integer.MAX_VALUE, code);
5086        case 3242771: /*item*/  return new Property("item", "", "A particular question, question grouping or display text that is part of the questionnaire.", 0, java.lang.Integer.MAX_VALUE, item);
5087        default: return super.getNamedProperty(_hash, _name, _checkValid);
5088        }
5089
5090      }
5091
5092      @Override
5093      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5094        switch (hash) {
5095        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
5096        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
5097        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
5098        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
5099        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
5100        case 1077922663: /*derivedFrom*/ return this.derivedFrom == null ? new Base[0] : this.derivedFrom.toArray(new Base[this.derivedFrom.size()]); // CanonicalType
5101        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
5102        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
5103        case -603200890: /*subjectType*/ return this.subjectType == null ? new Base[0] : this.subjectType.toArray(new Base[this.subjectType.size()]); // CodeType
5104        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
5105        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
5106        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
5107        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
5108        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
5109        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
5110        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
5111        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
5112        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
5113        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
5114        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
5115        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
5116        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // QuestionnaireItemComponent
5117        default: return super.getProperty(hash, name, checkValid);
5118        }
5119
5120      }
5121
5122      @Override
5123      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5124        switch (hash) {
5125        case 116079: // url
5126          this.url = TypeConvertor.castToUri(value); // UriType
5127          return value;
5128        case -1618432855: // identifier
5129          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
5130          return value;
5131        case 351608024: // version
5132          this.version = TypeConvertor.castToString(value); // StringType
5133          return value;
5134        case 3373707: // name
5135          this.name = TypeConvertor.castToString(value); // StringType
5136          return value;
5137        case 110371416: // title
5138          this.title = TypeConvertor.castToString(value); // StringType
5139          return value;
5140        case 1077922663: // derivedFrom
5141          this.getDerivedFrom().add(TypeConvertor.castToCanonical(value)); // CanonicalType
5142          return value;
5143        case -892481550: // status
5144          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
5145          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5146          return value;
5147        case -404562712: // experimental
5148          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
5149          return value;
5150        case -603200890: // subjectType
5151          this.getSubjectType().add(TypeConvertor.castToCode(value)); // CodeType
5152          return value;
5153        case 3076014: // date
5154          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
5155          return value;
5156        case 1447404028: // publisher
5157          this.publisher = TypeConvertor.castToString(value); // StringType
5158          return value;
5159        case 951526432: // contact
5160          this.getContact().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
5161          return value;
5162        case -1724546052: // description
5163          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5164          return value;
5165        case -669707736: // useContext
5166          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5167          return value;
5168        case -507075711: // jurisdiction
5169          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5170          return value;
5171        case -220463842: // purpose
5172          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
5173          return value;
5174        case 1522889671: // copyright
5175          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
5176          return value;
5177        case 223539345: // approvalDate
5178          this.approvalDate = TypeConvertor.castToDate(value); // DateType
5179          return value;
5180        case -1687512484: // lastReviewDate
5181          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
5182          return value;
5183        case -403934648: // effectivePeriod
5184          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5185          return value;
5186        case 3059181: // code
5187          this.getCode().add(TypeConvertor.castToCoding(value)); // Coding
5188          return value;
5189        case 3242771: // item
5190          this.getItem().add((QuestionnaireItemComponent) value); // QuestionnaireItemComponent
5191          return value;
5192        default: return super.setProperty(hash, name, value);
5193        }
5194
5195      }
5196
5197      @Override
5198      public Base setProperty(String name, Base value) throws FHIRException {
5199        if (name.equals("url")) {
5200          this.url = TypeConvertor.castToUri(value); // UriType
5201        } else if (name.equals("identifier")) {
5202          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
5203        } else if (name.equals("version")) {
5204          this.version = TypeConvertor.castToString(value); // StringType
5205        } else if (name.equals("name")) {
5206          this.name = TypeConvertor.castToString(value); // StringType
5207        } else if (name.equals("title")) {
5208          this.title = TypeConvertor.castToString(value); // StringType
5209        } else if (name.equals("derivedFrom")) {
5210          this.getDerivedFrom().add(TypeConvertor.castToCanonical(value));
5211        } else if (name.equals("status")) {
5212          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
5213          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
5214        } else if (name.equals("experimental")) {
5215          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
5216        } else if (name.equals("subjectType")) {
5217          this.getSubjectType().add(TypeConvertor.castToCode(value));
5218        } else if (name.equals("date")) {
5219          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
5220        } else if (name.equals("publisher")) {
5221          this.publisher = TypeConvertor.castToString(value); // StringType
5222        } else if (name.equals("contact")) {
5223          this.getContact().add(TypeConvertor.castToContactDetail(value));
5224        } else if (name.equals("description")) {
5225          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5226        } else if (name.equals("useContext")) {
5227          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
5228        } else if (name.equals("jurisdiction")) {
5229          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value));
5230        } else if (name.equals("purpose")) {
5231          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
5232        } else if (name.equals("copyright")) {
5233          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
5234        } else if (name.equals("approvalDate")) {
5235          this.approvalDate = TypeConvertor.castToDate(value); // DateType
5236        } else if (name.equals("lastReviewDate")) {
5237          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
5238        } else if (name.equals("effectivePeriod")) {
5239          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5240        } else if (name.equals("code")) {
5241          this.getCode().add(TypeConvertor.castToCoding(value));
5242        } else if (name.equals("item")) {
5243          this.getItem().add((QuestionnaireItemComponent) value);
5244        } else
5245          return super.setProperty(name, value);
5246        return value;
5247      }
5248
5249      @Override
5250      public Base makeProperty(int hash, String name) throws FHIRException {
5251        switch (hash) {
5252        case 116079:  return getUrlElement();
5253        case -1618432855:  return addIdentifier(); 
5254        case 351608024:  return getVersionElement();
5255        case 3373707:  return getNameElement();
5256        case 110371416:  return getTitleElement();
5257        case 1077922663:  return addDerivedFromElement();
5258        case -892481550:  return getStatusElement();
5259        case -404562712:  return getExperimentalElement();
5260        case -603200890:  return addSubjectTypeElement();
5261        case 3076014:  return getDateElement();
5262        case 1447404028:  return getPublisherElement();
5263        case 951526432:  return addContact(); 
5264        case -1724546052:  return getDescriptionElement();
5265        case -669707736:  return addUseContext(); 
5266        case -507075711:  return addJurisdiction(); 
5267        case -220463842:  return getPurposeElement();
5268        case 1522889671:  return getCopyrightElement();
5269        case 223539345:  return getApprovalDateElement();
5270        case -1687512484:  return getLastReviewDateElement();
5271        case -403934648:  return getEffectivePeriod();
5272        case 3059181:  return addCode(); 
5273        case 3242771:  return addItem(); 
5274        default: return super.makeProperty(hash, name);
5275        }
5276
5277      }
5278
5279      @Override
5280      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5281        switch (hash) {
5282        case 116079: /*url*/ return new String[] {"uri"};
5283        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5284        case 351608024: /*version*/ return new String[] {"string"};
5285        case 3373707: /*name*/ return new String[] {"string"};
5286        case 110371416: /*title*/ return new String[] {"string"};
5287        case 1077922663: /*derivedFrom*/ return new String[] {"canonical"};
5288        case -892481550: /*status*/ return new String[] {"code"};
5289        case -404562712: /*experimental*/ return new String[] {"boolean"};
5290        case -603200890: /*subjectType*/ return new String[] {"code"};
5291        case 3076014: /*date*/ return new String[] {"dateTime"};
5292        case 1447404028: /*publisher*/ return new String[] {"string"};
5293        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
5294        case -1724546052: /*description*/ return new String[] {"markdown"};
5295        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
5296        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
5297        case -220463842: /*purpose*/ return new String[] {"markdown"};
5298        case 1522889671: /*copyright*/ return new String[] {"markdown"};
5299        case 223539345: /*approvalDate*/ return new String[] {"date"};
5300        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
5301        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
5302        case 3059181: /*code*/ return new String[] {"Coding"};
5303        case 3242771: /*item*/ return new String[] {};
5304        default: return super.getTypesForProperty(hash, name);
5305        }
5306
5307      }
5308
5309      @Override
5310      public Base addChild(String name) throws FHIRException {
5311        if (name.equals("url")) {
5312          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.url");
5313        }
5314        else if (name.equals("identifier")) {
5315          return addIdentifier();
5316        }
5317        else if (name.equals("version")) {
5318          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.version");
5319        }
5320        else if (name.equals("name")) {
5321          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.name");
5322        }
5323        else if (name.equals("title")) {
5324          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.title");
5325        }
5326        else if (name.equals("derivedFrom")) {
5327          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.derivedFrom");
5328        }
5329        else if (name.equals("status")) {
5330          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.status");
5331        }
5332        else if (name.equals("experimental")) {
5333          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.experimental");
5334        }
5335        else if (name.equals("subjectType")) {
5336          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.subjectType");
5337        }
5338        else if (name.equals("date")) {
5339          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.date");
5340        }
5341        else if (name.equals("publisher")) {
5342          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.publisher");
5343        }
5344        else if (name.equals("contact")) {
5345          return addContact();
5346        }
5347        else if (name.equals("description")) {
5348          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.description");
5349        }
5350        else if (name.equals("useContext")) {
5351          return addUseContext();
5352        }
5353        else if (name.equals("jurisdiction")) {
5354          return addJurisdiction();
5355        }
5356        else if (name.equals("purpose")) {
5357          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.purpose");
5358        }
5359        else if (name.equals("copyright")) {
5360          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.copyright");
5361        }
5362        else if (name.equals("approvalDate")) {
5363          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.approvalDate");
5364        }
5365        else if (name.equals("lastReviewDate")) {
5366          throw new FHIRException("Cannot call addChild on a primitive type Questionnaire.lastReviewDate");
5367        }
5368        else if (name.equals("effectivePeriod")) {
5369          this.effectivePeriod = new Period();
5370          return this.effectivePeriod;
5371        }
5372        else if (name.equals("code")) {
5373          return addCode();
5374        }
5375        else if (name.equals("item")) {
5376          return addItem();
5377        }
5378        else
5379          return super.addChild(name);
5380      }
5381
5382  public String fhirType() {
5383    return "Questionnaire";
5384
5385  }
5386
5387      public Questionnaire copy() {
5388        Questionnaire dst = new Questionnaire();
5389        copyValues(dst);
5390        return dst;
5391      }
5392
5393      public void copyValues(Questionnaire dst) {
5394        super.copyValues(dst);
5395        dst.url = url == null ? null : url.copy();
5396        if (identifier != null) {
5397          dst.identifier = new ArrayList<Identifier>();
5398          for (Identifier i : identifier)
5399            dst.identifier.add(i.copy());
5400        };
5401        dst.version = version == null ? null : version.copy();
5402        dst.name = name == null ? null : name.copy();
5403        dst.title = title == null ? null : title.copy();
5404        if (derivedFrom != null) {
5405          dst.derivedFrom = new ArrayList<CanonicalType>();
5406          for (CanonicalType i : derivedFrom)
5407            dst.derivedFrom.add(i.copy());
5408        };
5409        dst.status = status == null ? null : status.copy();
5410        dst.experimental = experimental == null ? null : experimental.copy();
5411        if (subjectType != null) {
5412          dst.subjectType = new ArrayList<CodeType>();
5413          for (CodeType i : subjectType)
5414            dst.subjectType.add(i.copy());
5415        };
5416        dst.date = date == null ? null : date.copy();
5417        dst.publisher = publisher == null ? null : publisher.copy();
5418        if (contact != null) {
5419          dst.contact = new ArrayList<ContactDetail>();
5420          for (ContactDetail i : contact)
5421            dst.contact.add(i.copy());
5422        };
5423        dst.description = description == null ? null : description.copy();
5424        if (useContext != null) {
5425          dst.useContext = new ArrayList<UsageContext>();
5426          for (UsageContext i : useContext)
5427            dst.useContext.add(i.copy());
5428        };
5429        if (jurisdiction != null) {
5430          dst.jurisdiction = new ArrayList<CodeableConcept>();
5431          for (CodeableConcept i : jurisdiction)
5432            dst.jurisdiction.add(i.copy());
5433        };
5434        dst.purpose = purpose == null ? null : purpose.copy();
5435        dst.copyright = copyright == null ? null : copyright.copy();
5436        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
5437        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
5438        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
5439        if (code != null) {
5440          dst.code = new ArrayList<Coding>();
5441          for (Coding i : code)
5442            dst.code.add(i.copy());
5443        };
5444        if (item != null) {
5445          dst.item = new ArrayList<QuestionnaireItemComponent>();
5446          for (QuestionnaireItemComponent i : item)
5447            dst.item.add(i.copy());
5448        };
5449      }
5450
5451      protected Questionnaire typedCopy() {
5452        return copy();
5453      }
5454
5455      @Override
5456      public boolean equalsDeep(Base other_) {
5457        if (!super.equalsDeep(other_))
5458          return false;
5459        if (!(other_ instanceof Questionnaire))
5460          return false;
5461        Questionnaire o = (Questionnaire) other_;
5462        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
5463           && compareDeep(name, o.name, true) && compareDeep(title, o.title, true) && compareDeep(derivedFrom, o.derivedFrom, true)
5464           && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true) && compareDeep(subjectType, o.subjectType, true)
5465           && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true)
5466           && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
5467           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
5468           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
5469           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(code, o.code, true) && compareDeep(item, o.item, true)
5470          ;
5471      }
5472
5473      @Override
5474      public boolean equalsShallow(Base other_) {
5475        if (!super.equalsShallow(other_))
5476          return false;
5477        if (!(other_ instanceof Questionnaire))
5478          return false;
5479        Questionnaire o = (Questionnaire) other_;
5480        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
5481           && compareValues(title, o.title, true) && compareValues(derivedFrom, o.derivedFrom, true) && compareValues(status, o.status, true)
5482           && compareValues(experimental, o.experimental, true) && compareValues(subjectType, o.subjectType, true)
5483           && compareValues(date, o.date, true) && compareValues(publisher, o.publisher, true) && compareValues(description, o.description, true)
5484           && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true) && compareValues(approvalDate, o.approvalDate, true)
5485           && compareValues(lastReviewDate, o.lastReviewDate, true);
5486      }
5487
5488      public boolean isEmpty() {
5489        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, identifier, version
5490          , name, title, derivedFrom, status, experimental, subjectType, date, publisher
5491          , contact, description, useContext, jurisdiction, purpose, copyright, approvalDate
5492          , lastReviewDate, effectivePeriod, code, item);
5493      }
5494
5495  @Override
5496  public ResourceType getResourceType() {
5497    return ResourceType.Questionnaire;
5498   }
5499
5500 /**
5501   * Search parameter: <b>combo-code</b>
5502   * <p>
5503   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
5504   * Type: <b>token</b><br>
5505   * Path: <b>Questionnaire.code | Questionnaire.item.code</b><br>
5506   * </p>
5507   */
5508  @SearchParamDefinition(name="combo-code", path="Questionnaire.code | Questionnaire.item.code", description="A code that corresponds to one of its items in the questionnaire", type="token" )
5509  public static final String SP_COMBO_CODE = "combo-code";
5510 /**
5511   * <b>Fluent Client</b> search parameter constant for <b>combo-code</b>
5512   * <p>
5513   * Description: <b>A code that corresponds to one of its items in the questionnaire</b><br>
5514   * Type: <b>token</b><br>
5515   * Path: <b>Questionnaire.code | Questionnaire.item.code</b><br>
5516   * </p>
5517   */
5518  public static final ca.uhn.fhir.rest.gclient.TokenClientParam COMBO_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_COMBO_CODE);
5519
5520 /**
5521   * Search parameter: <b>context-quantity</b>
5522   * <p>
5523   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5524   * Type: <b>quantity</b><br>
5525   * Path: <b>(Questionnaire.useContext.value as Quantity) | (Questionnaire.useContext.value as Range)</b><br>
5526   * </p>
5527   */
5528  @SearchParamDefinition(name="context-quantity", path="(Questionnaire.useContext.value as Quantity) | (Questionnaire.useContext.value as Range)", description="A quantity- or range-valued use context assigned to the questionnaire", type="quantity" )
5529  public static final String SP_CONTEXT_QUANTITY = "context-quantity";
5530 /**
5531   * <b>Fluent Client</b> search parameter constant for <b>context-quantity</b>
5532   * <p>
5533   * Description: <b>A quantity- or range-valued use context assigned to the questionnaire</b><br>
5534   * Type: <b>quantity</b><br>
5535   * Path: <b>(Questionnaire.useContext.value as Quantity) | (Questionnaire.useContext.value as Range)</b><br>
5536   * </p>
5537   */
5538  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam CONTEXT_QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_CONTEXT_QUANTITY);
5539
5540 /**
5541   * Search parameter: <b>context-type-quantity</b>
5542   * <p>
5543   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5544   * Type: <b>composite</b><br>
5545   * Path: <b>Questionnaire.useContext</b><br>
5546   * </p>
5547   */
5548  @SearchParamDefinition(name="context-type-quantity", path="Questionnaire.useContext", description="A use context type and quantity- or range-based value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context-quantity"} )
5549  public static final String SP_CONTEXT_TYPE_QUANTITY = "context-type-quantity";
5550 /**
5551   * <b>Fluent Client</b> search parameter constant for <b>context-type-quantity</b>
5552   * <p>
5553   * Description: <b>A use context type and quantity- or range-based value assigned to the questionnaire</b><br>
5554   * Type: <b>composite</b><br>
5555   * Path: <b>Questionnaire.useContext</b><br>
5556   * </p>
5557   */
5558  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>(SP_CONTEXT_TYPE_QUANTITY);
5559
5560 /**
5561   * Search parameter: <b>context-type-value</b>
5562   * <p>
5563   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
5564   * Type: <b>composite</b><br>
5565   * Path: <b>Questionnaire.useContext</b><br>
5566   * </p>
5567   */
5568  @SearchParamDefinition(name="context-type-value", path="Questionnaire.useContext", description="A use context type and value assigned to the questionnaire", type="composite", compositeOf={"context-type", "context"} )
5569  public static final String SP_CONTEXT_TYPE_VALUE = "context-type-value";
5570 /**
5571   * <b>Fluent Client</b> search parameter constant for <b>context-type-value</b>
5572   * <p>
5573   * Description: <b>A use context type and value assigned to the questionnaire</b><br>
5574   * Type: <b>composite</b><br>
5575   * Path: <b>Questionnaire.useContext</b><br>
5576   * </p>
5577   */
5578  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>(SP_CONTEXT_TYPE_VALUE);
5579
5580 /**
5581   * Search parameter: <b>context-type</b>
5582   * <p>
5583   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5584   * Type: <b>token</b><br>
5585   * Path: <b>Questionnaire.useContext.code</b><br>
5586   * </p>
5587   */
5588  @SearchParamDefinition(name="context-type", path="Questionnaire.useContext.code", description="A type of use context assigned to the questionnaire", type="token" )
5589  public static final String SP_CONTEXT_TYPE = "context-type";
5590 /**
5591   * <b>Fluent Client</b> search parameter constant for <b>context-type</b>
5592   * <p>
5593   * Description: <b>A type of use context assigned to the questionnaire</b><br>
5594   * Type: <b>token</b><br>
5595   * Path: <b>Questionnaire.useContext.code</b><br>
5596   * </p>
5597   */
5598  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT_TYPE);
5599
5600 /**
5601   * Search parameter: <b>context</b>
5602   * <p>
5603   * Description: <b>A use context assigned to the questionnaire</b><br>
5604   * Type: <b>token</b><br>
5605   * Path: <b>(Questionnaire.useContext.value as CodeableConcept)</b><br>
5606   * </p>
5607   */
5608  @SearchParamDefinition(name="context", path="(Questionnaire.useContext.value as CodeableConcept)", description="A use context assigned to the questionnaire", type="token" )
5609  public static final String SP_CONTEXT = "context";
5610 /**
5611   * <b>Fluent Client</b> search parameter constant for <b>context</b>
5612   * <p>
5613   * Description: <b>A use context assigned to the questionnaire</b><br>
5614   * Type: <b>token</b><br>
5615   * Path: <b>(Questionnaire.useContext.value as CodeableConcept)</b><br>
5616   * </p>
5617   */
5618  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTEXT);
5619
5620 /**
5621   * Search parameter: <b>date</b>
5622   * <p>
5623   * Description: <b>The questionnaire publication date</b><br>
5624   * Type: <b>date</b><br>
5625   * Path: <b>Questionnaire.date</b><br>
5626   * </p>
5627   */
5628  @SearchParamDefinition(name="date", path="Questionnaire.date", description="The questionnaire publication date", type="date" )
5629  public static final String SP_DATE = "date";
5630 /**
5631   * <b>Fluent Client</b> search parameter constant for <b>date</b>
5632   * <p>
5633   * Description: <b>The questionnaire publication date</b><br>
5634   * Type: <b>date</b><br>
5635   * Path: <b>Questionnaire.date</b><br>
5636   * </p>
5637   */
5638  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
5639
5640 /**
5641   * Search parameter: <b>definition</b>
5642   * <p>
5643   * Description: <b>ElementDefinition - details for the item</b><br>
5644   * Type: <b>uri</b><br>
5645   * Path: <b>Questionnaire.item.definition</b><br>
5646   * </p>
5647   */
5648  @SearchParamDefinition(name="definition", path="Questionnaire.item.definition", description="ElementDefinition - details for the item", type="uri" )
5649  public static final String SP_DEFINITION = "definition";
5650 /**
5651   * <b>Fluent Client</b> search parameter constant for <b>definition</b>
5652   * <p>
5653   * Description: <b>ElementDefinition - details for the item</b><br>
5654   * Type: <b>uri</b><br>
5655   * Path: <b>Questionnaire.item.definition</b><br>
5656   * </p>
5657   */
5658  public static final ca.uhn.fhir.rest.gclient.UriClientParam DEFINITION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_DEFINITION);
5659
5660 /**
5661   * Search parameter: <b>description</b>
5662   * <p>
5663   * Description: <b>The description of the questionnaire</b><br>
5664   * Type: <b>string</b><br>
5665   * Path: <b>Questionnaire.description</b><br>
5666   * </p>
5667   */
5668  @SearchParamDefinition(name="description", path="Questionnaire.description", description="The description of the questionnaire", type="string" )
5669  public static final String SP_DESCRIPTION = "description";
5670 /**
5671   * <b>Fluent Client</b> search parameter constant for <b>description</b>
5672   * <p>
5673   * Description: <b>The description of the questionnaire</b><br>
5674   * Type: <b>string</b><br>
5675   * Path: <b>Questionnaire.description</b><br>
5676   * </p>
5677   */
5678  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
5679
5680 /**
5681   * Search parameter: <b>effective</b>
5682   * <p>
5683   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5684   * Type: <b>date</b><br>
5685   * Path: <b>Questionnaire.effectivePeriod</b><br>
5686   * </p>
5687   */
5688  @SearchParamDefinition(name="effective", path="Questionnaire.effectivePeriod", description="The time during which the questionnaire is intended to be in use", type="date" )
5689  public static final String SP_EFFECTIVE = "effective";
5690 /**
5691   * <b>Fluent Client</b> search parameter constant for <b>effective</b>
5692   * <p>
5693   * Description: <b>The time during which the questionnaire is intended to be in use</b><br>
5694   * Type: <b>date</b><br>
5695   * Path: <b>Questionnaire.effectivePeriod</b><br>
5696   * </p>
5697   */
5698  public static final ca.uhn.fhir.rest.gclient.DateClientParam EFFECTIVE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EFFECTIVE);
5699
5700 /**
5701   * Search parameter: <b>identifier</b>
5702   * <p>
5703   * Description: <b>External identifier for the questionnaire</b><br>
5704   * Type: <b>token</b><br>
5705   * Path: <b>Questionnaire.identifier</b><br>
5706   * </p>
5707   */
5708  @SearchParamDefinition(name="identifier", path="Questionnaire.identifier", description="External identifier for the questionnaire", type="token" )
5709  public static final String SP_IDENTIFIER = "identifier";
5710 /**
5711   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5712   * <p>
5713   * Description: <b>External identifier for the questionnaire</b><br>
5714   * Type: <b>token</b><br>
5715   * Path: <b>Questionnaire.identifier</b><br>
5716   * </p>
5717   */
5718  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5719
5720 /**
5721   * Search parameter: <b>item-code</b>
5722   * <p>
5723   * Description: <b>A code that corresponds to one of the items in the questionnaire</b><br>
5724   * Type: <b>token</b><br>
5725   * Path: <b>Questionnaire.item.code</b><br>
5726   * </p>
5727   */
5728  @SearchParamDefinition(name="item-code", path="Questionnaire.item.code", description="A code that corresponds to one of the items in the questionnaire", type="token" )
5729  public static final String SP_ITEM_CODE = "item-code";
5730 /**
5731   * <b>Fluent Client</b> search parameter constant for <b>item-code</b>
5732   * <p>
5733   * Description: <b>A code that corresponds to one of the items in the questionnaire</b><br>
5734   * Type: <b>token</b><br>
5735   * Path: <b>Questionnaire.item.code</b><br>
5736   * </p>
5737   */
5738  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ITEM_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ITEM_CODE);
5739
5740 /**
5741   * Search parameter: <b>jurisdiction</b>
5742   * <p>
5743   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
5744   * Type: <b>token</b><br>
5745   * Path: <b>Questionnaire.jurisdiction</b><br>
5746   * </p>
5747   */
5748  @SearchParamDefinition(name="jurisdiction", path="Questionnaire.jurisdiction", description="Intended jurisdiction for the questionnaire", type="token" )
5749  public static final String SP_JURISDICTION = "jurisdiction";
5750 /**
5751   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
5752   * <p>
5753   * Description: <b>Intended jurisdiction for the questionnaire</b><br>
5754   * Type: <b>token</b><br>
5755   * Path: <b>Questionnaire.jurisdiction</b><br>
5756   * </p>
5757   */
5758  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
5759
5760 /**
5761   * Search parameter: <b>name</b>
5762   * <p>
5763   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5764   * Type: <b>string</b><br>
5765   * Path: <b>Questionnaire.name</b><br>
5766   * </p>
5767   */
5768  @SearchParamDefinition(name="name", path="Questionnaire.name", description="Computationally friendly name of the questionnaire", type="string" )
5769  public static final String SP_NAME = "name";
5770 /**
5771   * <b>Fluent Client</b> search parameter constant for <b>name</b>
5772   * <p>
5773   * Description: <b>Computationally friendly name of the questionnaire</b><br>
5774   * Type: <b>string</b><br>
5775   * Path: <b>Questionnaire.name</b><br>
5776   * </p>
5777   */
5778  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
5779
5780 /**
5781   * Search parameter: <b>publisher</b>
5782   * <p>
5783   * Description: <b>Name of the publisher of the questionnaire</b><br>
5784   * Type: <b>string</b><br>
5785   * Path: <b>Questionnaire.publisher</b><br>
5786   * </p>
5787   */
5788  @SearchParamDefinition(name="publisher", path="Questionnaire.publisher", description="Name of the publisher of the questionnaire", type="string" )
5789  public static final String SP_PUBLISHER = "publisher";
5790 /**
5791   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
5792   * <p>
5793   * Description: <b>Name of the publisher of the questionnaire</b><br>
5794   * Type: <b>string</b><br>
5795   * Path: <b>Questionnaire.publisher</b><br>
5796   * </p>
5797   */
5798  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
5799
5800 /**
5801   * Search parameter: <b>questionnaire-code</b>
5802   * <p>
5803   * Description: <b>A code that matches one of the Questionnaire.code codings</b><br>
5804   * Type: <b>token</b><br>
5805   * Path: <b>Questionnaire.code</b><br>
5806   * </p>
5807   */
5808  @SearchParamDefinition(name="questionnaire-code", path="Questionnaire.code", description="A code that matches one of the Questionnaire.code codings", type="token" )
5809  public static final String SP_QUESTIONNAIRE_CODE = "questionnaire-code";
5810 /**
5811   * <b>Fluent Client</b> search parameter constant for <b>questionnaire-code</b>
5812   * <p>
5813   * Description: <b>A code that matches one of the Questionnaire.code codings</b><br>
5814   * Type: <b>token</b><br>
5815   * Path: <b>Questionnaire.code</b><br>
5816   * </p>
5817   */
5818  public static final ca.uhn.fhir.rest.gclient.TokenClientParam QUESTIONNAIRE_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_QUESTIONNAIRE_CODE);
5819
5820 /**
5821   * Search parameter: <b>status</b>
5822   * <p>
5823   * Description: <b>The current status of the questionnaire</b><br>
5824   * Type: <b>token</b><br>
5825   * Path: <b>Questionnaire.status</b><br>
5826   * </p>
5827   */
5828  @SearchParamDefinition(name="status", path="Questionnaire.status", description="The current status of the questionnaire", type="token" )
5829  public static final String SP_STATUS = "status";
5830 /**
5831   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5832   * <p>
5833   * Description: <b>The current status of the questionnaire</b><br>
5834   * Type: <b>token</b><br>
5835   * Path: <b>Questionnaire.status</b><br>
5836   * </p>
5837   */
5838  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5839
5840 /**
5841   * Search parameter: <b>subject-type</b>
5842   * <p>
5843   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5844   * Type: <b>token</b><br>
5845   * Path: <b>Questionnaire.subjectType</b><br>
5846   * </p>
5847   */
5848  @SearchParamDefinition(name="subject-type", path="Questionnaire.subjectType", description="Resource that can be subject of QuestionnaireResponse", type="token" )
5849  public static final String SP_SUBJECT_TYPE = "subject-type";
5850 /**
5851   * <b>Fluent Client</b> search parameter constant for <b>subject-type</b>
5852   * <p>
5853   * Description: <b>Resource that can be subject of QuestionnaireResponse</b><br>
5854   * Type: <b>token</b><br>
5855   * Path: <b>Questionnaire.subjectType</b><br>
5856   * </p>
5857   */
5858  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUBJECT_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUBJECT_TYPE);
5859
5860 /**
5861   * Search parameter: <b>title</b>
5862   * <p>
5863   * Description: <b>The human-friendly name of the questionnaire</b><br>
5864   * Type: <b>string</b><br>
5865   * Path: <b>Questionnaire.title</b><br>
5866   * </p>
5867   */
5868  @SearchParamDefinition(name="title", path="Questionnaire.title", description="The human-friendly name of the questionnaire", type="string" )
5869  public static final String SP_TITLE = "title";
5870 /**
5871   * <b>Fluent Client</b> search parameter constant for <b>title</b>
5872   * <p>
5873   * Description: <b>The human-friendly name of the questionnaire</b><br>
5874   * Type: <b>string</b><br>
5875   * Path: <b>Questionnaire.title</b><br>
5876   * </p>
5877   */
5878  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
5879
5880 /**
5881   * Search parameter: <b>url</b>
5882   * <p>
5883   * Description: <b>The uri that identifies the questionnaire</b><br>
5884   * Type: <b>uri</b><br>
5885   * Path: <b>Questionnaire.url</b><br>
5886   * </p>
5887   */
5888  @SearchParamDefinition(name="url", path="Questionnaire.url", description="The uri that identifies the questionnaire", type="uri" )
5889  public static final String SP_URL = "url";
5890 /**
5891   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5892   * <p>
5893   * Description: <b>The uri that identifies the questionnaire</b><br>
5894   * Type: <b>uri</b><br>
5895   * Path: <b>Questionnaire.url</b><br>
5896   * </p>
5897   */
5898  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5899
5900 /**
5901   * Search parameter: <b>version</b>
5902   * <p>
5903   * Description: <b>The business version of the questionnaire</b><br>
5904   * Type: <b>token</b><br>
5905   * Path: <b>Questionnaire.version</b><br>
5906   * </p>
5907   */
5908  @SearchParamDefinition(name="version", path="Questionnaire.version", description="The business version of the questionnaire", type="token" )
5909  public static final String SP_VERSION = "version";
5910 /**
5911   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5912   * <p>
5913   * Description: <b>The business version of the questionnaire</b><br>
5914   * Type: <b>token</b><br>
5915   * Path: <b>Questionnaire.version</b><br>
5916   * </p>
5917   */
5918  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
5919
5920// Manual code (from Configuration.txt):
5921public QuestionnaireItemComponent getQuestion(String linkId) {
5922    if (linkId == null)
5923      return null;
5924    for (QuestionnaireItemComponent i : getItem()) {
5925      if (i.getLinkId().equals(linkId))
5926        return i;
5927      QuestionnaireItemComponent t = i.getQuestion(linkId);
5928      if (t != null)
5929        return t;
5930    }
5931    return null;
5932  }
5933
5934  public QuestionnaireItemComponent getCommonGroup(QuestionnaireItemComponent q1, QuestionnaireItemComponent q2) {
5935    for (QuestionnaireItemComponent i : getItem()) {
5936      QuestionnaireItemComponent t = i.getCommonGroup(q1, q2);
5937      if (t != null)
5938        return t;
5939    }
5940    return null;
5941  }
5942// end addition
5943
5944}
5945