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