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