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