001package org.hl7.fhir.dstu3.formats;
002
003import java.io.IOException;
004
005/*-
006 * #%L
007 * org.hl7.fhir.dstu3
008 * %%
009 * Copyright (C) 2014 - 2019 Health Level 7
010 * %%
011 * Licensed under the Apache License, Version 2.0 (the "License");
012 * you may not use this file except in compliance with the License.
013 * You may obtain a copy of the License at
014 * 
015 *      http://www.apache.org/licenses/LICENSE-2.0
016 * 
017 * Unless required by applicable law or agreed to in writing, software
018 * distributed under the License is distributed on an "AS IS" BASIS,
019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 * See the License for the specific language governing permissions and
021 * limitations under the License.
022 * #L%
023 */
024
025/*
026  Copyright (c) 2011+, HL7, Inc.
027  All rights reserved.
028  
029  Redistribution and use in source and binary forms, with or without modification, 
030  are permitted provided that the following conditions are met:
031  
032   * Redistributions of source code must retain the above copyright notice, this 
033     list of conditions and the following disclaimer.
034   * Redistributions in binary form must reproduce the above copyright notice, 
035     this list of conditions and the following disclaimer in the documentation 
036     and/or other materials provided with the distribution.
037   * Neither the name of HL7 nor the names of its contributors may be used to 
038     endorse or promote products derived from this software without specific 
039     prior written permission.
040  
041  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
042  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
043  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
044  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
045  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
046  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
047  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
048  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
049  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
050  POSSIBILITY OF SUCH DAMAGE.
051  
052*/
053
054// Generated on Mon, Apr 17, 2017 08:38+1000 for FHIR v3.0.x
055import org.hl7.fhir.dstu3.model.*;
056import org.hl7.fhir.exceptions.FHIRFormatError;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.utilities.xhtml.XhtmlNode;
059
060import com.google.gson.JsonArray;
061import com.google.gson.JsonObject;
062
063public class JsonParser extends JsonParserBase {
064
065  public JsonParser() {
066    super();
067  }
068
069  public JsonParser(boolean allowUnknownContent) {
070    super();
071    setAllowUnknownContent(allowUnknownContent);
072  }
073
074
075  protected void parseElementProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
076    super.parseElementProperties(json, element);
077    if (json.has("extension")) {
078      JsonArray array = json.getAsJsonArray("extension");
079      for (int i = 0; i < array.size(); i++) {
080        element.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
081      }
082    };
083  }
084
085  protected void parseBackboneProperties(JsonObject json, BackboneElement element) throws IOException, FHIRFormatError {
086    parseElementProperties(json, element);
087    if (json.has("modifierExtension")) {
088      JsonArray array = json.getAsJsonArray("modifierExtension");
089      for (int i = 0; i < array.size(); i++) {
090        element.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
091      }
092    }
093  }
094
095  protected void parseTypeProperties(JsonObject json, Element element) throws IOException, FHIRFormatError {
096    parseElementProperties(json, element);
097  }
098
099  @SuppressWarnings("unchecked")
100  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(String s, E item, EnumFactory e) throws IOException, FHIRFormatError {
101    Enumeration<E> res = new Enumeration<E>(e);
102    if (s != null)
103      res.setValue((E) e.fromCode(s));
104    return res;
105  }
106
107  protected DateType parseDate(String v) throws IOException, FHIRFormatError {
108    DateType res = new DateType(v);
109    return res;
110  }
111
112  protected DateTimeType parseDateTime(String v) throws IOException, FHIRFormatError {
113    DateTimeType res = new DateTimeType(v);
114    return res;
115  }
116
117  protected CodeType parseCode(String v) throws IOException, FHIRFormatError {
118    CodeType res = new CodeType(v);
119    return res;
120  }
121
122  protected StringType parseString(String v) throws IOException, FHIRFormatError {
123    StringType res = new StringType(v);
124    return res;
125  }
126
127  protected IntegerType parseInteger(java.lang.Long v) throws IOException, FHIRFormatError {
128    IntegerType res = new IntegerType(v);
129    return res;
130  }
131
132  protected OidType parseOid(String v) throws IOException, FHIRFormatError {
133    OidType res = new OidType(v);
134    return res;
135  }
136
137  protected UriType parseUri(String v) throws IOException, FHIRFormatError {
138    UriType res = new UriType(v);
139    return res;
140  }
141
142  protected UuidType parseUuid(String v) throws IOException, FHIRFormatError {
143    UuidType res = new UuidType(v);
144    return res;
145  }
146
147  protected InstantType parseInstant(String v) throws IOException, FHIRFormatError {
148    InstantType res = new InstantType(v);
149    return res;
150  }
151
152  protected BooleanType parseBoolean(java.lang.Boolean v) throws IOException, FHIRFormatError {
153    BooleanType res = new BooleanType(v);
154    return res;
155  }
156
157  protected Base64BinaryType parseBase64Binary(String v) throws IOException, FHIRFormatError {
158    Base64BinaryType res = new Base64BinaryType(v);
159    return res;
160  }
161
162  protected UnsignedIntType parseUnsignedInt(String v) throws IOException, FHIRFormatError {
163    UnsignedIntType res = new UnsignedIntType(v);
164    return res;
165  }
166
167  protected MarkdownType parseMarkdown(String v) throws IOException, FHIRFormatError {
168    MarkdownType res = new MarkdownType(v);
169    return res;
170  }
171
172  protected TimeType parseTime(String v) throws IOException, FHIRFormatError {
173    TimeType res = new TimeType(v);
174    return res;
175  }
176
177  protected IdType parseId(String v) throws IOException, FHIRFormatError {
178    IdType res = new IdType(v);
179    return res;
180  }
181
182  protected PositiveIntType parsePositiveInt(String v) throws IOException, FHIRFormatError {
183    PositiveIntType res = new PositiveIntType(v);
184    return res;
185  }
186
187  protected DecimalType parseDecimal(java.math.BigDecimal v) throws IOException, FHIRFormatError {
188    DecimalType res = new DecimalType(v);
189    return res;
190  }
191
192  protected Extension parseExtension(JsonObject json) throws IOException, FHIRFormatError {
193    Extension res = new Extension();
194    parseExtensionProperties(json, res);
195    return res;
196  }
197
198  protected void parseExtensionProperties(JsonObject json, Extension res) throws IOException, FHIRFormatError {
199    parseTypeProperties(json, res);
200    if (json.has("url"))
201      res.setUrlElement(parseUri(json.get("url").getAsString()));
202    if (json.has("_url"))
203      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
204    Type value = parseType("value", json);
205    if (value != null)
206      res.setValue(value);
207  }
208
209  protected Narrative parseNarrative(JsonObject json) throws IOException, FHIRFormatError {
210    Narrative res = new Narrative();
211    parseNarrativeProperties(json, res);
212    return res;
213  }
214
215  protected void parseNarrativeProperties(JsonObject json, Narrative res) throws IOException, FHIRFormatError {
216    parseTypeProperties(json, res);
217    if (json.has("status"))
218      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
219    if (json.has("_status"))
220      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
221    if (json.has("div"))
222      res.setDiv(parseXhtml(json.get("div").getAsString()));
223  }
224
225  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
226    Reference res = new Reference();
227    parseReferenceProperties(json, res);
228    return res;
229  }
230
231  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
232    parseTypeProperties(json, res);
233    if (json.has("reference"))
234      res.setReferenceElement(parseString(json.get("reference").getAsString()));
235    if (json.has("_reference"))
236      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
237    if (json.has("identifier"))
238      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
239    if (json.has("display"))
240      res.setDisplayElement(parseString(json.get("display").getAsString()));
241    if (json.has("_display"))
242      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
243  }
244
245  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
246    Quantity res = new Quantity();
247    parseQuantityProperties(json, res);
248    return res;
249  }
250
251  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
252    parseTypeProperties(json, res);
253    if (json.has("value"))
254      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
255    if (json.has("_value"))
256      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
257    if (json.has("comparator"))
258      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
259    if (json.has("_comparator"))
260      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
261    if (json.has("unit"))
262      res.setUnitElement(parseString(json.get("unit").getAsString()));
263    if (json.has("_unit"))
264      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
265    if (json.has("system"))
266      res.setSystemElement(parseUri(json.get("system").getAsString()));
267    if (json.has("_system"))
268      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
269    if (json.has("code"))
270      res.setCodeElement(parseCode(json.get("code").getAsString()));
271    if (json.has("_code"))
272      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
273  }
274
275  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
276    Period res = new Period();
277    parsePeriodProperties(json, res);
278    return res;
279  }
280
281  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
282    parseTypeProperties(json, res);
283    if (json.has("start"))
284      res.setStartElement(parseDateTime(json.get("start").getAsString()));
285    if (json.has("_start"))
286      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
287    if (json.has("end"))
288      res.setEndElement(parseDateTime(json.get("end").getAsString()));
289    if (json.has("_end"))
290      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
291  }
292
293  protected Attachment parseAttachment(JsonObject json) throws IOException, FHIRFormatError {
294    Attachment res = new Attachment();
295    parseAttachmentProperties(json, res);
296    return res;
297  }
298
299  protected void parseAttachmentProperties(JsonObject json, Attachment res) throws IOException, FHIRFormatError {
300    parseTypeProperties(json, res);
301    if (json.has("contentType"))
302      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
303    if (json.has("_contentType"))
304      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
305    if (json.has("language"))
306      res.setLanguageElement(parseCode(json.get("language").getAsString()));
307    if (json.has("_language"))
308      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
309    if (json.has("data"))
310      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
311    if (json.has("_data"))
312      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
313    if (json.has("url"))
314      res.setUrlElement(parseUri(json.get("url").getAsString()));
315    if (json.has("_url"))
316      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
317    if (json.has("size"))
318      res.setSizeElement(parseUnsignedInt(json.get("size").getAsString()));
319    if (json.has("_size"))
320      parseElementProperties(json.getAsJsonObject("_size"), res.getSizeElement());
321    if (json.has("hash"))
322      res.setHashElement(parseBase64Binary(json.get("hash").getAsString()));
323    if (json.has("_hash"))
324      parseElementProperties(json.getAsJsonObject("_hash"), res.getHashElement());
325    if (json.has("title"))
326      res.setTitleElement(parseString(json.get("title").getAsString()));
327    if (json.has("_title"))
328      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
329    if (json.has("creation"))
330      res.setCreationElement(parseDateTime(json.get("creation").getAsString()));
331    if (json.has("_creation"))
332      parseElementProperties(json.getAsJsonObject("_creation"), res.getCreationElement());
333  }
334
335  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
336    Duration res = new Duration();
337    parseDurationProperties(json, res);
338    return res;
339  }
340
341  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
342    parseQuantityProperties(json, res);
343  }
344
345  protected Count parseCount(JsonObject json) throws IOException, FHIRFormatError {
346    Count res = new Count();
347    parseCountProperties(json, res);
348    return res;
349  }
350
351  protected void parseCountProperties(JsonObject json, Count res) throws IOException, FHIRFormatError {
352    parseQuantityProperties(json, res);
353  }
354
355  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
356    Range res = new Range();
357    parseRangeProperties(json, res);
358    return res;
359  }
360
361  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
362    parseTypeProperties(json, res);
363    if (json.has("low"))
364      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
365    if (json.has("high"))
366      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
367  }
368
369  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
370    Annotation res = new Annotation();
371    parseAnnotationProperties(json, res);
372    return res;
373  }
374
375  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
376    parseTypeProperties(json, res);
377    Type author = parseType("author", json);
378    if (author != null)
379      res.setAuthor(author);
380    if (json.has("time"))
381      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
382    if (json.has("_time"))
383      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
384    if (json.has("text"))
385      res.setTextElement(parseString(json.get("text").getAsString()));
386    if (json.has("_text"))
387      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
388  }
389
390  protected Money parseMoney(JsonObject json) throws IOException, FHIRFormatError {
391    Money res = new Money();
392    parseMoneyProperties(json, res);
393    return res;
394  }
395
396  protected void parseMoneyProperties(JsonObject json, Money res) throws IOException, FHIRFormatError {
397    parseQuantityProperties(json, res);
398  }
399
400  protected Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
401    Identifier res = new Identifier();
402    parseIdentifierProperties(json, res);
403    return res;
404  }
405
406  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
407    parseTypeProperties(json, res);
408    if (json.has("use"))
409      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
410    if (json.has("_use"))
411      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
412    if (json.has("type"))
413      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
414    if (json.has("system"))
415      res.setSystemElement(parseUri(json.get("system").getAsString()));
416    if (json.has("_system"))
417      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
418    if (json.has("value"))
419      res.setValueElement(parseString(json.get("value").getAsString()));
420    if (json.has("_value"))
421      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
422    if (json.has("period"))
423      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
424    if (json.has("assigner"))
425      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
426  }
427
428  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
429    Coding res = new Coding();
430    parseCodingProperties(json, res);
431    return res;
432  }
433
434  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
435    parseTypeProperties(json, res);
436    if (json.has("system"))
437      res.setSystemElement(parseUri(json.get("system").getAsString()));
438    if (json.has("_system"))
439      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
440    if (json.has("version"))
441      res.setVersionElement(parseString(json.get("version").getAsString()));
442    if (json.has("_version"))
443      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
444    if (json.has("code"))
445      res.setCodeElement(parseCode(json.get("code").getAsString()));
446    if (json.has("_code"))
447      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
448    if (json.has("display"))
449      res.setDisplayElement(parseString(json.get("display").getAsString()));
450    if (json.has("_display"))
451      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
452    if (json.has("userSelected"))
453      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
454    if (json.has("_userSelected"))
455      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
456  }
457
458  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
459    Signature res = new Signature();
460    parseSignatureProperties(json, res);
461    return res;
462  }
463
464  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
465    parseTypeProperties(json, res);
466    if (json.has("type")) {
467      JsonArray array = json.getAsJsonArray("type");
468      for (int i = 0; i < array.size(); i++) {
469        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
470      }
471    };
472    if (json.has("when"))
473      res.setWhenElement(parseInstant(json.get("when").getAsString()));
474    if (json.has("_when"))
475      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
476    Type who = parseType("who", json);
477    if (who != null)
478      res.setWho(who);
479    Type onBehalfOf = parseType("onBehalfOf", json);
480    if (onBehalfOf != null)
481      res.setOnBehalfOf(onBehalfOf);
482    if (json.has("contentType"))
483      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
484    if (json.has("_contentType"))
485      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
486    if (json.has("blob"))
487      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
488    if (json.has("_blob"))
489      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
490  }
491
492  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
493    SampledData res = new SampledData();
494    parseSampledDataProperties(json, res);
495    return res;
496  }
497
498  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
499    parseTypeProperties(json, res);
500    if (json.has("origin"))
501      res.setOrigin(parseSimpleQuantity(json.getAsJsonObject("origin")));
502    if (json.has("period"))
503      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
504    if (json.has("_period"))
505      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
506    if (json.has("factor"))
507      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
508    if (json.has("_factor"))
509      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
510    if (json.has("lowerLimit"))
511      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
512    if (json.has("_lowerLimit"))
513      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
514    if (json.has("upperLimit"))
515      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
516    if (json.has("_upperLimit"))
517      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
518    if (json.has("dimensions"))
519      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
520    if (json.has("_dimensions"))
521      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
522    if (json.has("data"))
523      res.setDataElement(parseString(json.get("data").getAsString()));
524    if (json.has("_data"))
525      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
526  }
527
528  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
529    Ratio res = new Ratio();
530    parseRatioProperties(json, res);
531    return res;
532  }
533
534  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
535    parseTypeProperties(json, res);
536    if (json.has("numerator"))
537      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
538    if (json.has("denominator"))
539      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
540  }
541
542  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
543    Distance res = new Distance();
544    parseDistanceProperties(json, res);
545    return res;
546  }
547
548  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
549    parseQuantityProperties(json, res);
550  }
551
552  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
553    Age res = new Age();
554    parseAgeProperties(json, res);
555    return res;
556  }
557
558  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
559    parseQuantityProperties(json, res);
560  }
561
562  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
563    CodeableConcept res = new CodeableConcept();
564    parseCodeableConceptProperties(json, res);
565    return res;
566  }
567
568  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
569    parseTypeProperties(json, res);
570    if (json.has("coding")) {
571      JsonArray array = json.getAsJsonArray("coding");
572      for (int i = 0; i < array.size(); i++) {
573        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
574      }
575    };
576    if (json.has("text"))
577      res.setTextElement(parseString(json.get("text").getAsString()));
578    if (json.has("_text"))
579      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
580  }
581
582  protected SimpleQuantity parseSimpleQuantity(JsonObject json) throws IOException, FHIRFormatError {
583    SimpleQuantity res = new SimpleQuantity();
584    parseSimpleQuantityProperties(json, res);
585    return res;
586  }
587
588  protected void parseSimpleQuantityProperties(JsonObject json, SimpleQuantity res) throws IOException, FHIRFormatError {
589    parseTypeProperties(json, res);
590    if (json.has("value"))
591      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
592    if (json.has("_value"))
593      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
594    if (json.has("comparator"))
595      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
596    if (json.has("_comparator"))
597      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
598    if (json.has("unit"))
599      res.setUnitElement(parseString(json.get("unit").getAsString()));
600    if (json.has("_unit"))
601      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
602    if (json.has("system"))
603      res.setSystemElement(parseUri(json.get("system").getAsString()));
604    if (json.has("_system"))
605      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
606    if (json.has("code"))
607      res.setCodeElement(parseCode(json.get("code").getAsString()));
608    if (json.has("_code"))
609      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
610  }
611
612  protected Meta parseMeta(JsonObject json) throws IOException, FHIRFormatError {
613    Meta res = new Meta();
614    parseMetaProperties(json, res);
615    return res;
616  }
617
618  protected void parseMetaProperties(JsonObject json, Meta res) throws IOException, FHIRFormatError {
619    parseElementProperties(json, res);
620    if (json.has("versionId"))
621      res.setVersionIdElement(parseId(json.get("versionId").getAsString()));
622    if (json.has("_versionId"))
623      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
624    if (json.has("lastUpdated"))
625      res.setLastUpdatedElement(parseInstant(json.get("lastUpdated").getAsString()));
626    if (json.has("_lastUpdated"))
627      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
628    if (json.has("profile")) {
629      JsonArray array = json.getAsJsonArray("profile");
630      for (int i = 0; i < array.size(); i++) {
631        res.getProfile().add(parseUri(array.get(i).getAsString()));
632      }
633    };
634    if (json.has("_profile")) {
635      JsonArray array = json.getAsJsonArray("_profile");
636      for (int i = 0; i < array.size(); i++) {
637        if (i == res.getProfile().size())
638          res.getProfile().add(parseUri(null));
639        if (array.get(i) instanceof JsonObject) 
640          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
641      }
642    };
643    if (json.has("security")) {
644      JsonArray array = json.getAsJsonArray("security");
645      for (int i = 0; i < array.size(); i++) {
646        res.getSecurity().add(parseCoding(array.get(i).getAsJsonObject()));
647      }
648    };
649    if (json.has("tag")) {
650      JsonArray array = json.getAsJsonArray("tag");
651      for (int i = 0; i < array.size(); i++) {
652        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
653      }
654    };
655  }
656
657  protected Address parseAddress(JsonObject json) throws IOException, FHIRFormatError {
658    Address res = new Address();
659    parseAddressProperties(json, res);
660    return res;
661  }
662
663  protected void parseAddressProperties(JsonObject json, Address res) throws IOException, FHIRFormatError {
664    parseTypeProperties(json, res);
665    if (json.has("use"))
666      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
667    if (json.has("_use"))
668      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
669    if (json.has("type"))
670      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
671    if (json.has("_type"))
672      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
673    if (json.has("text"))
674      res.setTextElement(parseString(json.get("text").getAsString()));
675    if (json.has("_text"))
676      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
677    if (json.has("line")) {
678      JsonArray array = json.getAsJsonArray("line");
679      for (int i = 0; i < array.size(); i++) {
680        res.getLine().add(parseString(array.get(i).getAsString()));
681      }
682    };
683    if (json.has("_line")) {
684      JsonArray array = json.getAsJsonArray("_line");
685      for (int i = 0; i < array.size(); i++) {
686        if (i == res.getLine().size())
687          res.getLine().add(parseString(null));
688        if (array.get(i) instanceof JsonObject) 
689          parseElementProperties(array.get(i).getAsJsonObject(), res.getLine().get(i));
690      }
691    };
692    if (json.has("city"))
693      res.setCityElement(parseString(json.get("city").getAsString()));
694    if (json.has("_city"))
695      parseElementProperties(json.getAsJsonObject("_city"), res.getCityElement());
696    if (json.has("district"))
697      res.setDistrictElement(parseString(json.get("district").getAsString()));
698    if (json.has("_district"))
699      parseElementProperties(json.getAsJsonObject("_district"), res.getDistrictElement());
700    if (json.has("state"))
701      res.setStateElement(parseString(json.get("state").getAsString()));
702    if (json.has("_state"))
703      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
704    if (json.has("postalCode"))
705      res.setPostalCodeElement(parseString(json.get("postalCode").getAsString()));
706    if (json.has("_postalCode"))
707      parseElementProperties(json.getAsJsonObject("_postalCode"), res.getPostalCodeElement());
708    if (json.has("country"))
709      res.setCountryElement(parseString(json.get("country").getAsString()));
710    if (json.has("_country"))
711      parseElementProperties(json.getAsJsonObject("_country"), res.getCountryElement());
712    if (json.has("period"))
713      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
714  }
715
716  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
717    TriggerDefinition res = new TriggerDefinition();
718    parseTriggerDefinitionProperties(json, res);
719    return res;
720  }
721
722  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
723    parseTypeProperties(json, res);
724    if (json.has("type"))
725      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
726    if (json.has("_type"))
727      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
728    if (json.has("eventName"))
729      res.setEventNameElement(parseString(json.get("eventName").getAsString()));
730    if (json.has("_eventName"))
731      parseElementProperties(json.getAsJsonObject("_eventName"), res.getEventNameElement());
732    Type eventTiming = parseType("eventTiming", json);
733    if (eventTiming != null)
734      res.setEventTiming(eventTiming);
735    if (json.has("eventData"))
736      res.setEventData(parseDataRequirement(json.getAsJsonObject("eventData")));
737  }
738
739  protected Contributor parseContributor(JsonObject json) throws IOException, FHIRFormatError {
740    Contributor res = new Contributor();
741    parseContributorProperties(json, res);
742    return res;
743  }
744
745  protected void parseContributorProperties(JsonObject json, Contributor res) throws IOException, FHIRFormatError {
746    parseTypeProperties(json, res);
747    if (json.has("type"))
748      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
749    if (json.has("_type"))
750      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
751    if (json.has("name"))
752      res.setNameElement(parseString(json.get("name").getAsString()));
753    if (json.has("_name"))
754      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
755    if (json.has("contact")) {
756      JsonArray array = json.getAsJsonArray("contact");
757      for (int i = 0; i < array.size(); i++) {
758        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
759      }
760    };
761  }
762
763  protected DataRequirement parseDataRequirement(JsonObject json) throws IOException, FHIRFormatError {
764    DataRequirement res = new DataRequirement();
765    parseDataRequirementProperties(json, res);
766    return res;
767  }
768
769  protected void parseDataRequirementProperties(JsonObject json, DataRequirement res) throws IOException, FHIRFormatError {
770    parseTypeProperties(json, res);
771    if (json.has("type"))
772      res.setTypeElement(parseCode(json.get("type").getAsString()));
773    if (json.has("_type"))
774      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
775    if (json.has("profile")) {
776      JsonArray array = json.getAsJsonArray("profile");
777      for (int i = 0; i < array.size(); i++) {
778        res.getProfile().add(parseUri(array.get(i).getAsString()));
779      }
780    };
781    if (json.has("_profile")) {
782      JsonArray array = json.getAsJsonArray("_profile");
783      for (int i = 0; i < array.size(); i++) {
784        if (i == res.getProfile().size())
785          res.getProfile().add(parseUri(null));
786        if (array.get(i) instanceof JsonObject) 
787          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
788      }
789    };
790    if (json.has("mustSupport")) {
791      JsonArray array = json.getAsJsonArray("mustSupport");
792      for (int i = 0; i < array.size(); i++) {
793        res.getMustSupport().add(parseString(array.get(i).getAsString()));
794      }
795    };
796    if (json.has("_mustSupport")) {
797      JsonArray array = json.getAsJsonArray("_mustSupport");
798      for (int i = 0; i < array.size(); i++) {
799        if (i == res.getMustSupport().size())
800          res.getMustSupport().add(parseString(null));
801        if (array.get(i) instanceof JsonObject) 
802          parseElementProperties(array.get(i).getAsJsonObject(), res.getMustSupport().get(i));
803      }
804    };
805    if (json.has("codeFilter")) {
806      JsonArray array = json.getAsJsonArray("codeFilter");
807      for (int i = 0; i < array.size(); i++) {
808        res.getCodeFilter().add(parseDataRequirementDataRequirementCodeFilterComponent(array.get(i).getAsJsonObject(), res));
809      }
810    };
811    if (json.has("dateFilter")) {
812      JsonArray array = json.getAsJsonArray("dateFilter");
813      for (int i = 0; i < array.size(); i++) {
814        res.getDateFilter().add(parseDataRequirementDataRequirementDateFilterComponent(array.get(i).getAsJsonObject(), res));
815      }
816    };
817  }
818
819  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementDataRequirementCodeFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
820    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
821    parseDataRequirementDataRequirementCodeFilterComponentProperties(json, owner, res);
822    return res;
823  }
824
825  protected void parseDataRequirementDataRequirementCodeFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementCodeFilterComponent res) throws IOException, FHIRFormatError {
826    parseTypeProperties(json, res);
827    if (json.has("path"))
828      res.setPathElement(parseString(json.get("path").getAsString()));
829    if (json.has("_path"))
830      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
831    Type valueSet = parseType("valueSet", json);
832    if (valueSet != null)
833      res.setValueSet(valueSet);
834    if (json.has("valueCode")) {
835      JsonArray array = json.getAsJsonArray("valueCode");
836      for (int i = 0; i < array.size(); i++) {
837        res.getValueCode().add(parseCode(array.get(i).getAsString()));
838      }
839    };
840    if (json.has("_valueCode")) {
841      JsonArray array = json.getAsJsonArray("_valueCode");
842      for (int i = 0; i < array.size(); i++) {
843        if (i == res.getValueCode().size())
844          res.getValueCode().add(parseCode(null));
845        if (array.get(i) instanceof JsonObject) 
846          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueCode().get(i));
847      }
848    };
849    if (json.has("valueCoding")) {
850      JsonArray array = json.getAsJsonArray("valueCoding");
851      for (int i = 0; i < array.size(); i++) {
852        res.getValueCoding().add(parseCoding(array.get(i).getAsJsonObject()));
853      }
854    };
855    if (json.has("valueCodeableConcept")) {
856      JsonArray array = json.getAsJsonArray("valueCodeableConcept");
857      for (int i = 0; i < array.size(); i++) {
858        res.getValueCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
859      }
860    };
861  }
862
863  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDataRequirementDateFilterComponent(JsonObject json, DataRequirement owner) throws IOException, FHIRFormatError {
864    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
865    parseDataRequirementDataRequirementDateFilterComponentProperties(json, owner, res);
866    return res;
867  }
868
869  protected void parseDataRequirementDataRequirementDateFilterComponentProperties(JsonObject json, DataRequirement owner, DataRequirement.DataRequirementDateFilterComponent res) throws IOException, FHIRFormatError {
870    parseTypeProperties(json, res);
871    if (json.has("path"))
872      res.setPathElement(parseString(json.get("path").getAsString()));
873    if (json.has("_path"))
874      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
875    Type value = parseType("value", json);
876    if (value != null)
877      res.setValue(value);
878  }
879
880  protected Dosage parseDosage(JsonObject json) throws IOException, FHIRFormatError {
881    Dosage res = new Dosage();
882    parseDosageProperties(json, res);
883    return res;
884  }
885
886  protected void parseDosageProperties(JsonObject json, Dosage res) throws IOException, FHIRFormatError {
887    parseTypeProperties(json, res);
888    if (json.has("sequence"))
889      res.setSequenceElement(parseInteger(json.get("sequence").getAsLong()));
890    if (json.has("_sequence"))
891      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
892    if (json.has("text"))
893      res.setTextElement(parseString(json.get("text").getAsString()));
894    if (json.has("_text"))
895      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
896    if (json.has("additionalInstruction")) {
897      JsonArray array = json.getAsJsonArray("additionalInstruction");
898      for (int i = 0; i < array.size(); i++) {
899        res.getAdditionalInstruction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
900      }
901    };
902    if (json.has("patientInstruction"))
903      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
904    if (json.has("_patientInstruction"))
905      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
906    if (json.has("timing"))
907      res.setTiming(parseTiming(json.getAsJsonObject("timing")));
908    Type asNeeded = parseType("asNeeded", json);
909    if (asNeeded != null)
910      res.setAsNeeded(asNeeded);
911    if (json.has("site"))
912      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
913    if (json.has("route"))
914      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
915    if (json.has("method"))
916      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
917    Type dose = parseType("dose", json);
918    if (dose != null)
919      res.setDose(dose);
920    if (json.has("maxDosePerPeriod"))
921      res.setMaxDosePerPeriod(parseRatio(json.getAsJsonObject("maxDosePerPeriod")));
922    if (json.has("maxDosePerAdministration"))
923      res.setMaxDosePerAdministration(parseSimpleQuantity(json.getAsJsonObject("maxDosePerAdministration")));
924    if (json.has("maxDosePerLifetime"))
925      res.setMaxDosePerLifetime(parseSimpleQuantity(json.getAsJsonObject("maxDosePerLifetime")));
926    Type rate = parseType("rate", json);
927    if (rate != null)
928      res.setRate(rate);
929  }
930
931  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
932    RelatedArtifact res = new RelatedArtifact();
933    parseRelatedArtifactProperties(json, res);
934    return res;
935  }
936
937  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
938    parseTypeProperties(json, res);
939    if (json.has("type"))
940      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
941    if (json.has("_type"))
942      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
943    if (json.has("display"))
944      res.setDisplayElement(parseString(json.get("display").getAsString()));
945    if (json.has("_display"))
946      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
947    if (json.has("citation"))
948      res.setCitationElement(parseString(json.get("citation").getAsString()));
949    if (json.has("_citation"))
950      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
951    if (json.has("url"))
952      res.setUrlElement(parseUri(json.get("url").getAsString()));
953    if (json.has("_url"))
954      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
955    if (json.has("document"))
956      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
957    if (json.has("resource"))
958      res.setResource(parseReference(json.getAsJsonObject("resource")));
959  }
960
961  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
962    ContactDetail res = new ContactDetail();
963    parseContactDetailProperties(json, res);
964    return res;
965  }
966
967  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
968    parseTypeProperties(json, res);
969    if (json.has("name"))
970      res.setNameElement(parseString(json.get("name").getAsString()));
971    if (json.has("_name"))
972      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
973    if (json.has("telecom")) {
974      JsonArray array = json.getAsJsonArray("telecom");
975      for (int i = 0; i < array.size(); i++) {
976        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
977      }
978    };
979  }
980
981  protected HumanName parseHumanName(JsonObject json) throws IOException, FHIRFormatError {
982    HumanName res = new HumanName();
983    parseHumanNameProperties(json, res);
984    return res;
985  }
986
987  protected void parseHumanNameProperties(JsonObject json, HumanName res) throws IOException, FHIRFormatError {
988    parseTypeProperties(json, res);
989    if (json.has("use"))
990      res.setUseElement(parseEnumeration(json.get("use").getAsString(), HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
991    if (json.has("_use"))
992      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
993    if (json.has("text"))
994      res.setTextElement(parseString(json.get("text").getAsString()));
995    if (json.has("_text"))
996      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
997    if (json.has("family"))
998      res.setFamilyElement(parseString(json.get("family").getAsString()));
999    if (json.has("_family"))
1000      parseElementProperties(json.getAsJsonObject("_family"), res.getFamilyElement());
1001    if (json.has("given")) {
1002      JsonArray array = json.getAsJsonArray("given");
1003      for (int i = 0; i < array.size(); i++) {
1004        res.getGiven().add(parseString(array.get(i).getAsString()));
1005      }
1006    };
1007    if (json.has("_given")) {
1008      JsonArray array = json.getAsJsonArray("_given");
1009      for (int i = 0; i < array.size(); i++) {
1010        if (i == res.getGiven().size())
1011          res.getGiven().add(parseString(null));
1012        if (array.get(i) instanceof JsonObject) 
1013          parseElementProperties(array.get(i).getAsJsonObject(), res.getGiven().get(i));
1014      }
1015    };
1016    if (json.has("prefix")) {
1017      JsonArray array = json.getAsJsonArray("prefix");
1018      for (int i = 0; i < array.size(); i++) {
1019        res.getPrefix().add(parseString(array.get(i).getAsString()));
1020      }
1021    };
1022    if (json.has("_prefix")) {
1023      JsonArray array = json.getAsJsonArray("_prefix");
1024      for (int i = 0; i < array.size(); i++) {
1025        if (i == res.getPrefix().size())
1026          res.getPrefix().add(parseString(null));
1027        if (array.get(i) instanceof JsonObject) 
1028          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrefix().get(i));
1029      }
1030    };
1031    if (json.has("suffix")) {
1032      JsonArray array = json.getAsJsonArray("suffix");
1033      for (int i = 0; i < array.size(); i++) {
1034        res.getSuffix().add(parseString(array.get(i).getAsString()));
1035      }
1036    };
1037    if (json.has("_suffix")) {
1038      JsonArray array = json.getAsJsonArray("_suffix");
1039      for (int i = 0; i < array.size(); i++) {
1040        if (i == res.getSuffix().size())
1041          res.getSuffix().add(parseString(null));
1042        if (array.get(i) instanceof JsonObject) 
1043          parseElementProperties(array.get(i).getAsJsonObject(), res.getSuffix().get(i));
1044      }
1045    };
1046    if (json.has("period"))
1047      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1048  }
1049
1050  protected ContactPoint parseContactPoint(JsonObject json) throws IOException, FHIRFormatError {
1051    ContactPoint res = new ContactPoint();
1052    parseContactPointProperties(json, res);
1053    return res;
1054  }
1055
1056  protected void parseContactPointProperties(JsonObject json, ContactPoint res) throws IOException, FHIRFormatError {
1057    parseTypeProperties(json, res);
1058    if (json.has("system"))
1059      res.setSystemElement(parseEnumeration(json.get("system").getAsString(), ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
1060    if (json.has("_system"))
1061      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
1062    if (json.has("value"))
1063      res.setValueElement(parseString(json.get("value").getAsString()));
1064    if (json.has("_value"))
1065      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
1066    if (json.has("use"))
1067      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
1068    if (json.has("_use"))
1069      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1070    if (json.has("rank"))
1071      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
1072    if (json.has("_rank"))
1073      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
1074    if (json.has("period"))
1075      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1076  }
1077
1078  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1079    UsageContext res = new UsageContext();
1080    parseUsageContextProperties(json, res);
1081    return res;
1082  }
1083
1084  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1085    parseTypeProperties(json, res);
1086    if (json.has("code"))
1087      res.setCode(parseCoding(json.getAsJsonObject("code")));
1088    Type value = parseType("value", json);
1089    if (value != null)
1090      res.setValue(value);
1091  }
1092
1093  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1094    Timing res = new Timing();
1095    parseTimingProperties(json, res);
1096    return res;
1097  }
1098
1099  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1100    parseTypeProperties(json, res);
1101    if (json.has("event")) {
1102      JsonArray array = json.getAsJsonArray("event");
1103      for (int i = 0; i < array.size(); i++) {
1104        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1105      }
1106    };
1107    if (json.has("_event")) {
1108      JsonArray array = json.getAsJsonArray("_event");
1109      for (int i = 0; i < array.size(); i++) {
1110        if (i == res.getEvent().size())
1111          res.getEvent().add(parseDateTime(null));
1112        if (array.get(i) instanceof JsonObject) 
1113          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1114      }
1115    };
1116    if (json.has("repeat"))
1117      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1118    if (json.has("code"))
1119      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1120  }
1121
1122  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1123    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1124    parseTimingTimingRepeatComponentProperties(json, owner, res);
1125    return res;
1126  }
1127
1128  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1129    parseTypeProperties(json, res);
1130    Type bounds = parseType("bounds", json);
1131    if (bounds != null)
1132      res.setBounds(bounds);
1133    if (json.has("count"))
1134      res.setCountElement(parseInteger(json.get("count").getAsLong()));
1135    if (json.has("_count"))
1136      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1137    if (json.has("countMax"))
1138      res.setCountMaxElement(parseInteger(json.get("countMax").getAsLong()));
1139    if (json.has("_countMax"))
1140      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1141    if (json.has("duration"))
1142      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1143    if (json.has("_duration"))
1144      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1145    if (json.has("durationMax"))
1146      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1147    if (json.has("_durationMax"))
1148      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1149    if (json.has("durationUnit"))
1150      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1151    if (json.has("_durationUnit"))
1152      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1153    if (json.has("frequency"))
1154      res.setFrequencyElement(parseInteger(json.get("frequency").getAsLong()));
1155    if (json.has("_frequency"))
1156      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1157    if (json.has("frequencyMax"))
1158      res.setFrequencyMaxElement(parseInteger(json.get("frequencyMax").getAsLong()));
1159    if (json.has("_frequencyMax"))
1160      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1161    if (json.has("period"))
1162      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1163    if (json.has("_period"))
1164      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1165    if (json.has("periodMax"))
1166      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1167    if (json.has("_periodMax"))
1168      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1169    if (json.has("periodUnit"))
1170      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1171    if (json.has("_periodUnit"))
1172      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1173    if (json.has("dayOfWeek")) {
1174      JsonArray array = json.getAsJsonArray("dayOfWeek");
1175      for (int i = 0; i < array.size(); i++) {
1176        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1177      }
1178    };
1179    if (json.has("_dayOfWeek")) {
1180      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1181      for (int i = 0; i < array.size(); i++) {
1182        if (i == res.getDayOfWeek().size())
1183          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1184        if (array.get(i) instanceof JsonObject) 
1185          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1186      }
1187    };
1188    if (json.has("timeOfDay")) {
1189      JsonArray array = json.getAsJsonArray("timeOfDay");
1190      for (int i = 0; i < array.size(); i++) {
1191        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1192      }
1193    };
1194    if (json.has("_timeOfDay")) {
1195      JsonArray array = json.getAsJsonArray("_timeOfDay");
1196      for (int i = 0; i < array.size(); i++) {
1197        if (i == res.getTimeOfDay().size())
1198          res.getTimeOfDay().add(parseTime(null));
1199        if (array.get(i) instanceof JsonObject) 
1200          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1201      }
1202    };
1203    if (json.has("when")) {
1204      JsonArray array = json.getAsJsonArray("when");
1205      for (int i = 0; i < array.size(); i++) {
1206        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1207      }
1208    };
1209    if (json.has("_when")) {
1210      JsonArray array = json.getAsJsonArray("_when");
1211      for (int i = 0; i < array.size(); i++) {
1212        if (i == res.getWhen().size())
1213          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1214        if (array.get(i) instanceof JsonObject) 
1215          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1216      }
1217    };
1218    if (json.has("offset"))
1219      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1220    if (json.has("_offset"))
1221      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1222  }
1223
1224  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1225    ElementDefinition res = new ElementDefinition();
1226    parseElementDefinitionProperties(json, res);
1227    return res;
1228  }
1229
1230  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1231    parseTypeProperties(json, res);
1232    if (json.has("path"))
1233      res.setPathElement(parseString(json.get("path").getAsString()));
1234    if (json.has("_path"))
1235      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1236    if (json.has("representation")) {
1237      JsonArray array = json.getAsJsonArray("representation");
1238      for (int i = 0; i < array.size(); i++) {
1239        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1240      }
1241    };
1242    if (json.has("_representation")) {
1243      JsonArray array = json.getAsJsonArray("_representation");
1244      for (int i = 0; i < array.size(); i++) {
1245        if (i == res.getRepresentation().size())
1246          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1247        if (array.get(i) instanceof JsonObject) 
1248          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1249      }
1250    };
1251    if (json.has("sliceName"))
1252      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1253    if (json.has("_sliceName"))
1254      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1255    if (json.has("label"))
1256      res.setLabelElement(parseString(json.get("label").getAsString()));
1257    if (json.has("_label"))
1258      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1259    if (json.has("code")) {
1260      JsonArray array = json.getAsJsonArray("code");
1261      for (int i = 0; i < array.size(); i++) {
1262        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1263      }
1264    };
1265    if (json.has("slicing"))
1266      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1267    if (json.has("short"))
1268      res.setShortElement(parseString(json.get("short").getAsString()));
1269    if (json.has("_short"))
1270      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1271    if (json.has("definition"))
1272      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1273    if (json.has("_definition"))
1274      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1275    if (json.has("comment"))
1276      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1277    if (json.has("_comment"))
1278      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1279    if (json.has("requirements"))
1280      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1281    if (json.has("_requirements"))
1282      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1283    if (json.has("alias")) {
1284      JsonArray array = json.getAsJsonArray("alias");
1285      for (int i = 0; i < array.size(); i++) {
1286        res.getAlias().add(parseString(array.get(i).getAsString()));
1287      }
1288    };
1289    if (json.has("_alias")) {
1290      JsonArray array = json.getAsJsonArray("_alias");
1291      for (int i = 0; i < array.size(); i++) {
1292        if (i == res.getAlias().size())
1293          res.getAlias().add(parseString(null));
1294        if (array.get(i) instanceof JsonObject) 
1295          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1296      }
1297    };
1298    if (json.has("min"))
1299      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1300    if (json.has("_min"))
1301      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1302    if (json.has("max"))
1303      res.setMaxElement(parseString(json.get("max").getAsString()));
1304    if (json.has("_max"))
1305      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1306    if (json.has("base"))
1307      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1308    if (json.has("contentReference"))
1309      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1310    if (json.has("_contentReference"))
1311      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1312    if (json.has("type")) {
1313      JsonArray array = json.getAsJsonArray("type");
1314      for (int i = 0; i < array.size(); i++) {
1315        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1316      }
1317    };
1318    Type defaultValue = parseType("defaultValue", json);
1319    if (defaultValue != null)
1320      res.setDefaultValue(defaultValue);
1321    if (json.has("meaningWhenMissing"))
1322      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1323    if (json.has("_meaningWhenMissing"))
1324      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1325    if (json.has("orderMeaning"))
1326      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1327    if (json.has("_orderMeaning"))
1328      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1329    Type fixed = parseType("fixed", json);
1330    if (fixed != null)
1331      res.setFixed(fixed);
1332    Type pattern = parseType("pattern", json);
1333    if (pattern != null)
1334      res.setPattern(pattern);
1335    if (json.has("example")) {
1336      JsonArray array = json.getAsJsonArray("example");
1337      for (int i = 0; i < array.size(); i++) {
1338        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1339      }
1340    };
1341    Type minValue = parseType("minValue", json);
1342    if (minValue != null)
1343      res.setMinValue(minValue);
1344    Type maxValue = parseType("maxValue", json);
1345    if (maxValue != null)
1346      res.setMaxValue(maxValue);
1347    if (json.has("maxLength"))
1348      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1349    if (json.has("_maxLength"))
1350      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1351    if (json.has("condition")) {
1352      JsonArray array = json.getAsJsonArray("condition");
1353      for (int i = 0; i < array.size(); i++) {
1354        res.getCondition().add(parseId(array.get(i).getAsString()));
1355      }
1356    };
1357    if (json.has("_condition")) {
1358      JsonArray array = json.getAsJsonArray("_condition");
1359      for (int i = 0; i < array.size(); i++) {
1360        if (i == res.getCondition().size())
1361          res.getCondition().add(parseId(null));
1362        if (array.get(i) instanceof JsonObject) 
1363          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1364      }
1365    };
1366    if (json.has("constraint")) {
1367      JsonArray array = json.getAsJsonArray("constraint");
1368      for (int i = 0; i < array.size(); i++) {
1369        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1370      }
1371    };
1372    if (json.has("mustSupport"))
1373      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1374    if (json.has("_mustSupport"))
1375      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1376    if (json.has("isModifier"))
1377      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1378    if (json.has("_isModifier"))
1379      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1380    if (json.has("isSummary"))
1381      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1382    if (json.has("_isSummary"))
1383      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1384    if (json.has("binding"))
1385      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1386    if (json.has("mapping")) {
1387      JsonArray array = json.getAsJsonArray("mapping");
1388      for (int i = 0; i < array.size(); i++) {
1389        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1390      }
1391    };
1392  }
1393
1394  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1395    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1396    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1397    return res;
1398  }
1399
1400  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1401    parseTypeProperties(json, res);
1402    if (json.has("discriminator")) {
1403      JsonArray array = json.getAsJsonArray("discriminator");
1404      for (int i = 0; i < array.size(); i++) {
1405        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1406      }
1407    };
1408    if (json.has("description"))
1409      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1410    if (json.has("_description"))
1411      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1412    if (json.has("ordered"))
1413      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1414    if (json.has("_ordered"))
1415      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1416    if (json.has("rules"))
1417      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1418    if (json.has("_rules"))
1419      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1420  }
1421
1422  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1423    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1424    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1425    return res;
1426  }
1427
1428  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1429    parseTypeProperties(json, res);
1430    if (json.has("type"))
1431      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1432    if (json.has("_type"))
1433      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1434    if (json.has("path"))
1435      res.setPathElement(parseString(json.get("path").getAsString()));
1436    if (json.has("_path"))
1437      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1438  }
1439
1440  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1441    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1442    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1443    return res;
1444  }
1445
1446  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1447    parseTypeProperties(json, res);
1448    if (json.has("path"))
1449      res.setPathElement(parseString(json.get("path").getAsString()));
1450    if (json.has("_path"))
1451      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1452    if (json.has("min"))
1453      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1454    if (json.has("_min"))
1455      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1456    if (json.has("max"))
1457      res.setMaxElement(parseString(json.get("max").getAsString()));
1458    if (json.has("_max"))
1459      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1460  }
1461
1462  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1463    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1464    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1465    return res;
1466  }
1467
1468  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1469    parseTypeProperties(json, res);
1470    if (json.has("code"))
1471      res.setCodeElement(parseUri(json.get("code").getAsString()));
1472    if (json.has("_code"))
1473      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1474    if (json.has("profile"))
1475      res.setProfileElement(parseUri(json.get("profile").getAsString()));
1476    if (json.has("_profile"))
1477      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1478    if (json.has("targetProfile"))
1479      res.setTargetProfileElement(parseUri(json.get("targetProfile").getAsString()));
1480    if (json.has("_targetProfile"))
1481      parseElementProperties(json.getAsJsonObject("_targetProfile"), res.getTargetProfileElement());
1482    if (json.has("aggregation")) {
1483      JsonArray array = json.getAsJsonArray("aggregation");
1484      for (int i = 0; i < array.size(); i++) {
1485        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1486      }
1487    };
1488    if (json.has("_aggregation")) {
1489      JsonArray array = json.getAsJsonArray("_aggregation");
1490      for (int i = 0; i < array.size(); i++) {
1491        if (i == res.getAggregation().size())
1492          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1493        if (array.get(i) instanceof JsonObject) 
1494          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1495      }
1496    };
1497    if (json.has("versioning"))
1498      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1499    if (json.has("_versioning"))
1500      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1501  }
1502
1503  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1504    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1505    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1506    return res;
1507  }
1508
1509  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1510    parseTypeProperties(json, res);
1511    if (json.has("label"))
1512      res.setLabelElement(parseString(json.get("label").getAsString()));
1513    if (json.has("_label"))
1514      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1515    Type value = parseType("value", json);
1516    if (value != null)
1517      res.setValue(value);
1518  }
1519
1520  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1521    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1522    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1523    return res;
1524  }
1525
1526  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1527    parseTypeProperties(json, res);
1528    if (json.has("key"))
1529      res.setKeyElement(parseId(json.get("key").getAsString()));
1530    if (json.has("_key"))
1531      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1532    if (json.has("requirements"))
1533      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1534    if (json.has("_requirements"))
1535      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1536    if (json.has("severity"))
1537      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1538    if (json.has("_severity"))
1539      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1540    if (json.has("human"))
1541      res.setHumanElement(parseString(json.get("human").getAsString()));
1542    if (json.has("_human"))
1543      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1544    if (json.has("expression"))
1545      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1546    if (json.has("_expression"))
1547      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1548    if (json.has("xpath"))
1549      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1550    if (json.has("_xpath"))
1551      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1552    if (json.has("source"))
1553      res.setSourceElement(parseUri(json.get("source").getAsString()));
1554    if (json.has("_source"))
1555      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1556  }
1557
1558  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1559    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1560    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1561    return res;
1562  }
1563
1564  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1565    parseTypeProperties(json, res);
1566    if (json.has("strength"))
1567      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1568    if (json.has("_strength"))
1569      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1570    if (json.has("description"))
1571      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1572    if (json.has("_description"))
1573      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1574    Type valueSet = parseType("valueSet", json);
1575    if (valueSet != null)
1576      res.setValueSet(valueSet);
1577  }
1578
1579  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1580    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1581    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1582    return res;
1583  }
1584
1585  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1586    parseTypeProperties(json, res);
1587    if (json.has("identity"))
1588      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1589    if (json.has("_identity"))
1590      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1591    if (json.has("language"))
1592      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1593    if (json.has("_language"))
1594      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1595    if (json.has("map"))
1596      res.setMapElement(parseString(json.get("map").getAsString()));
1597    if (json.has("_map"))
1598      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1599    if (json.has("comment"))
1600      res.setCommentElement(parseString(json.get("comment").getAsString()));
1601    if (json.has("_comment"))
1602      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1603  }
1604
1605  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1606    ParameterDefinition res = new ParameterDefinition();
1607    parseParameterDefinitionProperties(json, res);
1608    return res;
1609  }
1610
1611  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1612    parseTypeProperties(json, res);
1613    if (json.has("name"))
1614      res.setNameElement(parseCode(json.get("name").getAsString()));
1615    if (json.has("_name"))
1616      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1617    if (json.has("use"))
1618      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1619    if (json.has("_use"))
1620      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1621    if (json.has("min"))
1622      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1623    if (json.has("_min"))
1624      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1625    if (json.has("max"))
1626      res.setMaxElement(parseString(json.get("max").getAsString()));
1627    if (json.has("_max"))
1628      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1629    if (json.has("documentation"))
1630      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1631    if (json.has("_documentation"))
1632      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1633    if (json.has("type"))
1634      res.setTypeElement(parseCode(json.get("type").getAsString()));
1635    if (json.has("_type"))
1636      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1637    if (json.has("profile"))
1638      res.setProfile(parseReference(json.getAsJsonObject("profile")));
1639  }
1640
1641  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1642    parseResourceProperties(json, res);
1643    if (json.has("text"))
1644      res.setText(parseNarrative(json.getAsJsonObject("text")));
1645    if (json.has("contained")) {
1646      JsonArray array = json.getAsJsonArray("contained");
1647      for (int i = 0; i < array.size(); i++) {
1648        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1649      }
1650    };
1651    if (json.has("extension")) {
1652      JsonArray array = json.getAsJsonArray("extension");
1653      for (int i = 0; i < array.size(); i++) {
1654        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1655      }
1656    };
1657    if (json.has("modifierExtension")) {
1658      JsonArray array = json.getAsJsonArray("modifierExtension");
1659      for (int i = 0; i < array.size(); i++) {
1660        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1661      }
1662    };
1663  }
1664
1665  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1666    Parameters res = new Parameters();
1667    parseParametersProperties(json, res);
1668    return res;
1669  }
1670
1671  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1672    parseResourceProperties(json, res);
1673    if (json.has("parameter")) {
1674      JsonArray array = json.getAsJsonArray("parameter");
1675      for (int i = 0; i < array.size(); i++) {
1676        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1677      }
1678    };
1679  }
1680
1681  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1682    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1683    parseParametersParametersParameterComponentProperties(json, owner, res);
1684    return res;
1685  }
1686
1687  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1688    parseBackboneProperties(json, res);
1689    if (json.has("name"))
1690      res.setNameElement(parseString(json.get("name").getAsString()));
1691    if (json.has("_name"))
1692      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1693    Type value = parseType("value", json);
1694    if (value != null)
1695      res.setValue(value);
1696    if (json.has("resource"))
1697      res.setResource(parseResource(json.getAsJsonObject("resource")));
1698    if (json.has("part")) {
1699      JsonArray array = json.getAsJsonArray("part");
1700      for (int i = 0; i < array.size(); i++) {
1701        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1702      }
1703    };
1704  }
1705
1706  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1707    if (json.has("id"))
1708      res.setIdElement(parseId(json.get("id").getAsString()));
1709    if (json.has("_id"))
1710      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1711    if (json.has("meta"))
1712      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1713    if (json.has("implicitRules"))
1714      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1715    if (json.has("_implicitRules"))
1716      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1717    if (json.has("language"))
1718      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1719    if (json.has("_language"))
1720      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1721  }
1722
1723  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
1724    Account res = new Account();
1725    parseAccountProperties(json, res);
1726    return res;
1727  }
1728
1729  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
1730    parseDomainResourceProperties(json, res);
1731    if (json.has("identifier")) {
1732      JsonArray array = json.getAsJsonArray("identifier");
1733      for (int i = 0; i < array.size(); i++) {
1734        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1735      }
1736    };
1737    if (json.has("status"))
1738      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
1739    if (json.has("_status"))
1740      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1741    if (json.has("type"))
1742      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1743    if (json.has("name"))
1744      res.setNameElement(parseString(json.get("name").getAsString()));
1745    if (json.has("_name"))
1746      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1747    if (json.has("subject"))
1748      res.setSubject(parseReference(json.getAsJsonObject("subject")));
1749    if (json.has("period"))
1750      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1751    if (json.has("active"))
1752      res.setActive(parsePeriod(json.getAsJsonObject("active")));
1753    if (json.has("balance"))
1754      res.setBalance(parseMoney(json.getAsJsonObject("balance")));
1755    if (json.has("coverage")) {
1756      JsonArray array = json.getAsJsonArray("coverage");
1757      for (int i = 0; i < array.size(); i++) {
1758        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
1759      }
1760    };
1761    if (json.has("owner"))
1762      res.setOwner(parseReference(json.getAsJsonObject("owner")));
1763    if (json.has("description"))
1764      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1765    if (json.has("_description"))
1766      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1767    if (json.has("guarantor")) {
1768      JsonArray array = json.getAsJsonArray("guarantor");
1769      for (int i = 0; i < array.size(); i++) {
1770        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
1771      }
1772    };
1773  }
1774
1775  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1776    Account.CoverageComponent res = new Account.CoverageComponent();
1777    parseAccountCoverageComponentProperties(json, owner, res);
1778    return res;
1779  }
1780
1781  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
1782    parseBackboneProperties(json, res);
1783    if (json.has("coverage"))
1784      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
1785    if (json.has("priority"))
1786      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
1787    if (json.has("_priority"))
1788      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
1789  }
1790
1791  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
1792    Account.GuarantorComponent res = new Account.GuarantorComponent();
1793    parseAccountGuarantorComponentProperties(json, owner, res);
1794    return res;
1795  }
1796
1797  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
1798    parseBackboneProperties(json, res);
1799    if (json.has("party"))
1800      res.setParty(parseReference(json.getAsJsonObject("party")));
1801    if (json.has("onHold"))
1802      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
1803    if (json.has("_onHold"))
1804      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
1805    if (json.has("period"))
1806      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
1807  }
1808
1809  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
1810    ActivityDefinition res = new ActivityDefinition();
1811    parseActivityDefinitionProperties(json, res);
1812    return res;
1813  }
1814
1815  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
1816    parseDomainResourceProperties(json, res);
1817    if (json.has("url"))
1818      res.setUrlElement(parseUri(json.get("url").getAsString()));
1819    if (json.has("_url"))
1820      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1821    if (json.has("identifier")) {
1822      JsonArray array = json.getAsJsonArray("identifier");
1823      for (int i = 0; i < array.size(); i++) {
1824        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
1825      }
1826    };
1827    if (json.has("version"))
1828      res.setVersionElement(parseString(json.get("version").getAsString()));
1829    if (json.has("_version"))
1830      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
1831    if (json.has("name"))
1832      res.setNameElement(parseString(json.get("name").getAsString()));
1833    if (json.has("_name"))
1834      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1835    if (json.has("title"))
1836      res.setTitleElement(parseString(json.get("title").getAsString()));
1837    if (json.has("_title"))
1838      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
1839    if (json.has("status"))
1840      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
1841    if (json.has("_status"))
1842      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
1843    if (json.has("experimental"))
1844      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
1845    if (json.has("_experimental"))
1846      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
1847    if (json.has("date"))
1848      res.setDateElement(parseDateTime(json.get("date").getAsString()));
1849    if (json.has("_date"))
1850      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
1851    if (json.has("publisher"))
1852      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
1853    if (json.has("_publisher"))
1854      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
1855    if (json.has("description"))
1856      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
1857    if (json.has("_description"))
1858      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1859    if (json.has("purpose"))
1860      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
1861    if (json.has("_purpose"))
1862      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
1863    if (json.has("usage"))
1864      res.setUsageElement(parseString(json.get("usage").getAsString()));
1865    if (json.has("_usage"))
1866      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
1867    if (json.has("approvalDate"))
1868      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
1869    if (json.has("_approvalDate"))
1870      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
1871    if (json.has("lastReviewDate"))
1872      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
1873    if (json.has("_lastReviewDate"))
1874      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
1875    if (json.has("effectivePeriod"))
1876      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
1877    if (json.has("useContext")) {
1878      JsonArray array = json.getAsJsonArray("useContext");
1879      for (int i = 0; i < array.size(); i++) {
1880        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
1881      }
1882    };
1883    if (json.has("jurisdiction")) {
1884      JsonArray array = json.getAsJsonArray("jurisdiction");
1885      for (int i = 0; i < array.size(); i++) {
1886        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1887      }
1888    };
1889    if (json.has("topic")) {
1890      JsonArray array = json.getAsJsonArray("topic");
1891      for (int i = 0; i < array.size(); i++) {
1892        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1893      }
1894    };
1895    if (json.has("contributor")) {
1896      JsonArray array = json.getAsJsonArray("contributor");
1897      for (int i = 0; i < array.size(); i++) {
1898        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
1899      }
1900    };
1901    if (json.has("contact")) {
1902      JsonArray array = json.getAsJsonArray("contact");
1903      for (int i = 0; i < array.size(); i++) {
1904        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
1905      }
1906    };
1907    if (json.has("copyright"))
1908      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
1909    if (json.has("_copyright"))
1910      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
1911    if (json.has("relatedArtifact")) {
1912      JsonArray array = json.getAsJsonArray("relatedArtifact");
1913      for (int i = 0; i < array.size(); i++) {
1914        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
1915      }
1916    };
1917    if (json.has("library")) {
1918      JsonArray array = json.getAsJsonArray("library");
1919      for (int i = 0; i < array.size(); i++) {
1920        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
1921      }
1922    };
1923    if (json.has("kind"))
1924      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
1925    if (json.has("_kind"))
1926      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
1927    if (json.has("code"))
1928      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1929    Type timing = parseType("timing", json);
1930    if (timing != null)
1931      res.setTiming(timing);
1932    if (json.has("location"))
1933      res.setLocation(parseReference(json.getAsJsonObject("location")));
1934    if (json.has("participant")) {
1935      JsonArray array = json.getAsJsonArray("participant");
1936      for (int i = 0; i < array.size(); i++) {
1937        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
1938      }
1939    };
1940    Type product = parseType("product", json);
1941    if (product != null)
1942      res.setProduct(product);
1943    if (json.has("quantity"))
1944      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
1945    if (json.has("dosage")) {
1946      JsonArray array = json.getAsJsonArray("dosage");
1947      for (int i = 0; i < array.size(); i++) {
1948        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
1949      }
1950    };
1951    if (json.has("bodySite")) {
1952      JsonArray array = json.getAsJsonArray("bodySite");
1953      for (int i = 0; i < array.size(); i++) {
1954        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1955      }
1956    };
1957    if (json.has("transform"))
1958      res.setTransform(parseReference(json.getAsJsonObject("transform")));
1959    if (json.has("dynamicValue")) {
1960      JsonArray array = json.getAsJsonArray("dynamicValue");
1961      for (int i = 0; i < array.size(); i++) {
1962        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
1963      }
1964    };
1965  }
1966
1967  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
1968    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
1969    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
1970    return res;
1971  }
1972
1973  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
1974    parseBackboneProperties(json, res);
1975    if (json.has("type"))
1976      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
1977    if (json.has("_type"))
1978      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1979    if (json.has("role"))
1980      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
1981  }
1982
1983  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
1984    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
1985    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
1986    return res;
1987  }
1988
1989  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
1990    parseBackboneProperties(json, res);
1991    if (json.has("description"))
1992      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1993    if (json.has("_description"))
1994      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1995    if (json.has("path"))
1996      res.setPathElement(parseString(json.get("path").getAsString()));
1997    if (json.has("_path"))
1998      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1999    if (json.has("language"))
2000      res.setLanguageElement(parseString(json.get("language").getAsString()));
2001    if (json.has("_language"))
2002      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
2003    if (json.has("expression"))
2004      res.setExpressionElement(parseString(json.get("expression").getAsString()));
2005    if (json.has("_expression"))
2006      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
2007  }
2008
2009  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2010    AdverseEvent res = new AdverseEvent();
2011    parseAdverseEventProperties(json, res);
2012    return res;
2013  }
2014
2015  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2016    parseDomainResourceProperties(json, res);
2017    if (json.has("identifier"))
2018      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2019    if (json.has("category"))
2020      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), AdverseEvent.AdverseEventCategory.NULL, new AdverseEvent.AdverseEventCategoryEnumFactory()));
2021    if (json.has("_category"))
2022      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
2023    if (json.has("type"))
2024      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2025    if (json.has("subject"))
2026      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2027    if (json.has("date"))
2028      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2029    if (json.has("_date"))
2030      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2031    if (json.has("reaction")) {
2032      JsonArray array = json.getAsJsonArray("reaction");
2033      for (int i = 0; i < array.size(); i++) {
2034        res.getReaction().add(parseReference(array.get(i).getAsJsonObject()));
2035      }
2036    };
2037    if (json.has("location"))
2038      res.setLocation(parseReference(json.getAsJsonObject("location")));
2039    if (json.has("seriousness"))
2040      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2041    if (json.has("outcome"))
2042      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2043    if (json.has("recorder"))
2044      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2045    if (json.has("eventParticipant"))
2046      res.setEventParticipant(parseReference(json.getAsJsonObject("eventParticipant")));
2047    if (json.has("description"))
2048      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2049    if (json.has("_description"))
2050      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2051    if (json.has("suspectEntity")) {
2052      JsonArray array = json.getAsJsonArray("suspectEntity");
2053      for (int i = 0; i < array.size(); i++) {
2054        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2055      }
2056    };
2057    if (json.has("subjectMedicalHistory")) {
2058      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2059      for (int i = 0; i < array.size(); i++) {
2060        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2061      }
2062    };
2063    if (json.has("referenceDocument")) {
2064      JsonArray array = json.getAsJsonArray("referenceDocument");
2065      for (int i = 0; i < array.size(); i++) {
2066        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2067      }
2068    };
2069    if (json.has("study")) {
2070      JsonArray array = json.getAsJsonArray("study");
2071      for (int i = 0; i < array.size(); i++) {
2072        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2073      }
2074    };
2075  }
2076
2077  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2078    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2079    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2080    return res;
2081  }
2082
2083  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2084    parseBackboneProperties(json, res);
2085    if (json.has("instance"))
2086      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2087    if (json.has("causality"))
2088      res.setCausalityElement(parseEnumeration(json.get("causality").getAsString(), AdverseEvent.AdverseEventCausality.NULL, new AdverseEvent.AdverseEventCausalityEnumFactory()));
2089    if (json.has("_causality"))
2090      parseElementProperties(json.getAsJsonObject("_causality"), res.getCausalityElement());
2091    if (json.has("causalityAssessment"))
2092      res.setCausalityAssessment(parseCodeableConcept(json.getAsJsonObject("causalityAssessment")));
2093    if (json.has("causalityProductRelatedness"))
2094      res.setCausalityProductRelatednessElement(parseString(json.get("causalityProductRelatedness").getAsString()));
2095    if (json.has("_causalityProductRelatedness"))
2096      parseElementProperties(json.getAsJsonObject("_causalityProductRelatedness"), res.getCausalityProductRelatednessElement());
2097    if (json.has("causalityMethod"))
2098      res.setCausalityMethod(parseCodeableConcept(json.getAsJsonObject("causalityMethod")));
2099    if (json.has("causalityAuthor"))
2100      res.setCausalityAuthor(parseReference(json.getAsJsonObject("causalityAuthor")));
2101    if (json.has("causalityResult"))
2102      res.setCausalityResult(parseCodeableConcept(json.getAsJsonObject("causalityResult")));
2103  }
2104
2105  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2106    AllergyIntolerance res = new AllergyIntolerance();
2107    parseAllergyIntoleranceProperties(json, res);
2108    return res;
2109  }
2110
2111  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2112    parseDomainResourceProperties(json, res);
2113    if (json.has("identifier")) {
2114      JsonArray array = json.getAsJsonArray("identifier");
2115      for (int i = 0; i < array.size(); i++) {
2116        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2117      }
2118    };
2119    if (json.has("clinicalStatus"))
2120      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2121    if (json.has("_clinicalStatus"))
2122      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
2123    if (json.has("verificationStatus"))
2124      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2125    if (json.has("_verificationStatus"))
2126      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
2127    if (json.has("type"))
2128      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2129    if (json.has("_type"))
2130      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2131    if (json.has("category")) {
2132      JsonArray array = json.getAsJsonArray("category");
2133      for (int i = 0; i < array.size(); i++) {
2134        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2135      }
2136    };
2137    if (json.has("_category")) {
2138      JsonArray array = json.getAsJsonArray("_category");
2139      for (int i = 0; i < array.size(); i++) {
2140        if (i == res.getCategory().size())
2141          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2142        if (array.get(i) instanceof JsonObject) 
2143          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2144      }
2145    };
2146    if (json.has("criticality"))
2147      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2148    if (json.has("_criticality"))
2149      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2150    if (json.has("code"))
2151      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2152    if (json.has("patient"))
2153      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2154    Type onset = parseType("onset", json);
2155    if (onset != null)
2156      res.setOnset(onset);
2157    if (json.has("assertedDate"))
2158      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
2159    if (json.has("_assertedDate"))
2160      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
2161    if (json.has("recorder"))
2162      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2163    if (json.has("asserter"))
2164      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2165    if (json.has("lastOccurrence"))
2166      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2167    if (json.has("_lastOccurrence"))
2168      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2169    if (json.has("note")) {
2170      JsonArray array = json.getAsJsonArray("note");
2171      for (int i = 0; i < array.size(); i++) {
2172        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2173      }
2174    };
2175    if (json.has("reaction")) {
2176      JsonArray array = json.getAsJsonArray("reaction");
2177      for (int i = 0; i < array.size(); i++) {
2178        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2179      }
2180    };
2181  }
2182
2183  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2184    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2185    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2186    return res;
2187  }
2188
2189  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2190    parseBackboneProperties(json, res);
2191    if (json.has("substance"))
2192      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2193    if (json.has("manifestation")) {
2194      JsonArray array = json.getAsJsonArray("manifestation");
2195      for (int i = 0; i < array.size(); i++) {
2196        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2197      }
2198    };
2199    if (json.has("description"))
2200      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2201    if (json.has("_description"))
2202      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2203    if (json.has("onset"))
2204      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2205    if (json.has("_onset"))
2206      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2207    if (json.has("severity"))
2208      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2209    if (json.has("_severity"))
2210      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2211    if (json.has("exposureRoute"))
2212      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2213    if (json.has("note")) {
2214      JsonArray array = json.getAsJsonArray("note");
2215      for (int i = 0; i < array.size(); i++) {
2216        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2217      }
2218    };
2219  }
2220
2221  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2222    Appointment res = new Appointment();
2223    parseAppointmentProperties(json, res);
2224    return res;
2225  }
2226
2227  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2228    parseDomainResourceProperties(json, res);
2229    if (json.has("identifier")) {
2230      JsonArray array = json.getAsJsonArray("identifier");
2231      for (int i = 0; i < array.size(); i++) {
2232        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2233      }
2234    };
2235    if (json.has("status"))
2236      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2237    if (json.has("_status"))
2238      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2239    if (json.has("serviceCategory"))
2240      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
2241    if (json.has("serviceType")) {
2242      JsonArray array = json.getAsJsonArray("serviceType");
2243      for (int i = 0; i < array.size(); i++) {
2244        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2245      }
2246    };
2247    if (json.has("specialty")) {
2248      JsonArray array = json.getAsJsonArray("specialty");
2249      for (int i = 0; i < array.size(); i++) {
2250        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2251      }
2252    };
2253    if (json.has("appointmentType"))
2254      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2255    if (json.has("reason")) {
2256      JsonArray array = json.getAsJsonArray("reason");
2257      for (int i = 0; i < array.size(); i++) {
2258        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2259      }
2260    };
2261    if (json.has("indication")) {
2262      JsonArray array = json.getAsJsonArray("indication");
2263      for (int i = 0; i < array.size(); i++) {
2264        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2265      }
2266    };
2267    if (json.has("priority"))
2268      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2269    if (json.has("_priority"))
2270      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2271    if (json.has("description"))
2272      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2273    if (json.has("_description"))
2274      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2275    if (json.has("supportingInformation")) {
2276      JsonArray array = json.getAsJsonArray("supportingInformation");
2277      for (int i = 0; i < array.size(); i++) {
2278        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2279      }
2280    };
2281    if (json.has("start"))
2282      res.setStartElement(parseInstant(json.get("start").getAsString()));
2283    if (json.has("_start"))
2284      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2285    if (json.has("end"))
2286      res.setEndElement(parseInstant(json.get("end").getAsString()));
2287    if (json.has("_end"))
2288      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2289    if (json.has("minutesDuration"))
2290      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2291    if (json.has("_minutesDuration"))
2292      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2293    if (json.has("slot")) {
2294      JsonArray array = json.getAsJsonArray("slot");
2295      for (int i = 0; i < array.size(); i++) {
2296        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2297      }
2298    };
2299    if (json.has("created"))
2300      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2301    if (json.has("_created"))
2302      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2303    if (json.has("comment"))
2304      res.setCommentElement(parseString(json.get("comment").getAsString()));
2305    if (json.has("_comment"))
2306      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2307    if (json.has("incomingReferral")) {
2308      JsonArray array = json.getAsJsonArray("incomingReferral");
2309      for (int i = 0; i < array.size(); i++) {
2310        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
2311      }
2312    };
2313    if (json.has("participant")) {
2314      JsonArray array = json.getAsJsonArray("participant");
2315      for (int i = 0; i < array.size(); i++) {
2316        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2317      }
2318    };
2319    if (json.has("requestedPeriod")) {
2320      JsonArray array = json.getAsJsonArray("requestedPeriod");
2321      for (int i = 0; i < array.size(); i++) {
2322        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2323      }
2324    };
2325  }
2326
2327  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2328    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2329    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2330    return res;
2331  }
2332
2333  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2334    parseBackboneProperties(json, res);
2335    if (json.has("type")) {
2336      JsonArray array = json.getAsJsonArray("type");
2337      for (int i = 0; i < array.size(); i++) {
2338        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2339      }
2340    };
2341    if (json.has("actor"))
2342      res.setActor(parseReference(json.getAsJsonObject("actor")));
2343    if (json.has("required"))
2344      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2345    if (json.has("_required"))
2346      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2347    if (json.has("status"))
2348      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2349    if (json.has("_status"))
2350      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2351  }
2352
2353  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2354    AppointmentResponse res = new AppointmentResponse();
2355    parseAppointmentResponseProperties(json, res);
2356    return res;
2357  }
2358
2359  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2360    parseDomainResourceProperties(json, res);
2361    if (json.has("identifier")) {
2362      JsonArray array = json.getAsJsonArray("identifier");
2363      for (int i = 0; i < array.size(); i++) {
2364        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2365      }
2366    };
2367    if (json.has("appointment"))
2368      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2369    if (json.has("start"))
2370      res.setStartElement(parseInstant(json.get("start").getAsString()));
2371    if (json.has("_start"))
2372      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2373    if (json.has("end"))
2374      res.setEndElement(parseInstant(json.get("end").getAsString()));
2375    if (json.has("_end"))
2376      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2377    if (json.has("participantType")) {
2378      JsonArray array = json.getAsJsonArray("participantType");
2379      for (int i = 0; i < array.size(); i++) {
2380        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2381      }
2382    };
2383    if (json.has("actor"))
2384      res.setActor(parseReference(json.getAsJsonObject("actor")));
2385    if (json.has("participantStatus"))
2386      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2387    if (json.has("_participantStatus"))
2388      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2389    if (json.has("comment"))
2390      res.setCommentElement(parseString(json.get("comment").getAsString()));
2391    if (json.has("_comment"))
2392      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2393  }
2394
2395  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2396    AuditEvent res = new AuditEvent();
2397    parseAuditEventProperties(json, res);
2398    return res;
2399  }
2400
2401  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2402    parseDomainResourceProperties(json, res);
2403    if (json.has("type"))
2404      res.setType(parseCoding(json.getAsJsonObject("type")));
2405    if (json.has("subtype")) {
2406      JsonArray array = json.getAsJsonArray("subtype");
2407      for (int i = 0; i < array.size(); i++) {
2408        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2409      }
2410    };
2411    if (json.has("action"))
2412      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2413    if (json.has("_action"))
2414      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2415    if (json.has("recorded"))
2416      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2417    if (json.has("_recorded"))
2418      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2419    if (json.has("outcome"))
2420      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2421    if (json.has("_outcome"))
2422      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2423    if (json.has("outcomeDesc"))
2424      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2425    if (json.has("_outcomeDesc"))
2426      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2427    if (json.has("purposeOfEvent")) {
2428      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2429      for (int i = 0; i < array.size(); i++) {
2430        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2431      }
2432    };
2433    if (json.has("agent")) {
2434      JsonArray array = json.getAsJsonArray("agent");
2435      for (int i = 0; i < array.size(); i++) {
2436        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2437      }
2438    };
2439    if (json.has("source"))
2440      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2441    if (json.has("entity")) {
2442      JsonArray array = json.getAsJsonArray("entity");
2443      for (int i = 0; i < array.size(); i++) {
2444        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2445      }
2446    };
2447  }
2448
2449  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2450    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2451    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2452    return res;
2453  }
2454
2455  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2456    parseBackboneProperties(json, res);
2457    if (json.has("role")) {
2458      JsonArray array = json.getAsJsonArray("role");
2459      for (int i = 0; i < array.size(); i++) {
2460        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2461      }
2462    };
2463    if (json.has("reference"))
2464      res.setReference(parseReference(json.getAsJsonObject("reference")));
2465    if (json.has("userId"))
2466      res.setUserId(parseIdentifier(json.getAsJsonObject("userId")));
2467    if (json.has("altId"))
2468      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2469    if (json.has("_altId"))
2470      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2471    if (json.has("name"))
2472      res.setNameElement(parseString(json.get("name").getAsString()));
2473    if (json.has("_name"))
2474      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2475    if (json.has("requestor"))
2476      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2477    if (json.has("_requestor"))
2478      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2479    if (json.has("location"))
2480      res.setLocation(parseReference(json.getAsJsonObject("location")));
2481    if (json.has("policy")) {
2482      JsonArray array = json.getAsJsonArray("policy");
2483      for (int i = 0; i < array.size(); i++) {
2484        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2485      }
2486    };
2487    if (json.has("_policy")) {
2488      JsonArray array = json.getAsJsonArray("_policy");
2489      for (int i = 0; i < array.size(); i++) {
2490        if (i == res.getPolicy().size())
2491          res.getPolicy().add(parseUri(null));
2492        if (array.get(i) instanceof JsonObject) 
2493          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2494      }
2495    };
2496    if (json.has("media"))
2497      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2498    if (json.has("network"))
2499      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2500    if (json.has("purposeOfUse")) {
2501      JsonArray array = json.getAsJsonArray("purposeOfUse");
2502      for (int i = 0; i < array.size(); i++) {
2503        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2504      }
2505    };
2506  }
2507
2508  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2509    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2510    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2511    return res;
2512  }
2513
2514  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2515    parseBackboneProperties(json, res);
2516    if (json.has("address"))
2517      res.setAddressElement(parseString(json.get("address").getAsString()));
2518    if (json.has("_address"))
2519      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2520    if (json.has("type"))
2521      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2522    if (json.has("_type"))
2523      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2524  }
2525
2526  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2527    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2528    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2529    return res;
2530  }
2531
2532  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2533    parseBackboneProperties(json, res);
2534    if (json.has("site"))
2535      res.setSiteElement(parseString(json.get("site").getAsString()));
2536    if (json.has("_site"))
2537      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2538    if (json.has("identifier"))
2539      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2540    if (json.has("type")) {
2541      JsonArray array = json.getAsJsonArray("type");
2542      for (int i = 0; i < array.size(); i++) {
2543        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2544      }
2545    };
2546  }
2547
2548  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2549    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2550    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2551    return res;
2552  }
2553
2554  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2555    parseBackboneProperties(json, res);
2556    if (json.has("identifier"))
2557      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2558    if (json.has("reference"))
2559      res.setReference(parseReference(json.getAsJsonObject("reference")));
2560    if (json.has("type"))
2561      res.setType(parseCoding(json.getAsJsonObject("type")));
2562    if (json.has("role"))
2563      res.setRole(parseCoding(json.getAsJsonObject("role")));
2564    if (json.has("lifecycle"))
2565      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2566    if (json.has("securityLabel")) {
2567      JsonArray array = json.getAsJsonArray("securityLabel");
2568      for (int i = 0; i < array.size(); i++) {
2569        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2570      }
2571    };
2572    if (json.has("name"))
2573      res.setNameElement(parseString(json.get("name").getAsString()));
2574    if (json.has("_name"))
2575      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2576    if (json.has("description"))
2577      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2578    if (json.has("_description"))
2579      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2580    if (json.has("query"))
2581      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2582    if (json.has("_query"))
2583      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2584    if (json.has("detail")) {
2585      JsonArray array = json.getAsJsonArray("detail");
2586      for (int i = 0; i < array.size(); i++) {
2587        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2588      }
2589    };
2590  }
2591
2592  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2593    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2594    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2595    return res;
2596  }
2597
2598  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2599    parseBackboneProperties(json, res);
2600    if (json.has("type"))
2601      res.setTypeElement(parseString(json.get("type").getAsString()));
2602    if (json.has("_type"))
2603      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2604    if (json.has("value"))
2605      res.setValueElement(parseBase64Binary(json.get("value").getAsString()));
2606    if (json.has("_value"))
2607      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
2608  }
2609
2610  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2611    Basic res = new Basic();
2612    parseBasicProperties(json, res);
2613    return res;
2614  }
2615
2616  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2617    parseDomainResourceProperties(json, res);
2618    if (json.has("identifier")) {
2619      JsonArray array = json.getAsJsonArray("identifier");
2620      for (int i = 0; i < array.size(); i++) {
2621        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2622      }
2623    };
2624    if (json.has("code"))
2625      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2626    if (json.has("subject"))
2627      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2628    if (json.has("created"))
2629      res.setCreatedElement(parseDate(json.get("created").getAsString()));
2630    if (json.has("_created"))
2631      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2632    if (json.has("author"))
2633      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2634  }
2635
2636  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
2637    Binary res = new Binary();
2638    parseBinaryProperties(json, res);
2639    return res;
2640  }
2641
2642  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
2643    parseResourceProperties(json, res);
2644    if (json.has("contentType"))
2645      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
2646    if (json.has("_contentType"))
2647      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
2648    if (json.has("securityContext"))
2649      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
2650    if (json.has("content"))
2651      res.setContentElement(parseBase64Binary(json.get("content").getAsString()));
2652    if (json.has("_content"))
2653      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
2654  }
2655
2656  protected BodySite parseBodySite(JsonObject json) throws IOException, FHIRFormatError {
2657    BodySite res = new BodySite();
2658    parseBodySiteProperties(json, res);
2659    return res;
2660  }
2661
2662  protected void parseBodySiteProperties(JsonObject json, BodySite res) throws IOException, FHIRFormatError {
2663    parseDomainResourceProperties(json, res);
2664    if (json.has("identifier")) {
2665      JsonArray array = json.getAsJsonArray("identifier");
2666      for (int i = 0; i < array.size(); i++) {
2667        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2668      }
2669    };
2670    if (json.has("active"))
2671      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
2672    if (json.has("_active"))
2673      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
2674    if (json.has("code"))
2675      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2676    if (json.has("qualifier")) {
2677      JsonArray array = json.getAsJsonArray("qualifier");
2678      for (int i = 0; i < array.size(); i++) {
2679        res.getQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2680      }
2681    };
2682    if (json.has("description"))
2683      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2684    if (json.has("_description"))
2685      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2686    if (json.has("image")) {
2687      JsonArray array = json.getAsJsonArray("image");
2688      for (int i = 0; i < array.size(); i++) {
2689        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
2690      }
2691    };
2692    if (json.has("patient"))
2693      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2694  }
2695
2696  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
2697    Bundle res = new Bundle();
2698    parseBundleProperties(json, res);
2699    return res;
2700  }
2701
2702  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
2703    parseResourceProperties(json, res);
2704    if (json.has("identifier"))
2705      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2706    if (json.has("type"))
2707      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
2708    if (json.has("_type"))
2709      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2710    if (json.has("total"))
2711      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
2712    if (json.has("_total"))
2713      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
2714    if (json.has("link")) {
2715      JsonArray array = json.getAsJsonArray("link");
2716      for (int i = 0; i < array.size(); i++) {
2717        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
2718      }
2719    };
2720    if (json.has("entry")) {
2721      JsonArray array = json.getAsJsonArray("entry");
2722      for (int i = 0; i < array.size(); i++) {
2723        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
2724      }
2725    };
2726    if (json.has("signature"))
2727      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
2728  }
2729
2730  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2731    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
2732    parseBundleBundleLinkComponentProperties(json, owner, res);
2733    return res;
2734  }
2735
2736  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
2737    parseBackboneProperties(json, res);
2738    if (json.has("relation"))
2739      res.setRelationElement(parseString(json.get("relation").getAsString()));
2740    if (json.has("_relation"))
2741      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
2742    if (json.has("url"))
2743      res.setUrlElement(parseUri(json.get("url").getAsString()));
2744    if (json.has("_url"))
2745      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2746  }
2747
2748  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2749    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
2750    parseBundleBundleEntryComponentProperties(json, owner, res);
2751    return res;
2752  }
2753
2754  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
2755    parseBackboneProperties(json, res);
2756    if (json.has("link")) {
2757      JsonArray array = json.getAsJsonArray("link");
2758      for (int i = 0; i < array.size(); i++) {
2759        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
2760      }
2761    };
2762    if (json.has("fullUrl"))
2763      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
2764    if (json.has("_fullUrl"))
2765      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
2766    if (json.has("resource"))
2767      res.setResource(parseResource(json.getAsJsonObject("resource")));
2768    if (json.has("search"))
2769      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
2770    if (json.has("request"))
2771      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
2772    if (json.has("response"))
2773      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
2774  }
2775
2776  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2777    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
2778    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
2779    return res;
2780  }
2781
2782  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
2783    parseBackboneProperties(json, res);
2784    if (json.has("mode"))
2785      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
2786    if (json.has("_mode"))
2787      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
2788    if (json.has("score"))
2789      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
2790    if (json.has("_score"))
2791      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
2792  }
2793
2794  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2795    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
2796    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
2797    return res;
2798  }
2799
2800  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
2801    parseBackboneProperties(json, res);
2802    if (json.has("method"))
2803      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
2804    if (json.has("_method"))
2805      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
2806    if (json.has("url"))
2807      res.setUrlElement(parseUri(json.get("url").getAsString()));
2808    if (json.has("_url"))
2809      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2810    if (json.has("ifNoneMatch"))
2811      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
2812    if (json.has("_ifNoneMatch"))
2813      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
2814    if (json.has("ifModifiedSince"))
2815      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
2816    if (json.has("_ifModifiedSince"))
2817      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
2818    if (json.has("ifMatch"))
2819      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
2820    if (json.has("_ifMatch"))
2821      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
2822    if (json.has("ifNoneExist"))
2823      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
2824    if (json.has("_ifNoneExist"))
2825      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
2826  }
2827
2828  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
2829    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
2830    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
2831    return res;
2832  }
2833
2834  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
2835    parseBackboneProperties(json, res);
2836    if (json.has("status"))
2837      res.setStatusElement(parseString(json.get("status").getAsString()));
2838    if (json.has("_status"))
2839      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2840    if (json.has("location"))
2841      res.setLocationElement(parseUri(json.get("location").getAsString()));
2842    if (json.has("_location"))
2843      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
2844    if (json.has("etag"))
2845      res.setEtagElement(parseString(json.get("etag").getAsString()));
2846    if (json.has("_etag"))
2847      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
2848    if (json.has("lastModified"))
2849      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
2850    if (json.has("_lastModified"))
2851      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
2852    if (json.has("outcome"))
2853      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
2854  }
2855
2856  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
2857    CapabilityStatement res = new CapabilityStatement();
2858    parseCapabilityStatementProperties(json, res);
2859    return res;
2860  }
2861
2862  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
2863    parseDomainResourceProperties(json, res);
2864    if (json.has("url"))
2865      res.setUrlElement(parseUri(json.get("url").getAsString()));
2866    if (json.has("_url"))
2867      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2868    if (json.has("version"))
2869      res.setVersionElement(parseString(json.get("version").getAsString()));
2870    if (json.has("_version"))
2871      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2872    if (json.has("name"))
2873      res.setNameElement(parseString(json.get("name").getAsString()));
2874    if (json.has("_name"))
2875      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2876    if (json.has("title"))
2877      res.setTitleElement(parseString(json.get("title").getAsString()));
2878    if (json.has("_title"))
2879      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2880    if (json.has("status"))
2881      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2882    if (json.has("_status"))
2883      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2884    if (json.has("experimental"))
2885      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2886    if (json.has("_experimental"))
2887      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2888    if (json.has("date"))
2889      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2890    if (json.has("_date"))
2891      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2892    if (json.has("publisher"))
2893      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2894    if (json.has("_publisher"))
2895      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2896    if (json.has("contact")) {
2897      JsonArray array = json.getAsJsonArray("contact");
2898      for (int i = 0; i < array.size(); i++) {
2899        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2900      }
2901    };
2902    if (json.has("description"))
2903      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2904    if (json.has("_description"))
2905      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2906    if (json.has("useContext")) {
2907      JsonArray array = json.getAsJsonArray("useContext");
2908      for (int i = 0; i < array.size(); i++) {
2909        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2910      }
2911    };
2912    if (json.has("jurisdiction")) {
2913      JsonArray array = json.getAsJsonArray("jurisdiction");
2914      for (int i = 0; i < array.size(); i++) {
2915        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2916      }
2917    };
2918    if (json.has("purpose"))
2919      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2920    if (json.has("_purpose"))
2921      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2922    if (json.has("copyright"))
2923      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2924    if (json.has("_copyright"))
2925      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2926    if (json.has("kind"))
2927      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
2928    if (json.has("_kind"))
2929      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2930    if (json.has("instantiates")) {
2931      JsonArray array = json.getAsJsonArray("instantiates");
2932      for (int i = 0; i < array.size(); i++) {
2933        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
2934      }
2935    };
2936    if (json.has("_instantiates")) {
2937      JsonArray array = json.getAsJsonArray("_instantiates");
2938      for (int i = 0; i < array.size(); i++) {
2939        if (i == res.getInstantiates().size())
2940          res.getInstantiates().add(parseUri(null));
2941        if (array.get(i) instanceof JsonObject) 
2942          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
2943      }
2944    };
2945    if (json.has("software"))
2946      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
2947    if (json.has("implementation"))
2948      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
2949    if (json.has("fhirVersion"))
2950      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
2951    if (json.has("_fhirVersion"))
2952      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
2953    if (json.has("acceptUnknown"))
2954      res.setAcceptUnknownElement(parseEnumeration(json.get("acceptUnknown").getAsString(), CapabilityStatement.UnknownContentCode.NULL, new CapabilityStatement.UnknownContentCodeEnumFactory()));
2955    if (json.has("_acceptUnknown"))
2956      parseElementProperties(json.getAsJsonObject("_acceptUnknown"), res.getAcceptUnknownElement());
2957    if (json.has("format")) {
2958      JsonArray array = json.getAsJsonArray("format");
2959      for (int i = 0; i < array.size(); i++) {
2960        res.getFormat().add(parseCode(array.get(i).getAsString()));
2961      }
2962    };
2963    if (json.has("_format")) {
2964      JsonArray array = json.getAsJsonArray("_format");
2965      for (int i = 0; i < array.size(); i++) {
2966        if (i == res.getFormat().size())
2967          res.getFormat().add(parseCode(null));
2968        if (array.get(i) instanceof JsonObject) 
2969          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
2970      }
2971    };
2972    if (json.has("patchFormat")) {
2973      JsonArray array = json.getAsJsonArray("patchFormat");
2974      for (int i = 0; i < array.size(); i++) {
2975        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
2976      }
2977    };
2978    if (json.has("_patchFormat")) {
2979      JsonArray array = json.getAsJsonArray("_patchFormat");
2980      for (int i = 0; i < array.size(); i++) {
2981        if (i == res.getPatchFormat().size())
2982          res.getPatchFormat().add(parseCode(null));
2983        if (array.get(i) instanceof JsonObject) 
2984          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
2985      }
2986    };
2987    if (json.has("implementationGuide")) {
2988      JsonArray array = json.getAsJsonArray("implementationGuide");
2989      for (int i = 0; i < array.size(); i++) {
2990        res.getImplementationGuide().add(parseUri(array.get(i).getAsString()));
2991      }
2992    };
2993    if (json.has("_implementationGuide")) {
2994      JsonArray array = json.getAsJsonArray("_implementationGuide");
2995      for (int i = 0; i < array.size(); i++) {
2996        if (i == res.getImplementationGuide().size())
2997          res.getImplementationGuide().add(parseUri(null));
2998        if (array.get(i) instanceof JsonObject) 
2999          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3000      }
3001    };
3002    if (json.has("profile")) {
3003      JsonArray array = json.getAsJsonArray("profile");
3004      for (int i = 0; i < array.size(); i++) {
3005        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
3006      }
3007    };
3008    if (json.has("rest")) {
3009      JsonArray array = json.getAsJsonArray("rest");
3010      for (int i = 0; i < array.size(); i++) {
3011        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3012      }
3013    };
3014    if (json.has("messaging")) {
3015      JsonArray array = json.getAsJsonArray("messaging");
3016      for (int i = 0; i < array.size(); i++) {
3017        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3018      }
3019    };
3020    if (json.has("document")) {
3021      JsonArray array = json.getAsJsonArray("document");
3022      for (int i = 0; i < array.size(); i++) {
3023        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3024      }
3025    };
3026  }
3027
3028  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3029    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3030    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3031    return res;
3032  }
3033
3034  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3035    parseBackboneProperties(json, res);
3036    if (json.has("name"))
3037      res.setNameElement(parseString(json.get("name").getAsString()));
3038    if (json.has("_name"))
3039      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3040    if (json.has("version"))
3041      res.setVersionElement(parseString(json.get("version").getAsString()));
3042    if (json.has("_version"))
3043      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3044    if (json.has("releaseDate"))
3045      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3046    if (json.has("_releaseDate"))
3047      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3048  }
3049
3050  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3051    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3052    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3053    return res;
3054  }
3055
3056  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3057    parseBackboneProperties(json, res);
3058    if (json.has("description"))
3059      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3060    if (json.has("_description"))
3061      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3062    if (json.has("url"))
3063      res.setUrlElement(parseUri(json.get("url").getAsString()));
3064    if (json.has("_url"))
3065      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3066  }
3067
3068  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3069    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3070    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3071    return res;
3072  }
3073
3074  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3075    parseBackboneProperties(json, res);
3076    if (json.has("mode"))
3077      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3078    if (json.has("_mode"))
3079      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3080    if (json.has("documentation"))
3081      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3082    if (json.has("_documentation"))
3083      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3084    if (json.has("security"))
3085      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3086    if (json.has("resource")) {
3087      JsonArray array = json.getAsJsonArray("resource");
3088      for (int i = 0; i < array.size(); i++) {
3089        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3090      }
3091    };
3092    if (json.has("interaction")) {
3093      JsonArray array = json.getAsJsonArray("interaction");
3094      for (int i = 0; i < array.size(); i++) {
3095        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3096      }
3097    };
3098    if (json.has("searchParam")) {
3099      JsonArray array = json.getAsJsonArray("searchParam");
3100      for (int i = 0; i < array.size(); i++) {
3101        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3102      }
3103    };
3104    if (json.has("operation")) {
3105      JsonArray array = json.getAsJsonArray("operation");
3106      for (int i = 0; i < array.size(); i++) {
3107        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestOperationComponent(array.get(i).getAsJsonObject(), owner));
3108      }
3109    };
3110    if (json.has("compartment")) {
3111      JsonArray array = json.getAsJsonArray("compartment");
3112      for (int i = 0; i < array.size(); i++) {
3113        res.getCompartment().add(parseUri(array.get(i).getAsString()));
3114      }
3115    };
3116    if (json.has("_compartment")) {
3117      JsonArray array = json.getAsJsonArray("_compartment");
3118      for (int i = 0; i < array.size(); i++) {
3119        if (i == res.getCompartment().size())
3120          res.getCompartment().add(parseUri(null));
3121        if (array.get(i) instanceof JsonObject) 
3122          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3123      }
3124    };
3125  }
3126
3127  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3128    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3129    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3130    return res;
3131  }
3132
3133  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3134    parseBackboneProperties(json, res);
3135    if (json.has("cors"))
3136      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3137    if (json.has("_cors"))
3138      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3139    if (json.has("service")) {
3140      JsonArray array = json.getAsJsonArray("service");
3141      for (int i = 0; i < array.size(); i++) {
3142        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3143      }
3144    };
3145    if (json.has("description"))
3146      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3147    if (json.has("_description"))
3148      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3149    if (json.has("certificate")) {
3150      JsonArray array = json.getAsJsonArray("certificate");
3151      for (int i = 0; i < array.size(); i++) {
3152        res.getCertificate().add(parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(array.get(i).getAsJsonObject(), owner));
3153      }
3154    };
3155  }
3156
3157  protected CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3158    CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res = new CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
3159    parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(json, owner, res);
3160    return res;
3161  }
3162
3163  protected void parseCapabilityStatementCapabilityStatementRestSecurityCertificateComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent res) throws IOException, FHIRFormatError {
3164    parseBackboneProperties(json, res);
3165    if (json.has("type"))
3166      res.setTypeElement(parseCode(json.get("type").getAsString()));
3167    if (json.has("_type"))
3168      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3169    if (json.has("blob"))
3170      res.setBlobElement(parseBase64Binary(json.get("blob").getAsString()));
3171    if (json.has("_blob"))
3172      parseElementProperties(json.getAsJsonObject("_blob"), res.getBlobElement());
3173  }
3174
3175  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3176    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3177    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3178    return res;
3179  }
3180
3181  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3182    parseBackboneProperties(json, res);
3183    if (json.has("type"))
3184      res.setTypeElement(parseCode(json.get("type").getAsString()));
3185    if (json.has("_type"))
3186      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3187    if (json.has("profile"))
3188      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3189    if (json.has("documentation"))
3190      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3191    if (json.has("_documentation"))
3192      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3193    if (json.has("interaction")) {
3194      JsonArray array = json.getAsJsonArray("interaction");
3195      for (int i = 0; i < array.size(); i++) {
3196        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3197      }
3198    };
3199    if (json.has("versioning"))
3200      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3201    if (json.has("_versioning"))
3202      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3203    if (json.has("readHistory"))
3204      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3205    if (json.has("_readHistory"))
3206      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3207    if (json.has("updateCreate"))
3208      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3209    if (json.has("_updateCreate"))
3210      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3211    if (json.has("conditionalCreate"))
3212      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3213    if (json.has("_conditionalCreate"))
3214      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3215    if (json.has("conditionalRead"))
3216      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3217    if (json.has("_conditionalRead"))
3218      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3219    if (json.has("conditionalUpdate"))
3220      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3221    if (json.has("_conditionalUpdate"))
3222      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3223    if (json.has("conditionalDelete"))
3224      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3225    if (json.has("_conditionalDelete"))
3226      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3227    if (json.has("referencePolicy")) {
3228      JsonArray array = json.getAsJsonArray("referencePolicy");
3229      for (int i = 0; i < array.size(); i++) {
3230        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3231      }
3232    };
3233    if (json.has("_referencePolicy")) {
3234      JsonArray array = json.getAsJsonArray("_referencePolicy");
3235      for (int i = 0; i < array.size(); i++) {
3236        if (i == res.getReferencePolicy().size())
3237          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3238        if (array.get(i) instanceof JsonObject) 
3239          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3240      }
3241    };
3242    if (json.has("searchInclude")) {
3243      JsonArray array = json.getAsJsonArray("searchInclude");
3244      for (int i = 0; i < array.size(); i++) {
3245        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3246      }
3247    };
3248    if (json.has("_searchInclude")) {
3249      JsonArray array = json.getAsJsonArray("_searchInclude");
3250      for (int i = 0; i < array.size(); i++) {
3251        if (i == res.getSearchInclude().size())
3252          res.getSearchInclude().add(parseString(null));
3253        if (array.get(i) instanceof JsonObject) 
3254          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3255      }
3256    };
3257    if (json.has("searchRevInclude")) {
3258      JsonArray array = json.getAsJsonArray("searchRevInclude");
3259      for (int i = 0; i < array.size(); i++) {
3260        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3261      }
3262    };
3263    if (json.has("_searchRevInclude")) {
3264      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3265      for (int i = 0; i < array.size(); i++) {
3266        if (i == res.getSearchRevInclude().size())
3267          res.getSearchRevInclude().add(parseString(null));
3268        if (array.get(i) instanceof JsonObject) 
3269          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3270      }
3271    };
3272    if (json.has("searchParam")) {
3273      JsonArray array = json.getAsJsonArray("searchParam");
3274      for (int i = 0; i < array.size(); i++) {
3275        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3276      }
3277    };
3278  }
3279
3280  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3281    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3282    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3283    return res;
3284  }
3285
3286  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3287    parseBackboneProperties(json, res);
3288    if (json.has("code"))
3289      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3290    if (json.has("_code"))
3291      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3292    if (json.has("documentation"))
3293      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3294    if (json.has("_documentation"))
3295      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3296  }
3297
3298  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3299    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3300    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3301    return res;
3302  }
3303
3304  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3305    parseBackboneProperties(json, res);
3306    if (json.has("name"))
3307      res.setNameElement(parseString(json.get("name").getAsString()));
3308    if (json.has("_name"))
3309      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3310    if (json.has("definition"))
3311      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
3312    if (json.has("_definition"))
3313      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3314    if (json.has("type"))
3315      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3316    if (json.has("_type"))
3317      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3318    if (json.has("documentation"))
3319      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3320    if (json.has("_documentation"))
3321      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3322  }
3323
3324  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3325    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3326    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3327    return res;
3328  }
3329
3330  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3331    parseBackboneProperties(json, res);
3332    if (json.has("code"))
3333      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3334    if (json.has("_code"))
3335      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3336    if (json.has("documentation"))
3337      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3338    if (json.has("_documentation"))
3339      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3340  }
3341
3342  protected CapabilityStatement.CapabilityStatementRestOperationComponent parseCapabilityStatementCapabilityStatementRestOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3343    CapabilityStatement.CapabilityStatementRestOperationComponent res = new CapabilityStatement.CapabilityStatementRestOperationComponent();
3344    parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(json, owner, res);
3345    return res;
3346  }
3347
3348  protected void parseCapabilityStatementCapabilityStatementRestOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestOperationComponent res) throws IOException, FHIRFormatError {
3349    parseBackboneProperties(json, res);
3350    if (json.has("name"))
3351      res.setNameElement(parseString(json.get("name").getAsString()));
3352    if (json.has("_name"))
3353      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3354    if (json.has("definition"))
3355      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3356  }
3357
3358  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3359    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3360    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3361    return res;
3362  }
3363
3364  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3365    parseBackboneProperties(json, res);
3366    if (json.has("endpoint")) {
3367      JsonArray array = json.getAsJsonArray("endpoint");
3368      for (int i = 0; i < array.size(); i++) {
3369        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3370      }
3371    };
3372    if (json.has("reliableCache"))
3373      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3374    if (json.has("_reliableCache"))
3375      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3376    if (json.has("documentation"))
3377      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3378    if (json.has("_documentation"))
3379      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3380    if (json.has("supportedMessage")) {
3381      JsonArray array = json.getAsJsonArray("supportedMessage");
3382      for (int i = 0; i < array.size(); i++) {
3383        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3384      }
3385    };
3386    if (json.has("event")) {
3387      JsonArray array = json.getAsJsonArray("event");
3388      for (int i = 0; i < array.size(); i++) {
3389        res.getEvent().add(parseCapabilityStatementCapabilityStatementMessagingEventComponent(array.get(i).getAsJsonObject(), owner));
3390      }
3391    };
3392  }
3393
3394  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3395    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3396    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3397    return res;
3398  }
3399
3400  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3401    parseBackboneProperties(json, res);
3402    if (json.has("protocol"))
3403      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3404    if (json.has("address"))
3405      res.setAddressElement(parseUri(json.get("address").getAsString()));
3406    if (json.has("_address"))
3407      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3408  }
3409
3410  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3411    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3412    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3413    return res;
3414  }
3415
3416  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3417    parseBackboneProperties(json, res);
3418    if (json.has("mode"))
3419      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3420    if (json.has("_mode"))
3421      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3422    if (json.has("definition"))
3423      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3424  }
3425
3426  protected CapabilityStatement.CapabilityStatementMessagingEventComponent parseCapabilityStatementCapabilityStatementMessagingEventComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3427    CapabilityStatement.CapabilityStatementMessagingEventComponent res = new CapabilityStatement.CapabilityStatementMessagingEventComponent();
3428    parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(json, owner, res);
3429    return res;
3430  }
3431
3432  protected void parseCapabilityStatementCapabilityStatementMessagingEventComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEventComponent res) throws IOException, FHIRFormatError {
3433    parseBackboneProperties(json, res);
3434    if (json.has("code"))
3435      res.setCode(parseCoding(json.getAsJsonObject("code")));
3436    if (json.has("category"))
3437      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), CapabilityStatement.MessageSignificanceCategory.NULL, new CapabilityStatement.MessageSignificanceCategoryEnumFactory()));
3438    if (json.has("_category"))
3439      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
3440    if (json.has("mode"))
3441      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3442    if (json.has("_mode"))
3443      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3444    if (json.has("focus"))
3445      res.setFocusElement(parseCode(json.get("focus").getAsString()));
3446    if (json.has("_focus"))
3447      parseElementProperties(json.getAsJsonObject("_focus"), res.getFocusElement());
3448    if (json.has("request"))
3449      res.setRequest(parseReference(json.getAsJsonObject("request")));
3450    if (json.has("response"))
3451      res.setResponse(parseReference(json.getAsJsonObject("response")));
3452    if (json.has("documentation"))
3453      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3454    if (json.has("_documentation"))
3455      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3456  }
3457
3458  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3459    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3460    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3461    return res;
3462  }
3463
3464  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3465    parseBackboneProperties(json, res);
3466    if (json.has("mode"))
3467      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3468    if (json.has("_mode"))
3469      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3470    if (json.has("documentation"))
3471      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
3472    if (json.has("_documentation"))
3473      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3474    if (json.has("profile"))
3475      res.setProfile(parseReference(json.getAsJsonObject("profile")));
3476  }
3477
3478  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3479    CarePlan res = new CarePlan();
3480    parseCarePlanProperties(json, res);
3481    return res;
3482  }
3483
3484  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3485    parseDomainResourceProperties(json, res);
3486    if (json.has("identifier")) {
3487      JsonArray array = json.getAsJsonArray("identifier");
3488      for (int i = 0; i < array.size(); i++) {
3489        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3490      }
3491    };
3492    if (json.has("definition")) {
3493      JsonArray array = json.getAsJsonArray("definition");
3494      for (int i = 0; i < array.size(); i++) {
3495        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
3496      }
3497    };
3498    if (json.has("basedOn")) {
3499      JsonArray array = json.getAsJsonArray("basedOn");
3500      for (int i = 0; i < array.size(); i++) {
3501        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
3502      }
3503    };
3504    if (json.has("replaces")) {
3505      JsonArray array = json.getAsJsonArray("replaces");
3506      for (int i = 0; i < array.size(); i++) {
3507        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
3508      }
3509    };
3510    if (json.has("partOf")) {
3511      JsonArray array = json.getAsJsonArray("partOf");
3512      for (int i = 0; i < array.size(); i++) {
3513        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3514      }
3515    };
3516    if (json.has("status"))
3517      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
3518    if (json.has("_status"))
3519      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3520    if (json.has("intent"))
3521      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
3522    if (json.has("_intent"))
3523      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
3524    if (json.has("category")) {
3525      JsonArray array = json.getAsJsonArray("category");
3526      for (int i = 0; i < array.size(); i++) {
3527        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3528      }
3529    };
3530    if (json.has("title"))
3531      res.setTitleElement(parseString(json.get("title").getAsString()));
3532    if (json.has("_title"))
3533      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3534    if (json.has("description"))
3535      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3536    if (json.has("_description"))
3537      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3538    if (json.has("subject"))
3539      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3540    if (json.has("context"))
3541      res.setContext(parseReference(json.getAsJsonObject("context")));
3542    if (json.has("period"))
3543      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3544    if (json.has("author")) {
3545      JsonArray array = json.getAsJsonArray("author");
3546      for (int i = 0; i < array.size(); i++) {
3547        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
3548      }
3549    };
3550    if (json.has("careTeam")) {
3551      JsonArray array = json.getAsJsonArray("careTeam");
3552      for (int i = 0; i < array.size(); i++) {
3553        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
3554      }
3555    };
3556    if (json.has("addresses")) {
3557      JsonArray array = json.getAsJsonArray("addresses");
3558      for (int i = 0; i < array.size(); i++) {
3559        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
3560      }
3561    };
3562    if (json.has("supportingInfo")) {
3563      JsonArray array = json.getAsJsonArray("supportingInfo");
3564      for (int i = 0; i < array.size(); i++) {
3565        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
3566      }
3567    };
3568    if (json.has("goal")) {
3569      JsonArray array = json.getAsJsonArray("goal");
3570      for (int i = 0; i < array.size(); i++) {
3571        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3572      }
3573    };
3574    if (json.has("activity")) {
3575      JsonArray array = json.getAsJsonArray("activity");
3576      for (int i = 0; i < array.size(); i++) {
3577        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
3578      }
3579    };
3580    if (json.has("note")) {
3581      JsonArray array = json.getAsJsonArray("note");
3582      for (int i = 0; i < array.size(); i++) {
3583        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3584      }
3585    };
3586  }
3587
3588  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3589    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
3590    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
3591    return res;
3592  }
3593
3594  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
3595    parseBackboneProperties(json, res);
3596    if (json.has("outcomeCodeableConcept")) {
3597      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
3598      for (int i = 0; i < array.size(); i++) {
3599        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3600      }
3601    };
3602    if (json.has("outcomeReference")) {
3603      JsonArray array = json.getAsJsonArray("outcomeReference");
3604      for (int i = 0; i < array.size(); i++) {
3605        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
3606      }
3607    };
3608    if (json.has("progress")) {
3609      JsonArray array = json.getAsJsonArray("progress");
3610      for (int i = 0; i < array.size(); i++) {
3611        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
3612      }
3613    };
3614    if (json.has("reference"))
3615      res.setReference(parseReference(json.getAsJsonObject("reference")));
3616    if (json.has("detail"))
3617      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
3618  }
3619
3620  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
3621    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
3622    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
3623    return res;
3624  }
3625
3626  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
3627    parseBackboneProperties(json, res);
3628    if (json.has("category"))
3629      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
3630    if (json.has("definition"))
3631      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
3632    if (json.has("code"))
3633      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3634    if (json.has("reasonCode")) {
3635      JsonArray array = json.getAsJsonArray("reasonCode");
3636      for (int i = 0; i < array.size(); i++) {
3637        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3638      }
3639    };
3640    if (json.has("reasonReference")) {
3641      JsonArray array = json.getAsJsonArray("reasonReference");
3642      for (int i = 0; i < array.size(); i++) {
3643        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3644      }
3645    };
3646    if (json.has("goal")) {
3647      JsonArray array = json.getAsJsonArray("goal");
3648      for (int i = 0; i < array.size(); i++) {
3649        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
3650      }
3651    };
3652    if (json.has("status"))
3653      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
3654    if (json.has("_status"))
3655      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3656    if (json.has("statusReason"))
3657      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
3658    if (json.has("_statusReason"))
3659      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
3660    if (json.has("prohibited"))
3661      res.setProhibitedElement(parseBoolean(json.get("prohibited").getAsBoolean()));
3662    if (json.has("_prohibited"))
3663      parseElementProperties(json.getAsJsonObject("_prohibited"), res.getProhibitedElement());
3664    Type scheduled = parseType("scheduled", json);
3665    if (scheduled != null)
3666      res.setScheduled(scheduled);
3667    if (json.has("location"))
3668      res.setLocation(parseReference(json.getAsJsonObject("location")));
3669    if (json.has("performer")) {
3670      JsonArray array = json.getAsJsonArray("performer");
3671      for (int i = 0; i < array.size(); i++) {
3672        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
3673      }
3674    };
3675    Type product = parseType("product", json);
3676    if (product != null)
3677      res.setProduct(product);
3678    if (json.has("dailyAmount"))
3679      res.setDailyAmount(parseSimpleQuantity(json.getAsJsonObject("dailyAmount")));
3680    if (json.has("quantity"))
3681      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
3682    if (json.has("description"))
3683      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3684    if (json.has("_description"))
3685      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3686  }
3687
3688  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
3689    CareTeam res = new CareTeam();
3690    parseCareTeamProperties(json, res);
3691    return res;
3692  }
3693
3694  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
3695    parseDomainResourceProperties(json, res);
3696    if (json.has("identifier")) {
3697      JsonArray array = json.getAsJsonArray("identifier");
3698      for (int i = 0; i < array.size(); i++) {
3699        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3700      }
3701    };
3702    if (json.has("status"))
3703      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
3704    if (json.has("_status"))
3705      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3706    if (json.has("category")) {
3707      JsonArray array = json.getAsJsonArray("category");
3708      for (int i = 0; i < array.size(); i++) {
3709        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3710      }
3711    };
3712    if (json.has("name"))
3713      res.setNameElement(parseString(json.get("name").getAsString()));
3714    if (json.has("_name"))
3715      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3716    if (json.has("subject"))
3717      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3718    if (json.has("context"))
3719      res.setContext(parseReference(json.getAsJsonObject("context")));
3720    if (json.has("period"))
3721      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3722    if (json.has("participant")) {
3723      JsonArray array = json.getAsJsonArray("participant");
3724      for (int i = 0; i < array.size(); i++) {
3725        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
3726      }
3727    };
3728    if (json.has("reasonCode")) {
3729      JsonArray array = json.getAsJsonArray("reasonCode");
3730      for (int i = 0; i < array.size(); i++) {
3731        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3732      }
3733    };
3734    if (json.has("reasonReference")) {
3735      JsonArray array = json.getAsJsonArray("reasonReference");
3736      for (int i = 0; i < array.size(); i++) {
3737        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
3738      }
3739    };
3740    if (json.has("managingOrganization")) {
3741      JsonArray array = json.getAsJsonArray("managingOrganization");
3742      for (int i = 0; i < array.size(); i++) {
3743        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
3744      }
3745    };
3746    if (json.has("note")) {
3747      JsonArray array = json.getAsJsonArray("note");
3748      for (int i = 0; i < array.size(); i++) {
3749        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3750      }
3751    };
3752  }
3753
3754  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
3755    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
3756    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
3757    return res;
3758  }
3759
3760  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
3761    parseBackboneProperties(json, res);
3762    if (json.has("role"))
3763      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
3764    if (json.has("member"))
3765      res.setMember(parseReference(json.getAsJsonObject("member")));
3766    if (json.has("onBehalfOf"))
3767      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
3768    if (json.has("period"))
3769      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
3770  }
3771
3772  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
3773    ChargeItem res = new ChargeItem();
3774    parseChargeItemProperties(json, res);
3775    return res;
3776  }
3777
3778  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
3779    parseDomainResourceProperties(json, res);
3780    if (json.has("identifier"))
3781      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3782    if (json.has("definition")) {
3783      JsonArray array = json.getAsJsonArray("definition");
3784      for (int i = 0; i < array.size(); i++) {
3785        res.getDefinition().add(parseUri(array.get(i).getAsString()));
3786      }
3787    };
3788    if (json.has("_definition")) {
3789      JsonArray array = json.getAsJsonArray("_definition");
3790      for (int i = 0; i < array.size(); i++) {
3791        if (i == res.getDefinition().size())
3792          res.getDefinition().add(parseUri(null));
3793        if (array.get(i) instanceof JsonObject) 
3794          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
3795      }
3796    };
3797    if (json.has("status"))
3798      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
3799    if (json.has("_status"))
3800      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3801    if (json.has("partOf")) {
3802      JsonArray array = json.getAsJsonArray("partOf");
3803      for (int i = 0; i < array.size(); i++) {
3804        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
3805      }
3806    };
3807    if (json.has("code"))
3808      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3809    if (json.has("subject"))
3810      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3811    if (json.has("context"))
3812      res.setContext(parseReference(json.getAsJsonObject("context")));
3813    Type occurrence = parseType("occurrence", json);
3814    if (occurrence != null)
3815      res.setOccurrence(occurrence);
3816    if (json.has("participant")) {
3817      JsonArray array = json.getAsJsonArray("participant");
3818      for (int i = 0; i < array.size(); i++) {
3819        res.getParticipant().add(parseChargeItemChargeItemParticipantComponent(array.get(i).getAsJsonObject(), res));
3820      }
3821    };
3822    if (json.has("performingOrganization"))
3823      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
3824    if (json.has("requestingOrganization"))
3825      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
3826    if (json.has("quantity"))
3827      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
3828    if (json.has("bodysite")) {
3829      JsonArray array = json.getAsJsonArray("bodysite");
3830      for (int i = 0; i < array.size(); i++) {
3831        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3832      }
3833    };
3834    if (json.has("factorOverride"))
3835      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
3836    if (json.has("_factorOverride"))
3837      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
3838    if (json.has("priceOverride"))
3839      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
3840    if (json.has("overrideReason"))
3841      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
3842    if (json.has("_overrideReason"))
3843      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
3844    if (json.has("enterer"))
3845      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
3846    if (json.has("enteredDate"))
3847      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
3848    if (json.has("_enteredDate"))
3849      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
3850    if (json.has("reason")) {
3851      JsonArray array = json.getAsJsonArray("reason");
3852      for (int i = 0; i < array.size(); i++) {
3853        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3854      }
3855    };
3856    if (json.has("service")) {
3857      JsonArray array = json.getAsJsonArray("service");
3858      for (int i = 0; i < array.size(); i++) {
3859        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
3860      }
3861    };
3862    if (json.has("account")) {
3863      JsonArray array = json.getAsJsonArray("account");
3864      for (int i = 0; i < array.size(); i++) {
3865        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
3866      }
3867    };
3868    if (json.has("note")) {
3869      JsonArray array = json.getAsJsonArray("note");
3870      for (int i = 0; i < array.size(); i++) {
3871        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
3872      }
3873    };
3874    if (json.has("supportingInformation")) {
3875      JsonArray array = json.getAsJsonArray("supportingInformation");
3876      for (int i = 0; i < array.size(); i++) {
3877        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
3878      }
3879    };
3880  }
3881
3882  protected ChargeItem.ChargeItemParticipantComponent parseChargeItemChargeItemParticipantComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
3883    ChargeItem.ChargeItemParticipantComponent res = new ChargeItem.ChargeItemParticipantComponent();
3884    parseChargeItemChargeItemParticipantComponentProperties(json, owner, res);
3885    return res;
3886  }
3887
3888  protected void parseChargeItemChargeItemParticipantComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemParticipantComponent res) throws IOException, FHIRFormatError {
3889    parseBackboneProperties(json, res);
3890    if (json.has("role"))
3891      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
3892    if (json.has("actor"))
3893      res.setActor(parseReference(json.getAsJsonObject("actor")));
3894  }
3895
3896  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
3897    Claim res = new Claim();
3898    parseClaimProperties(json, res);
3899    return res;
3900  }
3901
3902  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
3903    parseDomainResourceProperties(json, res);
3904    if (json.has("identifier")) {
3905      JsonArray array = json.getAsJsonArray("identifier");
3906      for (int i = 0; i < array.size(); i++) {
3907        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3908      }
3909    };
3910    if (json.has("status"))
3911      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
3912    if (json.has("_status"))
3913      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3914    if (json.has("type"))
3915      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
3916    if (json.has("subType")) {
3917      JsonArray array = json.getAsJsonArray("subType");
3918      for (int i = 0; i < array.size(); i++) {
3919        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3920      }
3921    };
3922    if (json.has("use"))
3923      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
3924    if (json.has("_use"))
3925      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
3926    if (json.has("patient"))
3927      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3928    if (json.has("billablePeriod"))
3929      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
3930    if (json.has("created"))
3931      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
3932    if (json.has("_created"))
3933      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3934    if (json.has("enterer"))
3935      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
3936    if (json.has("insurer"))
3937      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
3938    if (json.has("provider"))
3939      res.setProvider(parseReference(json.getAsJsonObject("provider")));
3940    if (json.has("organization"))
3941      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
3942    if (json.has("priority"))
3943      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
3944    if (json.has("fundsReserve"))
3945      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
3946    if (json.has("related")) {
3947      JsonArray array = json.getAsJsonArray("related");
3948      for (int i = 0; i < array.size(); i++) {
3949        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
3950      }
3951    };
3952    if (json.has("prescription"))
3953      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
3954    if (json.has("originalPrescription"))
3955      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
3956    if (json.has("payee"))
3957      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
3958    if (json.has("referral"))
3959      res.setReferral(parseReference(json.getAsJsonObject("referral")));
3960    if (json.has("facility"))
3961      res.setFacility(parseReference(json.getAsJsonObject("facility")));
3962    if (json.has("careTeam")) {
3963      JsonArray array = json.getAsJsonArray("careTeam");
3964      for (int i = 0; i < array.size(); i++) {
3965        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
3966      }
3967    };
3968    if (json.has("information")) {
3969      JsonArray array = json.getAsJsonArray("information");
3970      for (int i = 0; i < array.size(); i++) {
3971        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
3972      }
3973    };
3974    if (json.has("diagnosis")) {
3975      JsonArray array = json.getAsJsonArray("diagnosis");
3976      for (int i = 0; i < array.size(); i++) {
3977        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
3978      }
3979    };
3980    if (json.has("procedure")) {
3981      JsonArray array = json.getAsJsonArray("procedure");
3982      for (int i = 0; i < array.size(); i++) {
3983        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
3984      }
3985    };
3986    if (json.has("insurance")) {
3987      JsonArray array = json.getAsJsonArray("insurance");
3988      for (int i = 0; i < array.size(); i++) {
3989        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
3990      }
3991    };
3992    if (json.has("accident"))
3993      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
3994    if (json.has("employmentImpacted"))
3995      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
3996    if (json.has("hospitalization"))
3997      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
3998    if (json.has("item")) {
3999      JsonArray array = json.getAsJsonArray("item");
4000      for (int i = 0; i < array.size(); i++) {
4001        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4002      }
4003    };
4004    if (json.has("total"))
4005      res.setTotal(parseMoney(json.getAsJsonObject("total")));
4006  }
4007
4008  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4009    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4010    parseClaimRelatedClaimComponentProperties(json, owner, res);
4011    return res;
4012  }
4013
4014  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4015    parseBackboneProperties(json, res);
4016    if (json.has("claim"))
4017      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4018    if (json.has("relationship"))
4019      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4020    if (json.has("reference"))
4021      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4022  }
4023
4024  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4025    Claim.PayeeComponent res = new Claim.PayeeComponent();
4026    parseClaimPayeeComponentProperties(json, owner, res);
4027    return res;
4028  }
4029
4030  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4031    parseBackboneProperties(json, res);
4032    if (json.has("type"))
4033      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4034    if (json.has("resourceType"))
4035      res.setResourceType(parseCoding(json.getAsJsonObject("resourceType")));
4036    if (json.has("party"))
4037      res.setParty(parseReference(json.getAsJsonObject("party")));
4038  }
4039
4040  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4041    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4042    parseClaimCareTeamComponentProperties(json, owner, res);
4043    return res;
4044  }
4045
4046  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4047    parseBackboneProperties(json, res);
4048    if (json.has("sequence"))
4049      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4050    if (json.has("_sequence"))
4051      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4052    if (json.has("provider"))
4053      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4054    if (json.has("responsible"))
4055      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4056    if (json.has("_responsible"))
4057      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4058    if (json.has("role"))
4059      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4060    if (json.has("qualification"))
4061      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4062  }
4063
4064  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4065    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4066    parseClaimSpecialConditionComponentProperties(json, owner, res);
4067    return res;
4068  }
4069
4070  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4071    parseBackboneProperties(json, res);
4072    if (json.has("sequence"))
4073      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4074    if (json.has("_sequence"))
4075      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4076    if (json.has("category"))
4077      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4078    if (json.has("code"))
4079      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4080    Type timing = parseType("timing", json);
4081    if (timing != null)
4082      res.setTiming(timing);
4083    Type value = parseType("value", json);
4084    if (value != null)
4085      res.setValue(value);
4086    if (json.has("reason"))
4087      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4088  }
4089
4090  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4091    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4092    parseClaimDiagnosisComponentProperties(json, owner, res);
4093    return res;
4094  }
4095
4096  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4097    parseBackboneProperties(json, res);
4098    if (json.has("sequence"))
4099      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4100    if (json.has("_sequence"))
4101      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4102    Type diagnosis = parseType("diagnosis", json);
4103    if (diagnosis != null)
4104      res.setDiagnosis(diagnosis);
4105    if (json.has("type")) {
4106      JsonArray array = json.getAsJsonArray("type");
4107      for (int i = 0; i < array.size(); i++) {
4108        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4109      }
4110    };
4111    if (json.has("packageCode"))
4112      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4113  }
4114
4115  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4116    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4117    parseClaimProcedureComponentProperties(json, owner, res);
4118    return res;
4119  }
4120
4121  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4122    parseBackboneProperties(json, res);
4123    if (json.has("sequence"))
4124      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4125    if (json.has("_sequence"))
4126      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4127    if (json.has("date"))
4128      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4129    if (json.has("_date"))
4130      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4131    Type procedure = parseType("procedure", json);
4132    if (procedure != null)
4133      res.setProcedure(procedure);
4134  }
4135
4136  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4137    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4138    parseClaimInsuranceComponentProperties(json, owner, res);
4139    return res;
4140  }
4141
4142  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
4143    parseBackboneProperties(json, res);
4144    if (json.has("sequence"))
4145      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4146    if (json.has("_sequence"))
4147      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4148    if (json.has("focal"))
4149      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4150    if (json.has("_focal"))
4151      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
4152    if (json.has("coverage"))
4153      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
4154    if (json.has("businessArrangement"))
4155      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4156    if (json.has("_businessArrangement"))
4157      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
4158    if (json.has("preAuthRef")) {
4159      JsonArray array = json.getAsJsonArray("preAuthRef");
4160      for (int i = 0; i < array.size(); i++) {
4161        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4162      }
4163    };
4164    if (json.has("_preAuthRef")) {
4165      JsonArray array = json.getAsJsonArray("_preAuthRef");
4166      for (int i = 0; i < array.size(); i++) {
4167        if (i == res.getPreAuthRef().size())
4168          res.getPreAuthRef().add(parseString(null));
4169        if (array.get(i) instanceof JsonObject) 
4170          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4171      }
4172    };
4173    if (json.has("claimResponse"))
4174      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
4175  }
4176
4177  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4178    Claim.AccidentComponent res = new Claim.AccidentComponent();
4179    parseClaimAccidentComponentProperties(json, owner, res);
4180    return res;
4181  }
4182
4183  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
4184    parseBackboneProperties(json, res);
4185    if (json.has("date"))
4186      res.setDateElement(parseDate(json.get("date").getAsString()));
4187    if (json.has("_date"))
4188      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4189    if (json.has("type"))
4190      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4191    Type location = parseType("location", json);
4192    if (location != null)
4193      res.setLocation(location);
4194  }
4195
4196  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4197    Claim.ItemComponent res = new Claim.ItemComponent();
4198    parseClaimItemComponentProperties(json, owner, res);
4199    return res;
4200  }
4201
4202  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
4203    parseBackboneProperties(json, res);
4204    if (json.has("sequence"))
4205      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4206    if (json.has("_sequence"))
4207      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4208    if (json.has("careTeamLinkId")) {
4209      JsonArray array = json.getAsJsonArray("careTeamLinkId");
4210      for (int i = 0; i < array.size(); i++) {
4211        res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4212      }
4213    };
4214    if (json.has("_careTeamLinkId")) {
4215      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
4216      for (int i = 0; i < array.size(); i++) {
4217        if (i == res.getCareTeamLinkId().size())
4218          res.getCareTeamLinkId().add(parsePositiveInt(null));
4219        if (array.get(i) instanceof JsonObject) 
4220          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
4221      }
4222    };
4223    if (json.has("diagnosisLinkId")) {
4224      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
4225      for (int i = 0; i < array.size(); i++) {
4226        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4227      }
4228    };
4229    if (json.has("_diagnosisLinkId")) {
4230      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
4231      for (int i = 0; i < array.size(); i++) {
4232        if (i == res.getDiagnosisLinkId().size())
4233          res.getDiagnosisLinkId().add(parsePositiveInt(null));
4234        if (array.get(i) instanceof JsonObject) 
4235          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
4236      }
4237    };
4238    if (json.has("procedureLinkId")) {
4239      JsonArray array = json.getAsJsonArray("procedureLinkId");
4240      for (int i = 0; i < array.size(); i++) {
4241        res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4242      }
4243    };
4244    if (json.has("_procedureLinkId")) {
4245      JsonArray array = json.getAsJsonArray("_procedureLinkId");
4246      for (int i = 0; i < array.size(); i++) {
4247        if (i == res.getProcedureLinkId().size())
4248          res.getProcedureLinkId().add(parsePositiveInt(null));
4249        if (array.get(i) instanceof JsonObject) 
4250          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
4251      }
4252    };
4253    if (json.has("informationLinkId")) {
4254      JsonArray array = json.getAsJsonArray("informationLinkId");
4255      for (int i = 0; i < array.size(); i++) {
4256        res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4257      }
4258    };
4259    if (json.has("_informationLinkId")) {
4260      JsonArray array = json.getAsJsonArray("_informationLinkId");
4261      for (int i = 0; i < array.size(); i++) {
4262        if (i == res.getInformationLinkId().size())
4263          res.getInformationLinkId().add(parsePositiveInt(null));
4264        if (array.get(i) instanceof JsonObject) 
4265          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
4266      }
4267    };
4268    if (json.has("revenue"))
4269      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4270    if (json.has("category"))
4271      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4272    if (json.has("service"))
4273      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4274    if (json.has("modifier")) {
4275      JsonArray array = json.getAsJsonArray("modifier");
4276      for (int i = 0; i < array.size(); i++) {
4277        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4278      }
4279    };
4280    if (json.has("programCode")) {
4281      JsonArray array = json.getAsJsonArray("programCode");
4282      for (int i = 0; i < array.size(); i++) {
4283        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4284      }
4285    };
4286    Type serviced = parseType("serviced", json);
4287    if (serviced != null)
4288      res.setServiced(serviced);
4289    Type location = parseType("location", json);
4290    if (location != null)
4291      res.setLocation(location);
4292    if (json.has("quantity"))
4293      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4294    if (json.has("unitPrice"))
4295      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4296    if (json.has("factor"))
4297      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4298    if (json.has("_factor"))
4299      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4300    if (json.has("net"))
4301      res.setNet(parseMoney(json.getAsJsonObject("net")));
4302    if (json.has("udi")) {
4303      JsonArray array = json.getAsJsonArray("udi");
4304      for (int i = 0; i < array.size(); i++) {
4305        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4306      }
4307    };
4308    if (json.has("bodySite"))
4309      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
4310    if (json.has("subSite")) {
4311      JsonArray array = json.getAsJsonArray("subSite");
4312      for (int i = 0; i < array.size(); i++) {
4313        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4314      }
4315    };
4316    if (json.has("encounter")) {
4317      JsonArray array = json.getAsJsonArray("encounter");
4318      for (int i = 0; i < array.size(); i++) {
4319        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
4320      }
4321    };
4322    if (json.has("detail")) {
4323      JsonArray array = json.getAsJsonArray("detail");
4324      for (int i = 0; i < array.size(); i++) {
4325        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
4326      }
4327    };
4328  }
4329
4330  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4331    Claim.DetailComponent res = new Claim.DetailComponent();
4332    parseClaimDetailComponentProperties(json, owner, res);
4333    return res;
4334  }
4335
4336  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
4337    parseBackboneProperties(json, res);
4338    if (json.has("sequence"))
4339      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4340    if (json.has("_sequence"))
4341      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4342    if (json.has("revenue"))
4343      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4344    if (json.has("category"))
4345      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4346    if (json.has("service"))
4347      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4348    if (json.has("modifier")) {
4349      JsonArray array = json.getAsJsonArray("modifier");
4350      for (int i = 0; i < array.size(); i++) {
4351        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4352      }
4353    };
4354    if (json.has("programCode")) {
4355      JsonArray array = json.getAsJsonArray("programCode");
4356      for (int i = 0; i < array.size(); i++) {
4357        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4358      }
4359    };
4360    if (json.has("quantity"))
4361      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4362    if (json.has("unitPrice"))
4363      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4364    if (json.has("factor"))
4365      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4366    if (json.has("_factor"))
4367      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4368    if (json.has("net"))
4369      res.setNet(parseMoney(json.getAsJsonObject("net")));
4370    if (json.has("udi")) {
4371      JsonArray array = json.getAsJsonArray("udi");
4372      for (int i = 0; i < array.size(); i++) {
4373        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4374      }
4375    };
4376    if (json.has("subDetail")) {
4377      JsonArray array = json.getAsJsonArray("subDetail");
4378      for (int i = 0; i < array.size(); i++) {
4379        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4380      }
4381    };
4382  }
4383
4384  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4385    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
4386    parseClaimSubDetailComponentProperties(json, owner, res);
4387    return res;
4388  }
4389
4390  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
4391    parseBackboneProperties(json, res);
4392    if (json.has("sequence"))
4393      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4394    if (json.has("_sequence"))
4395      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4396    if (json.has("revenue"))
4397      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4398    if (json.has("category"))
4399      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4400    if (json.has("service"))
4401      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4402    if (json.has("modifier")) {
4403      JsonArray array = json.getAsJsonArray("modifier");
4404      for (int i = 0; i < array.size(); i++) {
4405        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4406      }
4407    };
4408    if (json.has("programCode")) {
4409      JsonArray array = json.getAsJsonArray("programCode");
4410      for (int i = 0; i < array.size(); i++) {
4411        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4412      }
4413    };
4414    if (json.has("quantity"))
4415      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
4416    if (json.has("unitPrice"))
4417      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
4418    if (json.has("factor"))
4419      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4420    if (json.has("_factor"))
4421      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4422    if (json.has("net"))
4423      res.setNet(parseMoney(json.getAsJsonObject("net")));
4424    if (json.has("udi")) {
4425      JsonArray array = json.getAsJsonArray("udi");
4426      for (int i = 0; i < array.size(); i++) {
4427        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
4428      }
4429    };
4430  }
4431
4432  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
4433    ClaimResponse res = new ClaimResponse();
4434    parseClaimResponseProperties(json, res);
4435    return res;
4436  }
4437
4438  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
4439    parseDomainResourceProperties(json, res);
4440    if (json.has("identifier")) {
4441      JsonArray array = json.getAsJsonArray("identifier");
4442      for (int i = 0; i < array.size(); i++) {
4443        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4444      }
4445    };
4446    if (json.has("status"))
4447      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
4448    if (json.has("_status"))
4449      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4450    if (json.has("patient"))
4451      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4452    if (json.has("created"))
4453      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4454    if (json.has("_created"))
4455      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4456    if (json.has("insurer"))
4457      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4458    if (json.has("requestProvider"))
4459      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
4460    if (json.has("requestOrganization"))
4461      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
4462    if (json.has("request"))
4463      res.setRequest(parseReference(json.getAsJsonObject("request")));
4464    if (json.has("outcome"))
4465      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
4466    if (json.has("disposition"))
4467      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
4468    if (json.has("_disposition"))
4469      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
4470    if (json.has("payeeType"))
4471      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
4472    if (json.has("item")) {
4473      JsonArray array = json.getAsJsonArray("item");
4474      for (int i = 0; i < array.size(); i++) {
4475        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
4476      }
4477    };
4478    if (json.has("addItem")) {
4479      JsonArray array = json.getAsJsonArray("addItem");
4480      for (int i = 0; i < array.size(); i++) {
4481        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
4482      }
4483    };
4484    if (json.has("error")) {
4485      JsonArray array = json.getAsJsonArray("error");
4486      for (int i = 0; i < array.size(); i++) {
4487        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
4488      }
4489    };
4490    if (json.has("totalCost"))
4491      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
4492    if (json.has("unallocDeductable"))
4493      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
4494    if (json.has("totalBenefit"))
4495      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
4496    if (json.has("payment"))
4497      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
4498    if (json.has("reserved"))
4499      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
4500    if (json.has("form"))
4501      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
4502    if (json.has("processNote")) {
4503      JsonArray array = json.getAsJsonArray("processNote");
4504      for (int i = 0; i < array.size(); i++) {
4505        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
4506      }
4507    };
4508    if (json.has("communicationRequest")) {
4509      JsonArray array = json.getAsJsonArray("communicationRequest");
4510      for (int i = 0; i < array.size(); i++) {
4511        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
4512      }
4513    };
4514    if (json.has("insurance")) {
4515      JsonArray array = json.getAsJsonArray("insurance");
4516      for (int i = 0; i < array.size(); i++) {
4517        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
4518      }
4519    };
4520  }
4521
4522  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4523    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
4524    parseClaimResponseItemComponentProperties(json, owner, res);
4525    return res;
4526  }
4527
4528  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
4529    parseBackboneProperties(json, res);
4530    if (json.has("sequenceLinkId"))
4531      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4532    if (json.has("_sequenceLinkId"))
4533      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4534    if (json.has("noteNumber")) {
4535      JsonArray array = json.getAsJsonArray("noteNumber");
4536      for (int i = 0; i < array.size(); i++) {
4537        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4538      }
4539    };
4540    if (json.has("_noteNumber")) {
4541      JsonArray array = json.getAsJsonArray("_noteNumber");
4542      for (int i = 0; i < array.size(); i++) {
4543        if (i == res.getNoteNumber().size())
4544          res.getNoteNumber().add(parsePositiveInt(null));
4545        if (array.get(i) instanceof JsonObject) 
4546          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4547      }
4548    };
4549    if (json.has("adjudication")) {
4550      JsonArray array = json.getAsJsonArray("adjudication");
4551      for (int i = 0; i < array.size(); i++) {
4552        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4553      }
4554    };
4555    if (json.has("detail")) {
4556      JsonArray array = json.getAsJsonArray("detail");
4557      for (int i = 0; i < array.size(); i++) {
4558        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
4559      }
4560    };
4561  }
4562
4563  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4564    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
4565    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
4566    return res;
4567  }
4568
4569  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
4570    parseBackboneProperties(json, res);
4571    if (json.has("category"))
4572      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4573    if (json.has("reason"))
4574      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4575    if (json.has("amount"))
4576      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4577    if (json.has("value"))
4578      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
4579    if (json.has("_value"))
4580      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
4581  }
4582
4583  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4584    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
4585    parseClaimResponseItemDetailComponentProperties(json, owner, res);
4586    return res;
4587  }
4588
4589  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
4590    parseBackboneProperties(json, res);
4591    if (json.has("sequenceLinkId"))
4592      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4593    if (json.has("_sequenceLinkId"))
4594      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4595    if (json.has("noteNumber")) {
4596      JsonArray array = json.getAsJsonArray("noteNumber");
4597      for (int i = 0; i < array.size(); i++) {
4598        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4599      }
4600    };
4601    if (json.has("_noteNumber")) {
4602      JsonArray array = json.getAsJsonArray("_noteNumber");
4603      for (int i = 0; i < array.size(); i++) {
4604        if (i == res.getNoteNumber().size())
4605          res.getNoteNumber().add(parsePositiveInt(null));
4606        if (array.get(i) instanceof JsonObject) 
4607          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4608      }
4609    };
4610    if (json.has("adjudication")) {
4611      JsonArray array = json.getAsJsonArray("adjudication");
4612      for (int i = 0; i < array.size(); i++) {
4613        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4614      }
4615    };
4616    if (json.has("subDetail")) {
4617      JsonArray array = json.getAsJsonArray("subDetail");
4618      for (int i = 0; i < array.size(); i++) {
4619        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
4620      }
4621    };
4622  }
4623
4624  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4625    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
4626    parseClaimResponseSubDetailComponentProperties(json, owner, res);
4627    return res;
4628  }
4629
4630  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
4631    parseBackboneProperties(json, res);
4632    if (json.has("sequenceLinkId"))
4633      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4634    if (json.has("_sequenceLinkId"))
4635      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4636    if (json.has("noteNumber")) {
4637      JsonArray array = json.getAsJsonArray("noteNumber");
4638      for (int i = 0; i < array.size(); i++) {
4639        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4640      }
4641    };
4642    if (json.has("_noteNumber")) {
4643      JsonArray array = json.getAsJsonArray("_noteNumber");
4644      for (int i = 0; i < array.size(); i++) {
4645        if (i == res.getNoteNumber().size())
4646          res.getNoteNumber().add(parsePositiveInt(null));
4647        if (array.get(i) instanceof JsonObject) 
4648          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4649      }
4650    };
4651    if (json.has("adjudication")) {
4652      JsonArray array = json.getAsJsonArray("adjudication");
4653      for (int i = 0; i < array.size(); i++) {
4654        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4655      }
4656    };
4657  }
4658
4659  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4660    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
4661    parseClaimResponseAddedItemComponentProperties(json, owner, res);
4662    return res;
4663  }
4664
4665  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
4666    parseBackboneProperties(json, res);
4667    if (json.has("sequenceLinkId")) {
4668      JsonArray array = json.getAsJsonArray("sequenceLinkId");
4669      for (int i = 0; i < array.size(); i++) {
4670        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
4671      }
4672    };
4673    if (json.has("_sequenceLinkId")) {
4674      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
4675      for (int i = 0; i < array.size(); i++) {
4676        if (i == res.getSequenceLinkId().size())
4677          res.getSequenceLinkId().add(parsePositiveInt(null));
4678        if (array.get(i) instanceof JsonObject) 
4679          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
4680      }
4681    };
4682    if (json.has("revenue"))
4683      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4684    if (json.has("category"))
4685      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4686    if (json.has("service"))
4687      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4688    if (json.has("modifier")) {
4689      JsonArray array = json.getAsJsonArray("modifier");
4690      for (int i = 0; i < array.size(); i++) {
4691        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4692      }
4693    };
4694    if (json.has("fee"))
4695      res.setFee(parseMoney(json.getAsJsonObject("fee")));
4696    if (json.has("noteNumber")) {
4697      JsonArray array = json.getAsJsonArray("noteNumber");
4698      for (int i = 0; i < array.size(); i++) {
4699        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4700      }
4701    };
4702    if (json.has("_noteNumber")) {
4703      JsonArray array = json.getAsJsonArray("_noteNumber");
4704      for (int i = 0; i < array.size(); i++) {
4705        if (i == res.getNoteNumber().size())
4706          res.getNoteNumber().add(parsePositiveInt(null));
4707        if (array.get(i) instanceof JsonObject) 
4708          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4709      }
4710    };
4711    if (json.has("adjudication")) {
4712      JsonArray array = json.getAsJsonArray("adjudication");
4713      for (int i = 0; i < array.size(); i++) {
4714        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4715      }
4716    };
4717    if (json.has("detail")) {
4718      JsonArray array = json.getAsJsonArray("detail");
4719      for (int i = 0; i < array.size(); i++) {
4720        res.getDetail().add(parseClaimResponseAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
4721      }
4722    };
4723  }
4724
4725  protected ClaimResponse.AddedItemsDetailComponent parseClaimResponseAddedItemsDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4726    ClaimResponse.AddedItemsDetailComponent res = new ClaimResponse.AddedItemsDetailComponent();
4727    parseClaimResponseAddedItemsDetailComponentProperties(json, owner, res);
4728    return res;
4729  }
4730
4731  protected void parseClaimResponseAddedItemsDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
4732    parseBackboneProperties(json, res);
4733    if (json.has("revenue"))
4734      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
4735    if (json.has("category"))
4736      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4737    if (json.has("service"))
4738      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
4739    if (json.has("modifier")) {
4740      JsonArray array = json.getAsJsonArray("modifier");
4741      for (int i = 0; i < array.size(); i++) {
4742        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4743      }
4744    };
4745    if (json.has("fee"))
4746      res.setFee(parseMoney(json.getAsJsonObject("fee")));
4747    if (json.has("noteNumber")) {
4748      JsonArray array = json.getAsJsonArray("noteNumber");
4749      for (int i = 0; i < array.size(); i++) {
4750        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
4751      }
4752    };
4753    if (json.has("_noteNumber")) {
4754      JsonArray array = json.getAsJsonArray("_noteNumber");
4755      for (int i = 0; i < array.size(); i++) {
4756        if (i == res.getNoteNumber().size())
4757          res.getNoteNumber().add(parsePositiveInt(null));
4758        if (array.get(i) instanceof JsonObject) 
4759          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
4760      }
4761    };
4762    if (json.has("adjudication")) {
4763      JsonArray array = json.getAsJsonArray("adjudication");
4764      for (int i = 0; i < array.size(); i++) {
4765        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
4766      }
4767    };
4768  }
4769
4770  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4771    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
4772    parseClaimResponseErrorComponentProperties(json, owner, res);
4773    return res;
4774  }
4775
4776  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
4777    parseBackboneProperties(json, res);
4778    if (json.has("sequenceLinkId"))
4779      res.setSequenceLinkIdElement(parsePositiveInt(json.get("sequenceLinkId").getAsString()));
4780    if (json.has("_sequenceLinkId"))
4781      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
4782    if (json.has("detailSequenceLinkId"))
4783      res.setDetailSequenceLinkIdElement(parsePositiveInt(json.get("detailSequenceLinkId").getAsString()));
4784    if (json.has("_detailSequenceLinkId"))
4785      parseElementProperties(json.getAsJsonObject("_detailSequenceLinkId"), res.getDetailSequenceLinkIdElement());
4786    if (json.has("subdetailSequenceLinkId"))
4787      res.setSubdetailSequenceLinkIdElement(parsePositiveInt(json.get("subdetailSequenceLinkId").getAsString()));
4788    if (json.has("_subdetailSequenceLinkId"))
4789      parseElementProperties(json.getAsJsonObject("_subdetailSequenceLinkId"), res.getSubdetailSequenceLinkIdElement());
4790    if (json.has("code"))
4791      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4792  }
4793
4794  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4795    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
4796    parseClaimResponsePaymentComponentProperties(json, owner, res);
4797    return res;
4798  }
4799
4800  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
4801    parseBackboneProperties(json, res);
4802    if (json.has("type"))
4803      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4804    if (json.has("adjustment"))
4805      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
4806    if (json.has("adjustmentReason"))
4807      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
4808    if (json.has("date"))
4809      res.setDateElement(parseDate(json.get("date").getAsString()));
4810    if (json.has("_date"))
4811      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4812    if (json.has("amount"))
4813      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4814    if (json.has("identifier"))
4815      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
4816  }
4817
4818  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4819    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
4820    parseClaimResponseNoteComponentProperties(json, owner, res);
4821    return res;
4822  }
4823
4824  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
4825    parseBackboneProperties(json, res);
4826    if (json.has("number"))
4827      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
4828    if (json.has("_number"))
4829      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
4830    if (json.has("type"))
4831      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4832    if (json.has("text"))
4833      res.setTextElement(parseString(json.get("text").getAsString()));
4834    if (json.has("_text"))
4835      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
4836    if (json.has("language"))
4837      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
4838  }
4839
4840  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
4841    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
4842    parseClaimResponseInsuranceComponentProperties(json, owner, res);
4843    return res;
4844  }
4845
4846  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
4847    parseBackboneProperties(json, res);
4848    if (json.has("sequence"))
4849      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4850    if (json.has("_sequence"))
4851      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4852    if (json.has("focal"))
4853      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
4854    if (json.has("_focal"))
4855      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
4856    if (json.has("coverage"))
4857      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
4858    if (json.has("businessArrangement"))
4859      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
4860    if (json.has("_businessArrangement"))
4861      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
4862    if (json.has("preAuthRef")) {
4863      JsonArray array = json.getAsJsonArray("preAuthRef");
4864      for (int i = 0; i < array.size(); i++) {
4865        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
4866      }
4867    };
4868    if (json.has("_preAuthRef")) {
4869      JsonArray array = json.getAsJsonArray("_preAuthRef");
4870      for (int i = 0; i < array.size(); i++) {
4871        if (i == res.getPreAuthRef().size())
4872          res.getPreAuthRef().add(parseString(null));
4873        if (array.get(i) instanceof JsonObject) 
4874          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
4875      }
4876    };
4877    if (json.has("claimResponse"))
4878      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
4879  }
4880
4881  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
4882    ClinicalImpression res = new ClinicalImpression();
4883    parseClinicalImpressionProperties(json, res);
4884    return res;
4885  }
4886
4887  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
4888    parseDomainResourceProperties(json, res);
4889    if (json.has("identifier")) {
4890      JsonArray array = json.getAsJsonArray("identifier");
4891      for (int i = 0; i < array.size(); i++) {
4892        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4893      }
4894    };
4895    if (json.has("status"))
4896      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
4897    if (json.has("_status"))
4898      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4899    if (json.has("code"))
4900      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4901    if (json.has("description"))
4902      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4903    if (json.has("_description"))
4904      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4905    if (json.has("subject"))
4906      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4907    if (json.has("context"))
4908      res.setContext(parseReference(json.getAsJsonObject("context")));
4909    Type effective = parseType("effective", json);
4910    if (effective != null)
4911      res.setEffective(effective);
4912    if (json.has("date"))
4913      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4914    if (json.has("_date"))
4915      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4916    if (json.has("assessor"))
4917      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
4918    if (json.has("previous"))
4919      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
4920    if (json.has("problem")) {
4921      JsonArray array = json.getAsJsonArray("problem");
4922      for (int i = 0; i < array.size(); i++) {
4923        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
4924      }
4925    };
4926    if (json.has("investigation")) {
4927      JsonArray array = json.getAsJsonArray("investigation");
4928      for (int i = 0; i < array.size(); i++) {
4929        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
4930      }
4931    };
4932    if (json.has("protocol")) {
4933      JsonArray array = json.getAsJsonArray("protocol");
4934      for (int i = 0; i < array.size(); i++) {
4935        res.getProtocol().add(parseUri(array.get(i).getAsString()));
4936      }
4937    };
4938    if (json.has("_protocol")) {
4939      JsonArray array = json.getAsJsonArray("_protocol");
4940      for (int i = 0; i < array.size(); i++) {
4941        if (i == res.getProtocol().size())
4942          res.getProtocol().add(parseUri(null));
4943        if (array.get(i) instanceof JsonObject) 
4944          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
4945      }
4946    };
4947    if (json.has("summary"))
4948      res.setSummaryElement(parseString(json.get("summary").getAsString()));
4949    if (json.has("_summary"))
4950      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
4951    if (json.has("finding")) {
4952      JsonArray array = json.getAsJsonArray("finding");
4953      for (int i = 0; i < array.size(); i++) {
4954        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
4955      }
4956    };
4957    if (json.has("prognosisCodeableConcept")) {
4958      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
4959      for (int i = 0; i < array.size(); i++) {
4960        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4961      }
4962    };
4963    if (json.has("prognosisReference")) {
4964      JsonArray array = json.getAsJsonArray("prognosisReference");
4965      for (int i = 0; i < array.size(); i++) {
4966        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
4967      }
4968    };
4969    if (json.has("action")) {
4970      JsonArray array = json.getAsJsonArray("action");
4971      for (int i = 0; i < array.size(); i++) {
4972        res.getAction().add(parseReference(array.get(i).getAsJsonObject()));
4973      }
4974    };
4975    if (json.has("note")) {
4976      JsonArray array = json.getAsJsonArray("note");
4977      for (int i = 0; i < array.size(); i++) {
4978        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4979      }
4980    };
4981  }
4982
4983  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
4984    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
4985    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
4986    return res;
4987  }
4988
4989  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
4990    parseBackboneProperties(json, res);
4991    if (json.has("code"))
4992      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4993    if (json.has("item")) {
4994      JsonArray array = json.getAsJsonArray("item");
4995      for (int i = 0; i < array.size(); i++) {
4996        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
4997      }
4998    };
4999  }
5000
5001  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5002    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
5003    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
5004    return res;
5005  }
5006
5007  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
5008    parseBackboneProperties(json, res);
5009    Type item = parseType("item", json);
5010    if (item != null)
5011      res.setItem(item);
5012    if (json.has("basis"))
5013      res.setBasisElement(parseString(json.get("basis").getAsString()));
5014    if (json.has("_basis"))
5015      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
5016  }
5017
5018  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
5019    CodeSystem res = new CodeSystem();
5020    parseCodeSystemProperties(json, res);
5021    return res;
5022  }
5023
5024  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
5025    parseDomainResourceProperties(json, res);
5026    if (json.has("url"))
5027      res.setUrlElement(parseUri(json.get("url").getAsString()));
5028    if (json.has("_url"))
5029      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5030    if (json.has("identifier"))
5031      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5032    if (json.has("version"))
5033      res.setVersionElement(parseString(json.get("version").getAsString()));
5034    if (json.has("_version"))
5035      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5036    if (json.has("name"))
5037      res.setNameElement(parseString(json.get("name").getAsString()));
5038    if (json.has("_name"))
5039      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5040    if (json.has("title"))
5041      res.setTitleElement(parseString(json.get("title").getAsString()));
5042    if (json.has("_title"))
5043      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5044    if (json.has("status"))
5045      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5046    if (json.has("_status"))
5047      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5048    if (json.has("experimental"))
5049      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5050    if (json.has("_experimental"))
5051      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5052    if (json.has("date"))
5053      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5054    if (json.has("_date"))
5055      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5056    if (json.has("publisher"))
5057      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5058    if (json.has("_publisher"))
5059      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5060    if (json.has("contact")) {
5061      JsonArray array = json.getAsJsonArray("contact");
5062      for (int i = 0; i < array.size(); i++) {
5063        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5064      }
5065    };
5066    if (json.has("description"))
5067      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5068    if (json.has("_description"))
5069      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5070    if (json.has("useContext")) {
5071      JsonArray array = json.getAsJsonArray("useContext");
5072      for (int i = 0; i < array.size(); i++) {
5073        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5074      }
5075    };
5076    if (json.has("jurisdiction")) {
5077      JsonArray array = json.getAsJsonArray("jurisdiction");
5078      for (int i = 0; i < array.size(); i++) {
5079        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5080      }
5081    };
5082    if (json.has("purpose"))
5083      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5084    if (json.has("_purpose"))
5085      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5086    if (json.has("copyright"))
5087      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5088    if (json.has("_copyright"))
5089      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5090    if (json.has("caseSensitive"))
5091      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
5092    if (json.has("_caseSensitive"))
5093      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
5094    if (json.has("valueSet"))
5095      res.setValueSetElement(parseUri(json.get("valueSet").getAsString()));
5096    if (json.has("_valueSet"))
5097      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
5098    if (json.has("hierarchyMeaning"))
5099      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
5100    if (json.has("_hierarchyMeaning"))
5101      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
5102    if (json.has("compositional"))
5103      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
5104    if (json.has("_compositional"))
5105      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
5106    if (json.has("versionNeeded"))
5107      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
5108    if (json.has("_versionNeeded"))
5109      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
5110    if (json.has("content"))
5111      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
5112    if (json.has("_content"))
5113      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
5114    if (json.has("count"))
5115      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
5116    if (json.has("_count"))
5117      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
5118    if (json.has("filter")) {
5119      JsonArray array = json.getAsJsonArray("filter");
5120      for (int i = 0; i < array.size(); i++) {
5121        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
5122      }
5123    };
5124    if (json.has("property")) {
5125      JsonArray array = json.getAsJsonArray("property");
5126      for (int i = 0; i < array.size(); i++) {
5127        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
5128      }
5129    };
5130    if (json.has("concept")) {
5131      JsonArray array = json.getAsJsonArray("concept");
5132      for (int i = 0; i < array.size(); i++) {
5133        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
5134      }
5135    };
5136  }
5137
5138  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5139    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
5140    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
5141    return res;
5142  }
5143
5144  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
5145    parseBackboneProperties(json, res);
5146    if (json.has("code"))
5147      res.setCodeElement(parseCode(json.get("code").getAsString()));
5148    if (json.has("_code"))
5149      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5150    if (json.has("description"))
5151      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5152    if (json.has("_description"))
5153      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5154    if (json.has("operator")) {
5155      JsonArray array = json.getAsJsonArray("operator");
5156      for (int i = 0; i < array.size(); i++) {
5157        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5158      }
5159    };
5160    if (json.has("_operator")) {
5161      JsonArray array = json.getAsJsonArray("_operator");
5162      for (int i = 0; i < array.size(); i++) {
5163        if (i == res.getOperator().size())
5164          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
5165        if (array.get(i) instanceof JsonObject) 
5166          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
5167      }
5168    };
5169    if (json.has("value"))
5170      res.setValueElement(parseString(json.get("value").getAsString()));
5171    if (json.has("_value"))
5172      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5173  }
5174
5175  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5176    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
5177    parseCodeSystemPropertyComponentProperties(json, owner, res);
5178    return res;
5179  }
5180
5181  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
5182    parseBackboneProperties(json, res);
5183    if (json.has("code"))
5184      res.setCodeElement(parseCode(json.get("code").getAsString()));
5185    if (json.has("_code"))
5186      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5187    if (json.has("uri"))
5188      res.setUriElement(parseUri(json.get("uri").getAsString()));
5189    if (json.has("_uri"))
5190      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
5191    if (json.has("description"))
5192      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5193    if (json.has("_description"))
5194      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5195    if (json.has("type"))
5196      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
5197    if (json.has("_type"))
5198      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5199  }
5200
5201  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5202    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
5203    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
5204    return res;
5205  }
5206
5207  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
5208    parseBackboneProperties(json, res);
5209    if (json.has("code"))
5210      res.setCodeElement(parseCode(json.get("code").getAsString()));
5211    if (json.has("_code"))
5212      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5213    if (json.has("display"))
5214      res.setDisplayElement(parseString(json.get("display").getAsString()));
5215    if (json.has("_display"))
5216      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5217    if (json.has("definition"))
5218      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
5219    if (json.has("_definition"))
5220      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
5221    if (json.has("designation")) {
5222      JsonArray array = json.getAsJsonArray("designation");
5223      for (int i = 0; i < array.size(); i++) {
5224        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
5225      }
5226    };
5227    if (json.has("property")) {
5228      JsonArray array = json.getAsJsonArray("property");
5229      for (int i = 0; i < array.size(); i++) {
5230        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
5231      }
5232    };
5233    if (json.has("concept")) {
5234      JsonArray array = json.getAsJsonArray("concept");
5235      for (int i = 0; i < array.size(); i++) {
5236        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
5237      }
5238    };
5239  }
5240
5241  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5242    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
5243    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
5244    return res;
5245  }
5246
5247  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
5248    parseBackboneProperties(json, res);
5249    if (json.has("language"))
5250      res.setLanguageElement(parseCode(json.get("language").getAsString()));
5251    if (json.has("_language"))
5252      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
5253    if (json.has("use"))
5254      res.setUse(parseCoding(json.getAsJsonObject("use")));
5255    if (json.has("value"))
5256      res.setValueElement(parseString(json.get("value").getAsString()));
5257    if (json.has("_value"))
5258      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5259  }
5260
5261  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
5262    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
5263    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
5264    return res;
5265  }
5266
5267  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
5268    parseBackboneProperties(json, res);
5269    if (json.has("code"))
5270      res.setCodeElement(parseCode(json.get("code").getAsString()));
5271    if (json.has("_code"))
5272      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5273    Type value = parseType("value", json);
5274    if (value != null)
5275      res.setValue(value);
5276  }
5277
5278  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
5279    Communication res = new Communication();
5280    parseCommunicationProperties(json, res);
5281    return res;
5282  }
5283
5284  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
5285    parseDomainResourceProperties(json, res);
5286    if (json.has("identifier")) {
5287      JsonArray array = json.getAsJsonArray("identifier");
5288      for (int i = 0; i < array.size(); i++) {
5289        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5290      }
5291    };
5292    if (json.has("definition")) {
5293      JsonArray array = json.getAsJsonArray("definition");
5294      for (int i = 0; i < array.size(); i++) {
5295        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
5296      }
5297    };
5298    if (json.has("basedOn")) {
5299      JsonArray array = json.getAsJsonArray("basedOn");
5300      for (int i = 0; i < array.size(); i++) {
5301        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5302      }
5303    };
5304    if (json.has("partOf")) {
5305      JsonArray array = json.getAsJsonArray("partOf");
5306      for (int i = 0; i < array.size(); i++) {
5307        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
5308      }
5309    };
5310    if (json.has("status"))
5311      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
5312    if (json.has("_status"))
5313      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5314    if (json.has("notDone"))
5315      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
5316    if (json.has("_notDone"))
5317      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
5318    if (json.has("notDoneReason"))
5319      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
5320    if (json.has("category")) {
5321      JsonArray array = json.getAsJsonArray("category");
5322      for (int i = 0; i < array.size(); i++) {
5323        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5324      }
5325    };
5326    if (json.has("medium")) {
5327      JsonArray array = json.getAsJsonArray("medium");
5328      for (int i = 0; i < array.size(); i++) {
5329        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5330      }
5331    };
5332    if (json.has("subject"))
5333      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5334    if (json.has("recipient")) {
5335      JsonArray array = json.getAsJsonArray("recipient");
5336      for (int i = 0; i < array.size(); i++) {
5337        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5338      }
5339    };
5340    if (json.has("topic")) {
5341      JsonArray array = json.getAsJsonArray("topic");
5342      for (int i = 0; i < array.size(); i++) {
5343        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5344      }
5345    };
5346    if (json.has("context"))
5347      res.setContext(parseReference(json.getAsJsonObject("context")));
5348    if (json.has("sent"))
5349      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
5350    if (json.has("_sent"))
5351      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
5352    if (json.has("received"))
5353      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
5354    if (json.has("_received"))
5355      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
5356    if (json.has("sender"))
5357      res.setSender(parseReference(json.getAsJsonObject("sender")));
5358    if (json.has("reasonCode")) {
5359      JsonArray array = json.getAsJsonArray("reasonCode");
5360      for (int i = 0; i < array.size(); i++) {
5361        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5362      }
5363    };
5364    if (json.has("reasonReference")) {
5365      JsonArray array = json.getAsJsonArray("reasonReference");
5366      for (int i = 0; i < array.size(); i++) {
5367        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5368      }
5369    };
5370    if (json.has("payload")) {
5371      JsonArray array = json.getAsJsonArray("payload");
5372      for (int i = 0; i < array.size(); i++) {
5373        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
5374      }
5375    };
5376    if (json.has("note")) {
5377      JsonArray array = json.getAsJsonArray("note");
5378      for (int i = 0; i < array.size(); i++) {
5379        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5380      }
5381    };
5382  }
5383
5384  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
5385    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
5386    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
5387    return res;
5388  }
5389
5390  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
5391    parseBackboneProperties(json, res);
5392    Type content = parseType("content", json);
5393    if (content != null)
5394      res.setContent(content);
5395  }
5396
5397  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
5398    CommunicationRequest res = new CommunicationRequest();
5399    parseCommunicationRequestProperties(json, res);
5400    return res;
5401  }
5402
5403  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
5404    parseDomainResourceProperties(json, res);
5405    if (json.has("identifier")) {
5406      JsonArray array = json.getAsJsonArray("identifier");
5407      for (int i = 0; i < array.size(); i++) {
5408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5409      }
5410    };
5411    if (json.has("basedOn")) {
5412      JsonArray array = json.getAsJsonArray("basedOn");
5413      for (int i = 0; i < array.size(); i++) {
5414        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
5415      }
5416    };
5417    if (json.has("replaces")) {
5418      JsonArray array = json.getAsJsonArray("replaces");
5419      for (int i = 0; i < array.size(); i++) {
5420        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
5421      }
5422    };
5423    if (json.has("groupIdentifier"))
5424      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
5425    if (json.has("status"))
5426      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
5427    if (json.has("_status"))
5428      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5429    if (json.has("category")) {
5430      JsonArray array = json.getAsJsonArray("category");
5431      for (int i = 0; i < array.size(); i++) {
5432        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5433      }
5434    };
5435    if (json.has("priority"))
5436      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
5437    if (json.has("_priority"))
5438      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
5439    if (json.has("medium")) {
5440      JsonArray array = json.getAsJsonArray("medium");
5441      for (int i = 0; i < array.size(); i++) {
5442        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5443      }
5444    };
5445    if (json.has("subject"))
5446      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5447    if (json.has("recipient")) {
5448      JsonArray array = json.getAsJsonArray("recipient");
5449      for (int i = 0; i < array.size(); i++) {
5450        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
5451      }
5452    };
5453    if (json.has("topic")) {
5454      JsonArray array = json.getAsJsonArray("topic");
5455      for (int i = 0; i < array.size(); i++) {
5456        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
5457      }
5458    };
5459    if (json.has("context"))
5460      res.setContext(parseReference(json.getAsJsonObject("context")));
5461    if (json.has("payload")) {
5462      JsonArray array = json.getAsJsonArray("payload");
5463      for (int i = 0; i < array.size(); i++) {
5464        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
5465      }
5466    };
5467    Type occurrence = parseType("occurrence", json);
5468    if (occurrence != null)
5469      res.setOccurrence(occurrence);
5470    if (json.has("authoredOn"))
5471      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
5472    if (json.has("_authoredOn"))
5473      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
5474    if (json.has("sender"))
5475      res.setSender(parseReference(json.getAsJsonObject("sender")));
5476    if (json.has("requester"))
5477      res.setRequester(parseCommunicationRequestCommunicationRequestRequesterComponent(json.getAsJsonObject("requester"), res));
5478    if (json.has("reasonCode")) {
5479      JsonArray array = json.getAsJsonArray("reasonCode");
5480      for (int i = 0; i < array.size(); i++) {
5481        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5482      }
5483    };
5484    if (json.has("reasonReference")) {
5485      JsonArray array = json.getAsJsonArray("reasonReference");
5486      for (int i = 0; i < array.size(); i++) {
5487        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
5488      }
5489    };
5490    if (json.has("note")) {
5491      JsonArray array = json.getAsJsonArray("note");
5492      for (int i = 0; i < array.size(); i++) {
5493        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5494      }
5495    };
5496  }
5497
5498  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5499    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
5500    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
5501    return res;
5502  }
5503
5504  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
5505    parseBackboneProperties(json, res);
5506    Type content = parseType("content", json);
5507    if (content != null)
5508      res.setContent(content);
5509  }
5510
5511  protected CommunicationRequest.CommunicationRequestRequesterComponent parseCommunicationRequestCommunicationRequestRequesterComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
5512    CommunicationRequest.CommunicationRequestRequesterComponent res = new CommunicationRequest.CommunicationRequestRequesterComponent();
5513    parseCommunicationRequestCommunicationRequestRequesterComponentProperties(json, owner, res);
5514    return res;
5515  }
5516
5517  protected void parseCommunicationRequestCommunicationRequestRequesterComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
5518    parseBackboneProperties(json, res);
5519    if (json.has("agent"))
5520      res.setAgent(parseReference(json.getAsJsonObject("agent")));
5521    if (json.has("onBehalfOf"))
5522      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
5523  }
5524
5525  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
5526    CompartmentDefinition res = new CompartmentDefinition();
5527    parseCompartmentDefinitionProperties(json, res);
5528    return res;
5529  }
5530
5531  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
5532    parseDomainResourceProperties(json, res);
5533    if (json.has("url"))
5534      res.setUrlElement(parseUri(json.get("url").getAsString()));
5535    if (json.has("_url"))
5536      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5537    if (json.has("name"))
5538      res.setNameElement(parseString(json.get("name").getAsString()));
5539    if (json.has("_name"))
5540      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5541    if (json.has("title"))
5542      res.setTitleElement(parseString(json.get("title").getAsString()));
5543    if (json.has("_title"))
5544      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5545    if (json.has("status"))
5546      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5547    if (json.has("_status"))
5548      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5549    if (json.has("experimental"))
5550      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5551    if (json.has("_experimental"))
5552      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5553    if (json.has("date"))
5554      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5555    if (json.has("_date"))
5556      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5557    if (json.has("publisher"))
5558      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5559    if (json.has("_publisher"))
5560      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5561    if (json.has("contact")) {
5562      JsonArray array = json.getAsJsonArray("contact");
5563      for (int i = 0; i < array.size(); i++) {
5564        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5565      }
5566    };
5567    if (json.has("description"))
5568      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5569    if (json.has("_description"))
5570      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5571    if (json.has("purpose"))
5572      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5573    if (json.has("_purpose"))
5574      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5575    if (json.has("useContext")) {
5576      JsonArray array = json.getAsJsonArray("useContext");
5577      for (int i = 0; i < array.size(); i++) {
5578        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5579      }
5580    };
5581    if (json.has("jurisdiction")) {
5582      JsonArray array = json.getAsJsonArray("jurisdiction");
5583      for (int i = 0; i < array.size(); i++) {
5584        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5585      }
5586    };
5587    if (json.has("code"))
5588      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
5589    if (json.has("_code"))
5590      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5591    if (json.has("search"))
5592      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
5593    if (json.has("_search"))
5594      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
5595    if (json.has("resource")) {
5596      JsonArray array = json.getAsJsonArray("resource");
5597      for (int i = 0; i < array.size(); i++) {
5598        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
5599      }
5600    };
5601  }
5602
5603  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
5604    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
5605    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
5606    return res;
5607  }
5608
5609  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
5610    parseBackboneProperties(json, res);
5611    if (json.has("code"))
5612      res.setCodeElement(parseCode(json.get("code").getAsString()));
5613    if (json.has("_code"))
5614      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5615    if (json.has("param")) {
5616      JsonArray array = json.getAsJsonArray("param");
5617      for (int i = 0; i < array.size(); i++) {
5618        res.getParam().add(parseString(array.get(i).getAsString()));
5619      }
5620    };
5621    if (json.has("_param")) {
5622      JsonArray array = json.getAsJsonArray("_param");
5623      for (int i = 0; i < array.size(); i++) {
5624        if (i == res.getParam().size())
5625          res.getParam().add(parseString(null));
5626        if (array.get(i) instanceof JsonObject) 
5627          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
5628      }
5629    };
5630    if (json.has("documentation"))
5631      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
5632    if (json.has("_documentation"))
5633      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
5634  }
5635
5636  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
5637    Composition res = new Composition();
5638    parseCompositionProperties(json, res);
5639    return res;
5640  }
5641
5642  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
5643    parseDomainResourceProperties(json, res);
5644    if (json.has("identifier"))
5645      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5646    if (json.has("status"))
5647      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
5648    if (json.has("_status"))
5649      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5650    if (json.has("type"))
5651      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5652    if (json.has("class"))
5653      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
5654    if (json.has("subject"))
5655      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5656    if (json.has("encounter"))
5657      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
5658    if (json.has("date"))
5659      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5660    if (json.has("_date"))
5661      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5662    if (json.has("author")) {
5663      JsonArray array = json.getAsJsonArray("author");
5664      for (int i = 0; i < array.size(); i++) {
5665        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
5666      }
5667    };
5668    if (json.has("title"))
5669      res.setTitleElement(parseString(json.get("title").getAsString()));
5670    if (json.has("_title"))
5671      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5672    if (json.has("confidentiality"))
5673      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
5674    if (json.has("_confidentiality"))
5675      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
5676    if (json.has("attester")) {
5677      JsonArray array = json.getAsJsonArray("attester");
5678      for (int i = 0; i < array.size(); i++) {
5679        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
5680      }
5681    };
5682    if (json.has("custodian"))
5683      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
5684    if (json.has("relatesTo")) {
5685      JsonArray array = json.getAsJsonArray("relatesTo");
5686      for (int i = 0; i < array.size(); i++) {
5687        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
5688      }
5689    };
5690    if (json.has("event")) {
5691      JsonArray array = json.getAsJsonArray("event");
5692      for (int i = 0; i < array.size(); i++) {
5693        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
5694      }
5695    };
5696    if (json.has("section")) {
5697      JsonArray array = json.getAsJsonArray("section");
5698      for (int i = 0; i < array.size(); i++) {
5699        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
5700      }
5701    };
5702  }
5703
5704  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5705    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
5706    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
5707    return res;
5708  }
5709
5710  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
5711    parseBackboneProperties(json, res);
5712    if (json.has("mode")) {
5713      JsonArray array = json.getAsJsonArray("mode");
5714      for (int i = 0; i < array.size(); i++) {
5715        res.getMode().add(parseEnumeration(array.get(i).getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5716      }
5717    };
5718    if (json.has("_mode")) {
5719      JsonArray array = json.getAsJsonArray("_mode");
5720      for (int i = 0; i < array.size(); i++) {
5721        if (i == res.getMode().size())
5722          res.getMode().add(parseEnumeration(null, Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
5723        if (array.get(i) instanceof JsonObject) 
5724          parseElementProperties(array.get(i).getAsJsonObject(), res.getMode().get(i));
5725      }
5726    };
5727    if (json.has("time"))
5728      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
5729    if (json.has("_time"))
5730      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
5731    if (json.has("party"))
5732      res.setParty(parseReference(json.getAsJsonObject("party")));
5733  }
5734
5735  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5736    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
5737    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
5738    return res;
5739  }
5740
5741  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
5742    parseBackboneProperties(json, res);
5743    if (json.has("code"))
5744      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
5745    if (json.has("_code"))
5746      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5747    Type target = parseType("target", json);
5748    if (target != null)
5749      res.setTarget(target);
5750  }
5751
5752  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5753    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
5754    parseCompositionCompositionEventComponentProperties(json, owner, res);
5755    return res;
5756  }
5757
5758  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
5759    parseBackboneProperties(json, res);
5760    if (json.has("code")) {
5761      JsonArray array = json.getAsJsonArray("code");
5762      for (int i = 0; i < array.size(); i++) {
5763        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5764      }
5765    };
5766    if (json.has("period"))
5767      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
5768    if (json.has("detail")) {
5769      JsonArray array = json.getAsJsonArray("detail");
5770      for (int i = 0; i < array.size(); i++) {
5771        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
5772      }
5773    };
5774  }
5775
5776  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
5777    Composition.SectionComponent res = new Composition.SectionComponent();
5778    parseCompositionSectionComponentProperties(json, owner, res);
5779    return res;
5780  }
5781
5782  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
5783    parseBackboneProperties(json, res);
5784    if (json.has("title"))
5785      res.setTitleElement(parseString(json.get("title").getAsString()));
5786    if (json.has("_title"))
5787      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5788    if (json.has("code"))
5789      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5790    if (json.has("text"))
5791      res.setText(parseNarrative(json.getAsJsonObject("text")));
5792    if (json.has("mode"))
5793      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
5794    if (json.has("_mode"))
5795      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
5796    if (json.has("orderedBy"))
5797      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
5798    if (json.has("entry")) {
5799      JsonArray array = json.getAsJsonArray("entry");
5800      for (int i = 0; i < array.size(); i++) {
5801        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
5802      }
5803    };
5804    if (json.has("emptyReason"))
5805      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
5806    if (json.has("section")) {
5807      JsonArray array = json.getAsJsonArray("section");
5808      for (int i = 0; i < array.size(); i++) {
5809        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
5810      }
5811    };
5812  }
5813
5814  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
5815    ConceptMap res = new ConceptMap();
5816    parseConceptMapProperties(json, res);
5817    return res;
5818  }
5819
5820  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
5821    parseDomainResourceProperties(json, res);
5822    if (json.has("url"))
5823      res.setUrlElement(parseUri(json.get("url").getAsString()));
5824    if (json.has("_url"))
5825      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
5826    if (json.has("identifier"))
5827      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5828    if (json.has("version"))
5829      res.setVersionElement(parseString(json.get("version").getAsString()));
5830    if (json.has("_version"))
5831      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
5832    if (json.has("name"))
5833      res.setNameElement(parseString(json.get("name").getAsString()));
5834    if (json.has("_name"))
5835      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
5836    if (json.has("title"))
5837      res.setTitleElement(parseString(json.get("title").getAsString()));
5838    if (json.has("_title"))
5839      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
5840    if (json.has("status"))
5841      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5842    if (json.has("_status"))
5843      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5844    if (json.has("experimental"))
5845      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
5846    if (json.has("_experimental"))
5847      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
5848    if (json.has("date"))
5849      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5850    if (json.has("_date"))
5851      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5852    if (json.has("publisher"))
5853      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
5854    if (json.has("_publisher"))
5855      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
5856    if (json.has("contact")) {
5857      JsonArray array = json.getAsJsonArray("contact");
5858      for (int i = 0; i < array.size(); i++) {
5859        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
5860      }
5861    };
5862    if (json.has("description"))
5863      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
5864    if (json.has("_description"))
5865      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5866    if (json.has("useContext")) {
5867      JsonArray array = json.getAsJsonArray("useContext");
5868      for (int i = 0; i < array.size(); i++) {
5869        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
5870      }
5871    };
5872    if (json.has("jurisdiction")) {
5873      JsonArray array = json.getAsJsonArray("jurisdiction");
5874      for (int i = 0; i < array.size(); i++) {
5875        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5876      }
5877    };
5878    if (json.has("purpose"))
5879      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
5880    if (json.has("_purpose"))
5881      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
5882    if (json.has("copyright"))
5883      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
5884    if (json.has("_copyright"))
5885      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
5886    Type source = parseType("source", json);
5887    if (source != null)
5888      res.setSource(source);
5889    Type target = parseType("target", json);
5890    if (target != null)
5891      res.setTarget(target);
5892    if (json.has("group")) {
5893      JsonArray array = json.getAsJsonArray("group");
5894      for (int i = 0; i < array.size(); i++) {
5895        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
5896      }
5897    };
5898  }
5899
5900  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5901    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
5902    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
5903    return res;
5904  }
5905
5906  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
5907    parseBackboneProperties(json, res);
5908    if (json.has("source"))
5909      res.setSourceElement(parseUri(json.get("source").getAsString()));
5910    if (json.has("_source"))
5911      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
5912    if (json.has("sourceVersion"))
5913      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
5914    if (json.has("_sourceVersion"))
5915      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
5916    if (json.has("target"))
5917      res.setTargetElement(parseUri(json.get("target").getAsString()));
5918    if (json.has("_target"))
5919      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
5920    if (json.has("targetVersion"))
5921      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
5922    if (json.has("_targetVersion"))
5923      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
5924    if (json.has("element")) {
5925      JsonArray array = json.getAsJsonArray("element");
5926      for (int i = 0; i < array.size(); i++) {
5927        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
5928      }
5929    };
5930    if (json.has("unmapped"))
5931      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
5932  }
5933
5934  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5935    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
5936    parseConceptMapSourceElementComponentProperties(json, owner, res);
5937    return res;
5938  }
5939
5940  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
5941    parseBackboneProperties(json, res);
5942    if (json.has("code"))
5943      res.setCodeElement(parseCode(json.get("code").getAsString()));
5944    if (json.has("_code"))
5945      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5946    if (json.has("display"))
5947      res.setDisplayElement(parseString(json.get("display").getAsString()));
5948    if (json.has("_display"))
5949      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5950    if (json.has("target")) {
5951      JsonArray array = json.getAsJsonArray("target");
5952      for (int i = 0; i < array.size(); i++) {
5953        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
5954      }
5955    };
5956  }
5957
5958  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5959    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
5960    parseConceptMapTargetElementComponentProperties(json, owner, res);
5961    return res;
5962  }
5963
5964  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
5965    parseBackboneProperties(json, res);
5966    if (json.has("code"))
5967      res.setCodeElement(parseCode(json.get("code").getAsString()));
5968    if (json.has("_code"))
5969      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
5970    if (json.has("display"))
5971      res.setDisplayElement(parseString(json.get("display").getAsString()));
5972    if (json.has("_display"))
5973      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
5974    if (json.has("equivalence"))
5975      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
5976    if (json.has("_equivalence"))
5977      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
5978    if (json.has("comment"))
5979      res.setCommentElement(parseString(json.get("comment").getAsString()));
5980    if (json.has("_comment"))
5981      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
5982    if (json.has("dependsOn")) {
5983      JsonArray array = json.getAsJsonArray("dependsOn");
5984      for (int i = 0; i < array.size(); i++) {
5985        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
5986      }
5987    };
5988    if (json.has("product")) {
5989      JsonArray array = json.getAsJsonArray("product");
5990      for (int i = 0; i < array.size(); i++) {
5991        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
5992      }
5993    };
5994  }
5995
5996  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
5997    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
5998    parseConceptMapOtherElementComponentProperties(json, owner, res);
5999    return res;
6000  }
6001
6002  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
6003    parseBackboneProperties(json, res);
6004    if (json.has("property"))
6005      res.setPropertyElement(parseUri(json.get("property").getAsString()));
6006    if (json.has("_property"))
6007      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
6008    if (json.has("system"))
6009      res.setSystemElement(parseUri(json.get("system").getAsString()));
6010    if (json.has("_system"))
6011      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
6012    if (json.has("code"))
6013      res.setCodeElement(parseString(json.get("code").getAsString()));
6014    if (json.has("_code"))
6015      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6016    if (json.has("display"))
6017      res.setDisplayElement(parseString(json.get("display").getAsString()));
6018    if (json.has("_display"))
6019      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6020  }
6021
6022  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6023    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
6024    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
6025    return res;
6026  }
6027
6028  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
6029    parseBackboneProperties(json, res);
6030    if (json.has("mode"))
6031      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
6032    if (json.has("_mode"))
6033      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6034    if (json.has("code"))
6035      res.setCodeElement(parseCode(json.get("code").getAsString()));
6036    if (json.has("_code"))
6037      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6038    if (json.has("display"))
6039      res.setDisplayElement(parseString(json.get("display").getAsString()));
6040    if (json.has("_display"))
6041      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6042    if (json.has("url"))
6043      res.setUrlElement(parseUri(json.get("url").getAsString()));
6044    if (json.has("_url"))
6045      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6046  }
6047
6048  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
6049    Condition res = new Condition();
6050    parseConditionProperties(json, res);
6051    return res;
6052  }
6053
6054  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
6055    parseDomainResourceProperties(json, res);
6056    if (json.has("identifier")) {
6057      JsonArray array = json.getAsJsonArray("identifier");
6058      for (int i = 0; i < array.size(); i++) {
6059        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6060      }
6061    };
6062    if (json.has("clinicalStatus"))
6063      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), Condition.ConditionClinicalStatus.NULL, new Condition.ConditionClinicalStatusEnumFactory()));
6064    if (json.has("_clinicalStatus"))
6065      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
6066    if (json.has("verificationStatus"))
6067      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), Condition.ConditionVerificationStatus.NULL, new Condition.ConditionVerificationStatusEnumFactory()));
6068    if (json.has("_verificationStatus"))
6069      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
6070    if (json.has("category")) {
6071      JsonArray array = json.getAsJsonArray("category");
6072      for (int i = 0; i < array.size(); i++) {
6073        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6074      }
6075    };
6076    if (json.has("severity"))
6077      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
6078    if (json.has("code"))
6079      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6080    if (json.has("bodySite")) {
6081      JsonArray array = json.getAsJsonArray("bodySite");
6082      for (int i = 0; i < array.size(); i++) {
6083        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6084      }
6085    };
6086    if (json.has("subject"))
6087      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6088    if (json.has("context"))
6089      res.setContext(parseReference(json.getAsJsonObject("context")));
6090    Type onset = parseType("onset", json);
6091    if (onset != null)
6092      res.setOnset(onset);
6093    Type abatement = parseType("abatement", json);
6094    if (abatement != null)
6095      res.setAbatement(abatement);
6096    if (json.has("assertedDate"))
6097      res.setAssertedDateElement(parseDateTime(json.get("assertedDate").getAsString()));
6098    if (json.has("_assertedDate"))
6099      parseElementProperties(json.getAsJsonObject("_assertedDate"), res.getAssertedDateElement());
6100    if (json.has("asserter"))
6101      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
6102    if (json.has("stage"))
6103      res.setStage(parseConditionConditionStageComponent(json.getAsJsonObject("stage"), res));
6104    if (json.has("evidence")) {
6105      JsonArray array = json.getAsJsonArray("evidence");
6106      for (int i = 0; i < array.size(); i++) {
6107        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
6108      }
6109    };
6110    if (json.has("note")) {
6111      JsonArray array = json.getAsJsonArray("note");
6112      for (int i = 0; i < array.size(); i++) {
6113        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6114      }
6115    };
6116  }
6117
6118  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6119    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
6120    parseConditionConditionStageComponentProperties(json, owner, res);
6121    return res;
6122  }
6123
6124  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
6125    parseBackboneProperties(json, res);
6126    if (json.has("summary"))
6127      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
6128    if (json.has("assessment")) {
6129      JsonArray array = json.getAsJsonArray("assessment");
6130      for (int i = 0; i < array.size(); i++) {
6131        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
6132      }
6133    };
6134  }
6135
6136  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
6137    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
6138    parseConditionConditionEvidenceComponentProperties(json, owner, res);
6139    return res;
6140  }
6141
6142  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
6143    parseBackboneProperties(json, res);
6144    if (json.has("code")) {
6145      JsonArray array = json.getAsJsonArray("code");
6146      for (int i = 0; i < array.size(); i++) {
6147        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6148      }
6149    };
6150    if (json.has("detail")) {
6151      JsonArray array = json.getAsJsonArray("detail");
6152      for (int i = 0; i < array.size(); i++) {
6153        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6154      }
6155    };
6156  }
6157
6158  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
6159    Consent res = new Consent();
6160    parseConsentProperties(json, res);
6161    return res;
6162  }
6163
6164  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
6165    parseDomainResourceProperties(json, res);
6166    if (json.has("identifier"))
6167      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6168    if (json.has("status"))
6169      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
6170    if (json.has("_status"))
6171      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6172    if (json.has("category")) {
6173      JsonArray array = json.getAsJsonArray("category");
6174      for (int i = 0; i < array.size(); i++) {
6175        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6176      }
6177    };
6178    if (json.has("patient"))
6179      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6180    if (json.has("period"))
6181      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6182    if (json.has("dateTime"))
6183      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
6184    if (json.has("_dateTime"))
6185      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
6186    if (json.has("consentingParty")) {
6187      JsonArray array = json.getAsJsonArray("consentingParty");
6188      for (int i = 0; i < array.size(); i++) {
6189        res.getConsentingParty().add(parseReference(array.get(i).getAsJsonObject()));
6190      }
6191    };
6192    if (json.has("actor")) {
6193      JsonArray array = json.getAsJsonArray("actor");
6194      for (int i = 0; i < array.size(); i++) {
6195        res.getActor().add(parseConsentConsentActorComponent(array.get(i).getAsJsonObject(), res));
6196      }
6197    };
6198    if (json.has("action")) {
6199      JsonArray array = json.getAsJsonArray("action");
6200      for (int i = 0; i < array.size(); i++) {
6201        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6202      }
6203    };
6204    if (json.has("organization")) {
6205      JsonArray array = json.getAsJsonArray("organization");
6206      for (int i = 0; i < array.size(); i++) {
6207        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
6208      }
6209    };
6210    Type source = parseType("source", json);
6211    if (source != null)
6212      res.setSource(source);
6213    if (json.has("policy")) {
6214      JsonArray array = json.getAsJsonArray("policy");
6215      for (int i = 0; i < array.size(); i++) {
6216        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
6217      }
6218    };
6219    if (json.has("policyRule"))
6220      res.setPolicyRuleElement(parseUri(json.get("policyRule").getAsString()));
6221    if (json.has("_policyRule"))
6222      parseElementProperties(json.getAsJsonObject("_policyRule"), res.getPolicyRuleElement());
6223    if (json.has("securityLabel")) {
6224      JsonArray array = json.getAsJsonArray("securityLabel");
6225      for (int i = 0; i < array.size(); i++) {
6226        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6227      }
6228    };
6229    if (json.has("purpose")) {
6230      JsonArray array = json.getAsJsonArray("purpose");
6231      for (int i = 0; i < array.size(); i++) {
6232        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6233      }
6234    };
6235    if (json.has("dataPeriod"))
6236      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
6237    if (json.has("data")) {
6238      JsonArray array = json.getAsJsonArray("data");
6239      for (int i = 0; i < array.size(); i++) {
6240        res.getData().add(parseConsentConsentDataComponent(array.get(i).getAsJsonObject(), res));
6241      }
6242    };
6243    if (json.has("except")) {
6244      JsonArray array = json.getAsJsonArray("except");
6245      for (int i = 0; i < array.size(); i++) {
6246        res.getExcept().add(parseConsentExceptComponent(array.get(i).getAsJsonObject(), res));
6247      }
6248    };
6249  }
6250
6251  protected Consent.ConsentActorComponent parseConsentConsentActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6252    Consent.ConsentActorComponent res = new Consent.ConsentActorComponent();
6253    parseConsentConsentActorComponentProperties(json, owner, res);
6254    return res;
6255  }
6256
6257  protected void parseConsentConsentActorComponentProperties(JsonObject json, Consent owner, Consent.ConsentActorComponent res) throws IOException, FHIRFormatError {
6258    parseBackboneProperties(json, res);
6259    if (json.has("role"))
6260      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
6261    if (json.has("reference"))
6262      res.setReference(parseReference(json.getAsJsonObject("reference")));
6263  }
6264
6265  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6266    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
6267    parseConsentConsentPolicyComponentProperties(json, owner, res);
6268    return res;
6269  }
6270
6271  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
6272    parseBackboneProperties(json, res);
6273    if (json.has("authority"))
6274      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
6275    if (json.has("_authority"))
6276      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
6277    if (json.has("uri"))
6278      res.setUriElement(parseUri(json.get("uri").getAsString()));
6279    if (json.has("_uri"))
6280      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6281  }
6282
6283  protected Consent.ConsentDataComponent parseConsentConsentDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6284    Consent.ConsentDataComponent res = new Consent.ConsentDataComponent();
6285    parseConsentConsentDataComponentProperties(json, owner, res);
6286    return res;
6287  }
6288
6289  protected void parseConsentConsentDataComponentProperties(JsonObject json, Consent owner, Consent.ConsentDataComponent res) throws IOException, FHIRFormatError {
6290    parseBackboneProperties(json, res);
6291    if (json.has("meaning"))
6292      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6293    if (json.has("_meaning"))
6294      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
6295    if (json.has("reference"))
6296      res.setReference(parseReference(json.getAsJsonObject("reference")));
6297  }
6298
6299  protected Consent.ExceptComponent parseConsentExceptComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6300    Consent.ExceptComponent res = new Consent.ExceptComponent();
6301    parseConsentExceptComponentProperties(json, owner, res);
6302    return res;
6303  }
6304
6305  protected void parseConsentExceptComponentProperties(JsonObject json, Consent owner, Consent.ExceptComponent res) throws IOException, FHIRFormatError {
6306    parseBackboneProperties(json, res);
6307    if (json.has("type"))
6308      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentExceptType.NULL, new Consent.ConsentExceptTypeEnumFactory()));
6309    if (json.has("_type"))
6310      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6311    if (json.has("period"))
6312      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6313    if (json.has("actor")) {
6314      JsonArray array = json.getAsJsonArray("actor");
6315      for (int i = 0; i < array.size(); i++) {
6316        res.getActor().add(parseConsentExceptActorComponent(array.get(i).getAsJsonObject(), owner));
6317      }
6318    };
6319    if (json.has("action")) {
6320      JsonArray array = json.getAsJsonArray("action");
6321      for (int i = 0; i < array.size(); i++) {
6322        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6323      }
6324    };
6325    if (json.has("securityLabel")) {
6326      JsonArray array = json.getAsJsonArray("securityLabel");
6327      for (int i = 0; i < array.size(); i++) {
6328        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6329      }
6330    };
6331    if (json.has("purpose")) {
6332      JsonArray array = json.getAsJsonArray("purpose");
6333      for (int i = 0; i < array.size(); i++) {
6334        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
6335      }
6336    };
6337    if (json.has("class")) {
6338      JsonArray array = json.getAsJsonArray("class");
6339      for (int i = 0; i < array.size(); i++) {
6340        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
6341      }
6342    };
6343    if (json.has("code")) {
6344      JsonArray array = json.getAsJsonArray("code");
6345      for (int i = 0; i < array.size(); i++) {
6346        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
6347      }
6348    };
6349    if (json.has("dataPeriod"))
6350      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
6351    if (json.has("data")) {
6352      JsonArray array = json.getAsJsonArray("data");
6353      for (int i = 0; i < array.size(); i++) {
6354        res.getData().add(parseConsentExceptDataComponent(array.get(i).getAsJsonObject(), owner));
6355      }
6356    };
6357  }
6358
6359  protected Consent.ExceptActorComponent parseConsentExceptActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6360    Consent.ExceptActorComponent res = new Consent.ExceptActorComponent();
6361    parseConsentExceptActorComponentProperties(json, owner, res);
6362    return res;
6363  }
6364
6365  protected void parseConsentExceptActorComponentProperties(JsonObject json, Consent owner, Consent.ExceptActorComponent res) throws IOException, FHIRFormatError {
6366    parseBackboneProperties(json, res);
6367    if (json.has("role"))
6368      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
6369    if (json.has("reference"))
6370      res.setReference(parseReference(json.getAsJsonObject("reference")));
6371  }
6372
6373  protected Consent.ExceptDataComponent parseConsentExceptDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
6374    Consent.ExceptDataComponent res = new Consent.ExceptDataComponent();
6375    parseConsentExceptDataComponentProperties(json, owner, res);
6376    return res;
6377  }
6378
6379  protected void parseConsentExceptDataComponentProperties(JsonObject json, Consent owner, Consent.ExceptDataComponent res) throws IOException, FHIRFormatError {
6380    parseBackboneProperties(json, res);
6381    if (json.has("meaning"))
6382      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
6383    if (json.has("_meaning"))
6384      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
6385    if (json.has("reference"))
6386      res.setReference(parseReference(json.getAsJsonObject("reference")));
6387  }
6388
6389  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
6390    Contract res = new Contract();
6391    parseContractProperties(json, res);
6392    return res;
6393  }
6394
6395  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
6396    parseDomainResourceProperties(json, res);
6397    if (json.has("identifier"))
6398      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6399    if (json.has("status"))
6400      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
6401    if (json.has("_status"))
6402      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6403    if (json.has("issued"))
6404      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6405    if (json.has("_issued"))
6406      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6407    if (json.has("applies"))
6408      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6409    if (json.has("subject")) {
6410      JsonArray array = json.getAsJsonArray("subject");
6411      for (int i = 0; i < array.size(); i++) {
6412        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
6413      }
6414    };
6415    if (json.has("topic")) {
6416      JsonArray array = json.getAsJsonArray("topic");
6417      for (int i = 0; i < array.size(); i++) {
6418        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6419      }
6420    };
6421    if (json.has("authority")) {
6422      JsonArray array = json.getAsJsonArray("authority");
6423      for (int i = 0; i < array.size(); i++) {
6424        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
6425      }
6426    };
6427    if (json.has("domain")) {
6428      JsonArray array = json.getAsJsonArray("domain");
6429      for (int i = 0; i < array.size(); i++) {
6430        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
6431      }
6432    };
6433    if (json.has("type"))
6434      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6435    if (json.has("subType")) {
6436      JsonArray array = json.getAsJsonArray("subType");
6437      for (int i = 0; i < array.size(); i++) {
6438        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6439      }
6440    };
6441    if (json.has("action")) {
6442      JsonArray array = json.getAsJsonArray("action");
6443      for (int i = 0; i < array.size(); i++) {
6444        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6445      }
6446    };
6447    if (json.has("actionReason")) {
6448      JsonArray array = json.getAsJsonArray("actionReason");
6449      for (int i = 0; i < array.size(); i++) {
6450        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6451      }
6452    };
6453    if (json.has("decisionType"))
6454      res.setDecisionType(parseCodeableConcept(json.getAsJsonObject("decisionType")));
6455    if (json.has("contentDerivative"))
6456      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
6457    if (json.has("securityLabel")) {
6458      JsonArray array = json.getAsJsonArray("securityLabel");
6459      for (int i = 0; i < array.size(); i++) {
6460        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6461      }
6462    };
6463    if (json.has("agent")) {
6464      JsonArray array = json.getAsJsonArray("agent");
6465      for (int i = 0; i < array.size(); i++) {
6466        res.getAgent().add(parseContractAgentComponent(array.get(i).getAsJsonObject(), res));
6467      }
6468    };
6469    if (json.has("signer")) {
6470      JsonArray array = json.getAsJsonArray("signer");
6471      for (int i = 0; i < array.size(); i++) {
6472        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
6473      }
6474    };
6475    if (json.has("valuedItem")) {
6476      JsonArray array = json.getAsJsonArray("valuedItem");
6477      for (int i = 0; i < array.size(); i++) {
6478        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), res));
6479      }
6480    };
6481    if (json.has("term")) {
6482      JsonArray array = json.getAsJsonArray("term");
6483      for (int i = 0; i < array.size(); i++) {
6484        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
6485      }
6486    };
6487    Type binding = parseType("binding", json);
6488    if (binding != null)
6489      res.setBinding(binding);
6490    if (json.has("friendly")) {
6491      JsonArray array = json.getAsJsonArray("friendly");
6492      for (int i = 0; i < array.size(); i++) {
6493        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
6494      }
6495    };
6496    if (json.has("legal")) {
6497      JsonArray array = json.getAsJsonArray("legal");
6498      for (int i = 0; i < array.size(); i++) {
6499        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
6500      }
6501    };
6502    if (json.has("rule")) {
6503      JsonArray array = json.getAsJsonArray("rule");
6504      for (int i = 0; i < array.size(); i++) {
6505        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
6506      }
6507    };
6508  }
6509
6510  protected Contract.AgentComponent parseContractAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6511    Contract.AgentComponent res = new Contract.AgentComponent();
6512    parseContractAgentComponentProperties(json, owner, res);
6513    return res;
6514  }
6515
6516  protected void parseContractAgentComponentProperties(JsonObject json, Contract owner, Contract.AgentComponent res) throws IOException, FHIRFormatError {
6517    parseBackboneProperties(json, res);
6518    if (json.has("actor"))
6519      res.setActor(parseReference(json.getAsJsonObject("actor")));
6520    if (json.has("role")) {
6521      JsonArray array = json.getAsJsonArray("role");
6522      for (int i = 0; i < array.size(); i++) {
6523        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6524      }
6525    };
6526  }
6527
6528  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6529    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
6530    parseContractSignatoryComponentProperties(json, owner, res);
6531    return res;
6532  }
6533
6534  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
6535    parseBackboneProperties(json, res);
6536    if (json.has("type"))
6537      res.setType(parseCoding(json.getAsJsonObject("type")));
6538    if (json.has("party"))
6539      res.setParty(parseReference(json.getAsJsonObject("party")));
6540    if (json.has("signature")) {
6541      JsonArray array = json.getAsJsonArray("signature");
6542      for (int i = 0; i < array.size(); i++) {
6543        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
6544      }
6545    };
6546  }
6547
6548  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6549    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
6550    parseContractValuedItemComponentProperties(json, owner, res);
6551    return res;
6552  }
6553
6554  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
6555    parseBackboneProperties(json, res);
6556    Type entity = parseType("entity", json);
6557    if (entity != null)
6558      res.setEntity(entity);
6559    if (json.has("identifier"))
6560      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6561    if (json.has("effectiveTime"))
6562      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6563    if (json.has("_effectiveTime"))
6564      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
6565    if (json.has("quantity"))
6566      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
6567    if (json.has("unitPrice"))
6568      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6569    if (json.has("factor"))
6570      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6571    if (json.has("_factor"))
6572      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6573    if (json.has("points"))
6574      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6575    if (json.has("_points"))
6576      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
6577    if (json.has("net"))
6578      res.setNet(parseMoney(json.getAsJsonObject("net")));
6579  }
6580
6581  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6582    Contract.TermComponent res = new Contract.TermComponent();
6583    parseContractTermComponentProperties(json, owner, res);
6584    return res;
6585  }
6586
6587  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
6588    parseBackboneProperties(json, res);
6589    if (json.has("identifier"))
6590      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6591    if (json.has("issued"))
6592      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
6593    if (json.has("_issued"))
6594      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
6595    if (json.has("applies"))
6596      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
6597    if (json.has("type"))
6598      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6599    if (json.has("subType"))
6600      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
6601    if (json.has("topic")) {
6602      JsonArray array = json.getAsJsonArray("topic");
6603      for (int i = 0; i < array.size(); i++) {
6604        res.getTopic().add(parseReference(array.get(i).getAsJsonObject()));
6605      }
6606    };
6607    if (json.has("action")) {
6608      JsonArray array = json.getAsJsonArray("action");
6609      for (int i = 0; i < array.size(); i++) {
6610        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6611      }
6612    };
6613    if (json.has("actionReason")) {
6614      JsonArray array = json.getAsJsonArray("actionReason");
6615      for (int i = 0; i < array.size(); i++) {
6616        res.getActionReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6617      }
6618    };
6619    if (json.has("securityLabel")) {
6620      JsonArray array = json.getAsJsonArray("securityLabel");
6621      for (int i = 0; i < array.size(); i++) {
6622        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
6623      }
6624    };
6625    if (json.has("agent")) {
6626      JsonArray array = json.getAsJsonArray("agent");
6627      for (int i = 0; i < array.size(); i++) {
6628        res.getAgent().add(parseContractTermAgentComponent(array.get(i).getAsJsonObject(), owner));
6629      }
6630    };
6631    if (json.has("text"))
6632      res.setTextElement(parseString(json.get("text").getAsString()));
6633    if (json.has("_text"))
6634      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
6635    if (json.has("valuedItem")) {
6636      JsonArray array = json.getAsJsonArray("valuedItem");
6637      for (int i = 0; i < array.size(); i++) {
6638        res.getValuedItem().add(parseContractTermValuedItemComponent(array.get(i).getAsJsonObject(), owner));
6639      }
6640    };
6641    if (json.has("group")) {
6642      JsonArray array = json.getAsJsonArray("group");
6643      for (int i = 0; i < array.size(); i++) {
6644        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
6645      }
6646    };
6647  }
6648
6649  protected Contract.TermAgentComponent parseContractTermAgentComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6650    Contract.TermAgentComponent res = new Contract.TermAgentComponent();
6651    parseContractTermAgentComponentProperties(json, owner, res);
6652    return res;
6653  }
6654
6655  protected void parseContractTermAgentComponentProperties(JsonObject json, Contract owner, Contract.TermAgentComponent res) throws IOException, FHIRFormatError {
6656    parseBackboneProperties(json, res);
6657    if (json.has("actor"))
6658      res.setActor(parseReference(json.getAsJsonObject("actor")));
6659    if (json.has("role")) {
6660      JsonArray array = json.getAsJsonArray("role");
6661      for (int i = 0; i < array.size(); i++) {
6662        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6663      }
6664    };
6665  }
6666
6667  protected Contract.TermValuedItemComponent parseContractTermValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6668    Contract.TermValuedItemComponent res = new Contract.TermValuedItemComponent();
6669    parseContractTermValuedItemComponentProperties(json, owner, res);
6670    return res;
6671  }
6672
6673  protected void parseContractTermValuedItemComponentProperties(JsonObject json, Contract owner, Contract.TermValuedItemComponent res) throws IOException, FHIRFormatError {
6674    parseBackboneProperties(json, res);
6675    Type entity = parseType("entity", json);
6676    if (entity != null)
6677      res.setEntity(entity);
6678    if (json.has("identifier"))
6679      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6680    if (json.has("effectiveTime"))
6681      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
6682    if (json.has("_effectiveTime"))
6683      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
6684    if (json.has("quantity"))
6685      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
6686    if (json.has("unitPrice"))
6687      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
6688    if (json.has("factor"))
6689      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
6690    if (json.has("_factor"))
6691      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
6692    if (json.has("points"))
6693      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
6694    if (json.has("_points"))
6695      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
6696    if (json.has("net"))
6697      res.setNet(parseMoney(json.getAsJsonObject("net")));
6698  }
6699
6700  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6701    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
6702    parseContractFriendlyLanguageComponentProperties(json, owner, res);
6703    return res;
6704  }
6705
6706  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
6707    parseBackboneProperties(json, res);
6708    Type content = parseType("content", json);
6709    if (content != null)
6710      res.setContent(content);
6711  }
6712
6713  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6714    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
6715    parseContractLegalLanguageComponentProperties(json, owner, res);
6716    return res;
6717  }
6718
6719  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
6720    parseBackboneProperties(json, res);
6721    Type content = parseType("content", json);
6722    if (content != null)
6723      res.setContent(content);
6724  }
6725
6726  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
6727    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
6728    parseContractComputableLanguageComponentProperties(json, owner, res);
6729    return res;
6730  }
6731
6732  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
6733    parseBackboneProperties(json, res);
6734    Type content = parseType("content", json);
6735    if (content != null)
6736      res.setContent(content);
6737  }
6738
6739  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
6740    Coverage res = new Coverage();
6741    parseCoverageProperties(json, res);
6742    return res;
6743  }
6744
6745  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
6746    parseDomainResourceProperties(json, res);
6747    if (json.has("identifier")) {
6748      JsonArray array = json.getAsJsonArray("identifier");
6749      for (int i = 0; i < array.size(); i++) {
6750        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6751      }
6752    };
6753    if (json.has("status"))
6754      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
6755    if (json.has("_status"))
6756      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6757    if (json.has("type"))
6758      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6759    if (json.has("policyHolder"))
6760      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
6761    if (json.has("subscriber"))
6762      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
6763    if (json.has("subscriberId"))
6764      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
6765    if (json.has("_subscriberId"))
6766      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
6767    if (json.has("beneficiary"))
6768      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
6769    if (json.has("relationship"))
6770      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
6771    if (json.has("period"))
6772      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6773    if (json.has("payor")) {
6774      JsonArray array = json.getAsJsonArray("payor");
6775      for (int i = 0; i < array.size(); i++) {
6776        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
6777      }
6778    };
6779    if (json.has("grouping"))
6780      res.setGrouping(parseCoverageGroupComponent(json.getAsJsonObject("grouping"), res));
6781    if (json.has("dependent"))
6782      res.setDependentElement(parseString(json.get("dependent").getAsString()));
6783    if (json.has("_dependent"))
6784      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
6785    if (json.has("sequence"))
6786      res.setSequenceElement(parseString(json.get("sequence").getAsString()));
6787    if (json.has("_sequence"))
6788      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
6789    if (json.has("order"))
6790      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
6791    if (json.has("_order"))
6792      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
6793    if (json.has("network"))
6794      res.setNetworkElement(parseString(json.get("network").getAsString()));
6795    if (json.has("_network"))
6796      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
6797    if (json.has("contract")) {
6798      JsonArray array = json.getAsJsonArray("contract");
6799      for (int i = 0; i < array.size(); i++) {
6800        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
6801      }
6802    };
6803  }
6804
6805  protected Coverage.GroupComponent parseCoverageGroupComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
6806    Coverage.GroupComponent res = new Coverage.GroupComponent();
6807    parseCoverageGroupComponentProperties(json, owner, res);
6808    return res;
6809  }
6810
6811  protected void parseCoverageGroupComponentProperties(JsonObject json, Coverage owner, Coverage.GroupComponent res) throws IOException, FHIRFormatError {
6812    parseBackboneProperties(json, res);
6813    if (json.has("group"))
6814      res.setGroupElement(parseString(json.get("group").getAsString()));
6815    if (json.has("_group"))
6816      parseElementProperties(json.getAsJsonObject("_group"), res.getGroupElement());
6817    if (json.has("groupDisplay"))
6818      res.setGroupDisplayElement(parseString(json.get("groupDisplay").getAsString()));
6819    if (json.has("_groupDisplay"))
6820      parseElementProperties(json.getAsJsonObject("_groupDisplay"), res.getGroupDisplayElement());
6821    if (json.has("subGroup"))
6822      res.setSubGroupElement(parseString(json.get("subGroup").getAsString()));
6823    if (json.has("_subGroup"))
6824      parseElementProperties(json.getAsJsonObject("_subGroup"), res.getSubGroupElement());
6825    if (json.has("subGroupDisplay"))
6826      res.setSubGroupDisplayElement(parseString(json.get("subGroupDisplay").getAsString()));
6827    if (json.has("_subGroupDisplay"))
6828      parseElementProperties(json.getAsJsonObject("_subGroupDisplay"), res.getSubGroupDisplayElement());
6829    if (json.has("plan"))
6830      res.setPlanElement(parseString(json.get("plan").getAsString()));
6831    if (json.has("_plan"))
6832      parseElementProperties(json.getAsJsonObject("_plan"), res.getPlanElement());
6833    if (json.has("planDisplay"))
6834      res.setPlanDisplayElement(parseString(json.get("planDisplay").getAsString()));
6835    if (json.has("_planDisplay"))
6836      parseElementProperties(json.getAsJsonObject("_planDisplay"), res.getPlanDisplayElement());
6837    if (json.has("subPlan"))
6838      res.setSubPlanElement(parseString(json.get("subPlan").getAsString()));
6839    if (json.has("_subPlan"))
6840      parseElementProperties(json.getAsJsonObject("_subPlan"), res.getSubPlanElement());
6841    if (json.has("subPlanDisplay"))
6842      res.setSubPlanDisplayElement(parseString(json.get("subPlanDisplay").getAsString()));
6843    if (json.has("_subPlanDisplay"))
6844      parseElementProperties(json.getAsJsonObject("_subPlanDisplay"), res.getSubPlanDisplayElement());
6845    if (json.has("class"))
6846      res.setClass_Element(parseString(json.get("class").getAsString()));
6847    if (json.has("_class"))
6848      parseElementProperties(json.getAsJsonObject("_class"), res.getClass_Element());
6849    if (json.has("classDisplay"))
6850      res.setClassDisplayElement(parseString(json.get("classDisplay").getAsString()));
6851    if (json.has("_classDisplay"))
6852      parseElementProperties(json.getAsJsonObject("_classDisplay"), res.getClassDisplayElement());
6853    if (json.has("subClass"))
6854      res.setSubClassElement(parseString(json.get("subClass").getAsString()));
6855    if (json.has("_subClass"))
6856      parseElementProperties(json.getAsJsonObject("_subClass"), res.getSubClassElement());
6857    if (json.has("subClassDisplay"))
6858      res.setSubClassDisplayElement(parseString(json.get("subClassDisplay").getAsString()));
6859    if (json.has("_subClassDisplay"))
6860      parseElementProperties(json.getAsJsonObject("_subClassDisplay"), res.getSubClassDisplayElement());
6861  }
6862
6863  protected DataElement parseDataElement(JsonObject json) throws IOException, FHIRFormatError {
6864    DataElement res = new DataElement();
6865    parseDataElementProperties(json, res);
6866    return res;
6867  }
6868
6869  protected void parseDataElementProperties(JsonObject json, DataElement res) throws IOException, FHIRFormatError {
6870    parseDomainResourceProperties(json, res);
6871    if (json.has("url"))
6872      res.setUrlElement(parseUri(json.get("url").getAsString()));
6873    if (json.has("_url"))
6874      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6875    if (json.has("identifier")) {
6876      JsonArray array = json.getAsJsonArray("identifier");
6877      for (int i = 0; i < array.size(); i++) {
6878        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6879      }
6880    };
6881    if (json.has("version"))
6882      res.setVersionElement(parseString(json.get("version").getAsString()));
6883    if (json.has("_version"))
6884      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6885    if (json.has("status"))
6886      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6887    if (json.has("_status"))
6888      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6889    if (json.has("experimental"))
6890      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6891    if (json.has("_experimental"))
6892      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6893    if (json.has("date"))
6894      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6895    if (json.has("_date"))
6896      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6897    if (json.has("publisher"))
6898      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6899    if (json.has("_publisher"))
6900      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6901    if (json.has("name"))
6902      res.setNameElement(parseString(json.get("name").getAsString()));
6903    if (json.has("_name"))
6904      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6905    if (json.has("title"))
6906      res.setTitleElement(parseString(json.get("title").getAsString()));
6907    if (json.has("_title"))
6908      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6909    if (json.has("contact")) {
6910      JsonArray array = json.getAsJsonArray("contact");
6911      for (int i = 0; i < array.size(); i++) {
6912        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6913      }
6914    };
6915    if (json.has("useContext")) {
6916      JsonArray array = json.getAsJsonArray("useContext");
6917      for (int i = 0; i < array.size(); i++) {
6918        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6919      }
6920    };
6921    if (json.has("jurisdiction")) {
6922      JsonArray array = json.getAsJsonArray("jurisdiction");
6923      for (int i = 0; i < array.size(); i++) {
6924        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6925      }
6926    };
6927    if (json.has("copyright"))
6928      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6929    if (json.has("_copyright"))
6930      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6931    if (json.has("stringency"))
6932      res.setStringencyElement(parseEnumeration(json.get("stringency").getAsString(), DataElement.DataElementStringency.NULL, new DataElement.DataElementStringencyEnumFactory()));
6933    if (json.has("_stringency"))
6934      parseElementProperties(json.getAsJsonObject("_stringency"), res.getStringencyElement());
6935    if (json.has("mapping")) {
6936      JsonArray array = json.getAsJsonArray("mapping");
6937      for (int i = 0; i < array.size(); i++) {
6938        res.getMapping().add(parseDataElementDataElementMappingComponent(array.get(i).getAsJsonObject(), res));
6939      }
6940    };
6941    if (json.has("element")) {
6942      JsonArray array = json.getAsJsonArray("element");
6943      for (int i = 0; i < array.size(); i++) {
6944        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
6945      }
6946    };
6947  }
6948
6949  protected DataElement.DataElementMappingComponent parseDataElementDataElementMappingComponent(JsonObject json, DataElement owner) throws IOException, FHIRFormatError {
6950    DataElement.DataElementMappingComponent res = new DataElement.DataElementMappingComponent();
6951    parseDataElementDataElementMappingComponentProperties(json, owner, res);
6952    return res;
6953  }
6954
6955  protected void parseDataElementDataElementMappingComponentProperties(JsonObject json, DataElement owner, DataElement.DataElementMappingComponent res) throws IOException, FHIRFormatError {
6956    parseBackboneProperties(json, res);
6957    if (json.has("identity"))
6958      res.setIdentityElement(parseId(json.get("identity").getAsString()));
6959    if (json.has("_identity"))
6960      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
6961    if (json.has("uri"))
6962      res.setUriElement(parseUri(json.get("uri").getAsString()));
6963    if (json.has("_uri"))
6964      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6965    if (json.has("name"))
6966      res.setNameElement(parseString(json.get("name").getAsString()));
6967    if (json.has("_name"))
6968      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6969    if (json.has("comment"))
6970      res.setCommentElement(parseString(json.get("comment").getAsString()));
6971    if (json.has("_comment"))
6972      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
6973  }
6974
6975  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
6976    DetectedIssue res = new DetectedIssue();
6977    parseDetectedIssueProperties(json, res);
6978    return res;
6979  }
6980
6981  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
6982    parseDomainResourceProperties(json, res);
6983    if (json.has("identifier"))
6984      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6985    if (json.has("status"))
6986      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
6987    if (json.has("_status"))
6988      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6989    if (json.has("category"))
6990      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
6991    if (json.has("severity"))
6992      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
6993    if (json.has("_severity"))
6994      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
6995    if (json.has("patient"))
6996      res.setPatient(parseReference(json.getAsJsonObject("patient")));
6997    if (json.has("date"))
6998      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6999    if (json.has("_date"))
7000      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7001    if (json.has("author"))
7002      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7003    if (json.has("implicated")) {
7004      JsonArray array = json.getAsJsonArray("implicated");
7005      for (int i = 0; i < array.size(); i++) {
7006        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
7007      }
7008    };
7009    if (json.has("detail"))
7010      res.setDetailElement(parseString(json.get("detail").getAsString()));
7011    if (json.has("_detail"))
7012      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
7013    if (json.has("reference"))
7014      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
7015    if (json.has("_reference"))
7016      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
7017    if (json.has("mitigation")) {
7018      JsonArray array = json.getAsJsonArray("mitigation");
7019      for (int i = 0; i < array.size(); i++) {
7020        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
7021      }
7022    };
7023  }
7024
7025  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
7026    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
7027    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
7028    return res;
7029  }
7030
7031  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
7032    parseBackboneProperties(json, res);
7033    if (json.has("action"))
7034      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
7035    if (json.has("date"))
7036      res.setDateElement(parseDateTime(json.get("date").getAsString()));
7037    if (json.has("_date"))
7038      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
7039    if (json.has("author"))
7040      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7041  }
7042
7043  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
7044    Device res = new Device();
7045    parseDeviceProperties(json, res);
7046    return res;
7047  }
7048
7049  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
7050    parseDomainResourceProperties(json, res);
7051    if (json.has("identifier")) {
7052      JsonArray array = json.getAsJsonArray("identifier");
7053      for (int i = 0; i < array.size(); i++) {
7054        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7055      }
7056    };
7057    if (json.has("udi"))
7058      res.setUdi(parseDeviceDeviceUdiComponent(json.getAsJsonObject("udi"), res));
7059    if (json.has("status"))
7060      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
7061    if (json.has("_status"))
7062      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7063    if (json.has("type"))
7064      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7065    if (json.has("lotNumber"))
7066      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
7067    if (json.has("_lotNumber"))
7068      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
7069    if (json.has("manufacturer"))
7070      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
7071    if (json.has("_manufacturer"))
7072      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
7073    if (json.has("manufactureDate"))
7074      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
7075    if (json.has("_manufactureDate"))
7076      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
7077    if (json.has("expirationDate"))
7078      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
7079    if (json.has("_expirationDate"))
7080      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
7081    if (json.has("model"))
7082      res.setModelElement(parseString(json.get("model").getAsString()));
7083    if (json.has("_model"))
7084      parseElementProperties(json.getAsJsonObject("_model"), res.getModelElement());
7085    if (json.has("version"))
7086      res.setVersionElement(parseString(json.get("version").getAsString()));
7087    if (json.has("_version"))
7088      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7089    if (json.has("patient"))
7090      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7091    if (json.has("owner"))
7092      res.setOwner(parseReference(json.getAsJsonObject("owner")));
7093    if (json.has("contact")) {
7094      JsonArray array = json.getAsJsonArray("contact");
7095      for (int i = 0; i < array.size(); i++) {
7096        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
7097      }
7098    };
7099    if (json.has("location"))
7100      res.setLocation(parseReference(json.getAsJsonObject("location")));
7101    if (json.has("url"))
7102      res.setUrlElement(parseUri(json.get("url").getAsString()));
7103    if (json.has("_url"))
7104      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7105    if (json.has("note")) {
7106      JsonArray array = json.getAsJsonArray("note");
7107      for (int i = 0; i < array.size(); i++) {
7108        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7109      }
7110    };
7111    if (json.has("safety")) {
7112      JsonArray array = json.getAsJsonArray("safety");
7113      for (int i = 0; i < array.size(); i++) {
7114        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7115      }
7116    };
7117  }
7118
7119  protected Device.DeviceUdiComponent parseDeviceDeviceUdiComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
7120    Device.DeviceUdiComponent res = new Device.DeviceUdiComponent();
7121    parseDeviceDeviceUdiComponentProperties(json, owner, res);
7122    return res;
7123  }
7124
7125  protected void parseDeviceDeviceUdiComponentProperties(JsonObject json, Device owner, Device.DeviceUdiComponent res) throws IOException, FHIRFormatError {
7126    parseBackboneProperties(json, res);
7127    if (json.has("deviceIdentifier"))
7128      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
7129    if (json.has("_deviceIdentifier"))
7130      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
7131    if (json.has("name"))
7132      res.setNameElement(parseString(json.get("name").getAsString()));
7133    if (json.has("_name"))
7134      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7135    if (json.has("jurisdiction"))
7136      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
7137    if (json.has("_jurisdiction"))
7138      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
7139    if (json.has("carrierHRF"))
7140      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
7141    if (json.has("_carrierHRF"))
7142      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
7143    if (json.has("carrierAIDC"))
7144      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
7145    if (json.has("_carrierAIDC"))
7146      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
7147    if (json.has("issuer"))
7148      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
7149    if (json.has("_issuer"))
7150      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
7151    if (json.has("entryType"))
7152      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
7153    if (json.has("_entryType"))
7154      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
7155  }
7156
7157  protected DeviceComponent parseDeviceComponent(JsonObject json) throws IOException, FHIRFormatError {
7158    DeviceComponent res = new DeviceComponent();
7159    parseDeviceComponentProperties(json, res);
7160    return res;
7161  }
7162
7163  protected void parseDeviceComponentProperties(JsonObject json, DeviceComponent res) throws IOException, FHIRFormatError {
7164    parseDomainResourceProperties(json, res);
7165    if (json.has("identifier"))
7166      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7167    if (json.has("type"))
7168      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7169    if (json.has("lastSystemChange"))
7170      res.setLastSystemChangeElement(parseInstant(json.get("lastSystemChange").getAsString()));
7171    if (json.has("_lastSystemChange"))
7172      parseElementProperties(json.getAsJsonObject("_lastSystemChange"), res.getLastSystemChangeElement());
7173    if (json.has("source"))
7174      res.setSource(parseReference(json.getAsJsonObject("source")));
7175    if (json.has("parent"))
7176      res.setParent(parseReference(json.getAsJsonObject("parent")));
7177    if (json.has("operationalStatus")) {
7178      JsonArray array = json.getAsJsonArray("operationalStatus");
7179      for (int i = 0; i < array.size(); i++) {
7180        res.getOperationalStatus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7181      }
7182    };
7183    if (json.has("parameterGroup"))
7184      res.setParameterGroup(parseCodeableConcept(json.getAsJsonObject("parameterGroup")));
7185    if (json.has("measurementPrinciple"))
7186      res.setMeasurementPrincipleElement(parseEnumeration(json.get("measurementPrinciple").getAsString(), DeviceComponent.MeasmntPrinciple.NULL, new DeviceComponent.MeasmntPrincipleEnumFactory()));
7187    if (json.has("_measurementPrinciple"))
7188      parseElementProperties(json.getAsJsonObject("_measurementPrinciple"), res.getMeasurementPrincipleElement());
7189    if (json.has("productionSpecification")) {
7190      JsonArray array = json.getAsJsonArray("productionSpecification");
7191      for (int i = 0; i < array.size(); i++) {
7192        res.getProductionSpecification().add(parseDeviceComponentDeviceComponentProductionSpecificationComponent(array.get(i).getAsJsonObject(), res));
7193      }
7194    };
7195    if (json.has("languageCode"))
7196      res.setLanguageCode(parseCodeableConcept(json.getAsJsonObject("languageCode")));
7197  }
7198
7199  protected DeviceComponent.DeviceComponentProductionSpecificationComponent parseDeviceComponentDeviceComponentProductionSpecificationComponent(JsonObject json, DeviceComponent owner) throws IOException, FHIRFormatError {
7200    DeviceComponent.DeviceComponentProductionSpecificationComponent res = new DeviceComponent.DeviceComponentProductionSpecificationComponent();
7201    parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(json, owner, res);
7202    return res;
7203  }
7204
7205  protected void parseDeviceComponentDeviceComponentProductionSpecificationComponentProperties(JsonObject json, DeviceComponent owner, DeviceComponent.DeviceComponentProductionSpecificationComponent res) throws IOException, FHIRFormatError {
7206    parseBackboneProperties(json, res);
7207    if (json.has("specType"))
7208      res.setSpecType(parseCodeableConcept(json.getAsJsonObject("specType")));
7209    if (json.has("componentId"))
7210      res.setComponentId(parseIdentifier(json.getAsJsonObject("componentId")));
7211    if (json.has("productionSpec"))
7212      res.setProductionSpecElement(parseString(json.get("productionSpec").getAsString()));
7213    if (json.has("_productionSpec"))
7214      parseElementProperties(json.getAsJsonObject("_productionSpec"), res.getProductionSpecElement());
7215  }
7216
7217  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
7218    DeviceMetric res = new DeviceMetric();
7219    parseDeviceMetricProperties(json, res);
7220    return res;
7221  }
7222
7223  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
7224    parseDomainResourceProperties(json, res);
7225    if (json.has("identifier"))
7226      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7227    if (json.has("type"))
7228      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7229    if (json.has("unit"))
7230      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
7231    if (json.has("source"))
7232      res.setSource(parseReference(json.getAsJsonObject("source")));
7233    if (json.has("parent"))
7234      res.setParent(parseReference(json.getAsJsonObject("parent")));
7235    if (json.has("operationalStatus"))
7236      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
7237    if (json.has("_operationalStatus"))
7238      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
7239    if (json.has("color"))
7240      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
7241    if (json.has("_color"))
7242      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
7243    if (json.has("category"))
7244      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
7245    if (json.has("_category"))
7246      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
7247    if (json.has("measurementPeriod"))
7248      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
7249    if (json.has("calibration")) {
7250      JsonArray array = json.getAsJsonArray("calibration");
7251      for (int i = 0; i < array.size(); i++) {
7252        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
7253      }
7254    };
7255  }
7256
7257  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
7258    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
7259    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
7260    return res;
7261  }
7262
7263  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
7264    parseBackboneProperties(json, res);
7265    if (json.has("type"))
7266      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
7267    if (json.has("_type"))
7268      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7269    if (json.has("state"))
7270      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
7271    if (json.has("_state"))
7272      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
7273    if (json.has("time"))
7274      res.setTimeElement(parseInstant(json.get("time").getAsString()));
7275    if (json.has("_time"))
7276      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
7277  }
7278
7279  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
7280    DeviceRequest res = new DeviceRequest();
7281    parseDeviceRequestProperties(json, res);
7282    return res;
7283  }
7284
7285  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
7286    parseDomainResourceProperties(json, res);
7287    if (json.has("identifier")) {
7288      JsonArray array = json.getAsJsonArray("identifier");
7289      for (int i = 0; i < array.size(); i++) {
7290        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7291      }
7292    };
7293    if (json.has("definition")) {
7294      JsonArray array = json.getAsJsonArray("definition");
7295      for (int i = 0; i < array.size(); i++) {
7296        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
7297      }
7298    };
7299    if (json.has("basedOn")) {
7300      JsonArray array = json.getAsJsonArray("basedOn");
7301      for (int i = 0; i < array.size(); i++) {
7302        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7303      }
7304    };
7305    if (json.has("priorRequest")) {
7306      JsonArray array = json.getAsJsonArray("priorRequest");
7307      for (int i = 0; i < array.size(); i++) {
7308        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
7309      }
7310    };
7311    if (json.has("groupIdentifier"))
7312      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
7313    if (json.has("status"))
7314      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
7315    if (json.has("_status"))
7316      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7317    if (json.has("intent"))
7318      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
7319    if (json.has("priority"))
7320      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
7321    if (json.has("_priority"))
7322      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
7323    Type code = parseType("code", json);
7324    if (code != null)
7325      res.setCode(code);
7326    if (json.has("subject"))
7327      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7328    if (json.has("context"))
7329      res.setContext(parseReference(json.getAsJsonObject("context")));
7330    Type occurrence = parseType("occurrence", json);
7331    if (occurrence != null)
7332      res.setOccurrence(occurrence);
7333    if (json.has("authoredOn"))
7334      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
7335    if (json.has("_authoredOn"))
7336      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
7337    if (json.has("requester"))
7338      res.setRequester(parseDeviceRequestDeviceRequestRequesterComponent(json.getAsJsonObject("requester"), res));
7339    if (json.has("performerType"))
7340      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
7341    if (json.has("performer"))
7342      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
7343    if (json.has("reasonCode")) {
7344      JsonArray array = json.getAsJsonArray("reasonCode");
7345      for (int i = 0; i < array.size(); i++) {
7346        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7347      }
7348    };
7349    if (json.has("reasonReference")) {
7350      JsonArray array = json.getAsJsonArray("reasonReference");
7351      for (int i = 0; i < array.size(); i++) {
7352        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
7353      }
7354    };
7355    if (json.has("supportingInfo")) {
7356      JsonArray array = json.getAsJsonArray("supportingInfo");
7357      for (int i = 0; i < array.size(); i++) {
7358        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7359      }
7360    };
7361    if (json.has("note")) {
7362      JsonArray array = json.getAsJsonArray("note");
7363      for (int i = 0; i < array.size(); i++) {
7364        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7365      }
7366    };
7367    if (json.has("relevantHistory")) {
7368      JsonArray array = json.getAsJsonArray("relevantHistory");
7369      for (int i = 0; i < array.size(); i++) {
7370        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7371      }
7372    };
7373  }
7374
7375  protected DeviceRequest.DeviceRequestRequesterComponent parseDeviceRequestDeviceRequestRequesterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
7376    DeviceRequest.DeviceRequestRequesterComponent res = new DeviceRequest.DeviceRequestRequesterComponent();
7377    parseDeviceRequestDeviceRequestRequesterComponentProperties(json, owner, res);
7378    return res;
7379  }
7380
7381  protected void parseDeviceRequestDeviceRequestRequesterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestRequesterComponent res) throws IOException, FHIRFormatError {
7382    parseBackboneProperties(json, res);
7383    if (json.has("agent"))
7384      res.setAgent(parseReference(json.getAsJsonObject("agent")));
7385    if (json.has("onBehalfOf"))
7386      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
7387  }
7388
7389  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
7390    DeviceUseStatement res = new DeviceUseStatement();
7391    parseDeviceUseStatementProperties(json, res);
7392    return res;
7393  }
7394
7395  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
7396    parseDomainResourceProperties(json, res);
7397    if (json.has("identifier")) {
7398      JsonArray array = json.getAsJsonArray("identifier");
7399      for (int i = 0; i < array.size(); i++) {
7400        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7401      }
7402    };
7403    if (json.has("status"))
7404      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
7405    if (json.has("_status"))
7406      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7407    if (json.has("subject"))
7408      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7409    if (json.has("whenUsed"))
7410      res.setWhenUsed(parsePeriod(json.getAsJsonObject("whenUsed")));
7411    Type timing = parseType("timing", json);
7412    if (timing != null)
7413      res.setTiming(timing);
7414    if (json.has("recordedOn"))
7415      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
7416    if (json.has("_recordedOn"))
7417      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
7418    if (json.has("source"))
7419      res.setSource(parseReference(json.getAsJsonObject("source")));
7420    if (json.has("device"))
7421      res.setDevice(parseReference(json.getAsJsonObject("device")));
7422    if (json.has("indication")) {
7423      JsonArray array = json.getAsJsonArray("indication");
7424      for (int i = 0; i < array.size(); i++) {
7425        res.getIndication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7426      }
7427    };
7428    if (json.has("bodySite"))
7429      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
7430    if (json.has("note")) {
7431      JsonArray array = json.getAsJsonArray("note");
7432      for (int i = 0; i < array.size(); i++) {
7433        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7434      }
7435    };
7436  }
7437
7438  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
7439    DiagnosticReport res = new DiagnosticReport();
7440    parseDiagnosticReportProperties(json, res);
7441    return res;
7442  }
7443
7444  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
7445    parseDomainResourceProperties(json, res);
7446    if (json.has("identifier")) {
7447      JsonArray array = json.getAsJsonArray("identifier");
7448      for (int i = 0; i < array.size(); i++) {
7449        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7450      }
7451    };
7452    if (json.has("basedOn")) {
7453      JsonArray array = json.getAsJsonArray("basedOn");
7454      for (int i = 0; i < array.size(); i++) {
7455        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
7456      }
7457    };
7458    if (json.has("status"))
7459      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
7460    if (json.has("_status"))
7461      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7462    if (json.has("category"))
7463      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7464    if (json.has("code"))
7465      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7466    if (json.has("subject"))
7467      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7468    if (json.has("context"))
7469      res.setContext(parseReference(json.getAsJsonObject("context")));
7470    Type effective = parseType("effective", json);
7471    if (effective != null)
7472      res.setEffective(effective);
7473    if (json.has("issued"))
7474      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
7475    if (json.has("_issued"))
7476      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7477    if (json.has("performer")) {
7478      JsonArray array = json.getAsJsonArray("performer");
7479      for (int i = 0; i < array.size(); i++) {
7480        res.getPerformer().add(parseDiagnosticReportDiagnosticReportPerformerComponent(array.get(i).getAsJsonObject(), res));
7481      }
7482    };
7483    if (json.has("specimen")) {
7484      JsonArray array = json.getAsJsonArray("specimen");
7485      for (int i = 0; i < array.size(); i++) {
7486        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
7487      }
7488    };
7489    if (json.has("result")) {
7490      JsonArray array = json.getAsJsonArray("result");
7491      for (int i = 0; i < array.size(); i++) {
7492        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
7493      }
7494    };
7495    if (json.has("imagingStudy")) {
7496      JsonArray array = json.getAsJsonArray("imagingStudy");
7497      for (int i = 0; i < array.size(); i++) {
7498        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
7499      }
7500    };
7501    if (json.has("image")) {
7502      JsonArray array = json.getAsJsonArray("image");
7503      for (int i = 0; i < array.size(); i++) {
7504        res.getImage().add(parseDiagnosticReportDiagnosticReportImageComponent(array.get(i).getAsJsonObject(), res));
7505      }
7506    };
7507    if (json.has("conclusion"))
7508      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
7509    if (json.has("_conclusion"))
7510      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
7511    if (json.has("codedDiagnosis")) {
7512      JsonArray array = json.getAsJsonArray("codedDiagnosis");
7513      for (int i = 0; i < array.size(); i++) {
7514        res.getCodedDiagnosis().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7515      }
7516    };
7517    if (json.has("presentedForm")) {
7518      JsonArray array = json.getAsJsonArray("presentedForm");
7519      for (int i = 0; i < array.size(); i++) {
7520        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
7521      }
7522    };
7523  }
7524
7525  protected DiagnosticReport.DiagnosticReportPerformerComponent parseDiagnosticReportDiagnosticReportPerformerComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7526    DiagnosticReport.DiagnosticReportPerformerComponent res = new DiagnosticReport.DiagnosticReportPerformerComponent();
7527    parseDiagnosticReportDiagnosticReportPerformerComponentProperties(json, owner, res);
7528    return res;
7529  }
7530
7531  protected void parseDiagnosticReportDiagnosticReportPerformerComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportPerformerComponent res) throws IOException, FHIRFormatError {
7532    parseBackboneProperties(json, res);
7533    if (json.has("role"))
7534      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7535    if (json.has("actor"))
7536      res.setActor(parseReference(json.getAsJsonObject("actor")));
7537  }
7538
7539  protected DiagnosticReport.DiagnosticReportImageComponent parseDiagnosticReportDiagnosticReportImageComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
7540    DiagnosticReport.DiagnosticReportImageComponent res = new DiagnosticReport.DiagnosticReportImageComponent();
7541    parseDiagnosticReportDiagnosticReportImageComponentProperties(json, owner, res);
7542    return res;
7543  }
7544
7545  protected void parseDiagnosticReportDiagnosticReportImageComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportImageComponent res) throws IOException, FHIRFormatError {
7546    parseBackboneProperties(json, res);
7547    if (json.has("comment"))
7548      res.setCommentElement(parseString(json.get("comment").getAsString()));
7549    if (json.has("_comment"))
7550      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7551    if (json.has("link"))
7552      res.setLink(parseReference(json.getAsJsonObject("link")));
7553  }
7554
7555  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
7556    DocumentManifest res = new DocumentManifest();
7557    parseDocumentManifestProperties(json, res);
7558    return res;
7559  }
7560
7561  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
7562    parseDomainResourceProperties(json, res);
7563    if (json.has("masterIdentifier"))
7564      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
7565    if (json.has("identifier")) {
7566      JsonArray array = json.getAsJsonArray("identifier");
7567      for (int i = 0; i < array.size(); i++) {
7568        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7569      }
7570    };
7571    if (json.has("status"))
7572      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7573    if (json.has("_status"))
7574      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7575    if (json.has("type"))
7576      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7577    if (json.has("subject"))
7578      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7579    if (json.has("created"))
7580      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7581    if (json.has("_created"))
7582      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7583    if (json.has("author")) {
7584      JsonArray array = json.getAsJsonArray("author");
7585      for (int i = 0; i < array.size(); i++) {
7586        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7587      }
7588    };
7589    if (json.has("recipient")) {
7590      JsonArray array = json.getAsJsonArray("recipient");
7591      for (int i = 0; i < array.size(); i++) {
7592        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
7593      }
7594    };
7595    if (json.has("source"))
7596      res.setSourceElement(parseUri(json.get("source").getAsString()));
7597    if (json.has("_source"))
7598      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
7599    if (json.has("description"))
7600      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7601    if (json.has("_description"))
7602      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7603    if (json.has("content")) {
7604      JsonArray array = json.getAsJsonArray("content");
7605      for (int i = 0; i < array.size(); i++) {
7606        res.getContent().add(parseDocumentManifestDocumentManifestContentComponent(array.get(i).getAsJsonObject(), res));
7607      }
7608    };
7609    if (json.has("related")) {
7610      JsonArray array = json.getAsJsonArray("related");
7611      for (int i = 0; i < array.size(); i++) {
7612        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
7613      }
7614    };
7615  }
7616
7617  protected DocumentManifest.DocumentManifestContentComponent parseDocumentManifestDocumentManifestContentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7618    DocumentManifest.DocumentManifestContentComponent res = new DocumentManifest.DocumentManifestContentComponent();
7619    parseDocumentManifestDocumentManifestContentComponentProperties(json, owner, res);
7620    return res;
7621  }
7622
7623  protected void parseDocumentManifestDocumentManifestContentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestContentComponent res) throws IOException, FHIRFormatError {
7624    parseBackboneProperties(json, res);
7625    Type p = parseType("p", json);
7626    if (p != null)
7627      res.setP(p);
7628  }
7629
7630  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
7631    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
7632    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
7633    return res;
7634  }
7635
7636  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
7637    parseBackboneProperties(json, res);
7638    if (json.has("identifier"))
7639      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7640    if (json.has("ref"))
7641      res.setRef(parseReference(json.getAsJsonObject("ref")));
7642  }
7643
7644  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
7645    DocumentReference res = new DocumentReference();
7646    parseDocumentReferenceProperties(json, res);
7647    return res;
7648  }
7649
7650  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
7651    parseDomainResourceProperties(json, res);
7652    if (json.has("masterIdentifier"))
7653      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
7654    if (json.has("identifier")) {
7655      JsonArray array = json.getAsJsonArray("identifier");
7656      for (int i = 0; i < array.size(); i++) {
7657        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7658      }
7659    };
7660    if (json.has("status"))
7661      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
7662    if (json.has("_status"))
7663      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7664    if (json.has("docStatus"))
7665      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
7666    if (json.has("_docStatus"))
7667      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
7668    if (json.has("type"))
7669      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7670    if (json.has("class"))
7671      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
7672    if (json.has("subject"))
7673      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7674    if (json.has("created"))
7675      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7676    if (json.has("_created"))
7677      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7678    if (json.has("indexed"))
7679      res.setIndexedElement(parseInstant(json.get("indexed").getAsString()));
7680    if (json.has("_indexed"))
7681      parseElementProperties(json.getAsJsonObject("_indexed"), res.getIndexedElement());
7682    if (json.has("author")) {
7683      JsonArray array = json.getAsJsonArray("author");
7684      for (int i = 0; i < array.size(); i++) {
7685        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
7686      }
7687    };
7688    if (json.has("authenticator"))
7689      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
7690    if (json.has("custodian"))
7691      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
7692    if (json.has("relatesTo")) {
7693      JsonArray array = json.getAsJsonArray("relatesTo");
7694      for (int i = 0; i < array.size(); i++) {
7695        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
7696      }
7697    };
7698    if (json.has("description"))
7699      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7700    if (json.has("_description"))
7701      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7702    if (json.has("securityLabel")) {
7703      JsonArray array = json.getAsJsonArray("securityLabel");
7704      for (int i = 0; i < array.size(); i++) {
7705        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7706      }
7707    };
7708    if (json.has("content")) {
7709      JsonArray array = json.getAsJsonArray("content");
7710      for (int i = 0; i < array.size(); i++) {
7711        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
7712      }
7713    };
7714    if (json.has("context"))
7715      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
7716  }
7717
7718  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7719    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
7720    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
7721    return res;
7722  }
7723
7724  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
7725    parseBackboneProperties(json, res);
7726    if (json.has("code"))
7727      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
7728    if (json.has("_code"))
7729      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7730    if (json.has("target"))
7731      res.setTarget(parseReference(json.getAsJsonObject("target")));
7732  }
7733
7734  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7735    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
7736    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
7737    return res;
7738  }
7739
7740  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
7741    parseBackboneProperties(json, res);
7742    if (json.has("attachment"))
7743      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
7744    if (json.has("format"))
7745      res.setFormat(parseCoding(json.getAsJsonObject("format")));
7746  }
7747
7748  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7749    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
7750    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
7751    return res;
7752  }
7753
7754  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
7755    parseBackboneProperties(json, res);
7756    if (json.has("encounter"))
7757      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
7758    if (json.has("event")) {
7759      JsonArray array = json.getAsJsonArray("event");
7760      for (int i = 0; i < array.size(); i++) {
7761        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7762      }
7763    };
7764    if (json.has("period"))
7765      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7766    if (json.has("facilityType"))
7767      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
7768    if (json.has("practiceSetting"))
7769      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
7770    if (json.has("sourcePatientInfo"))
7771      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
7772    if (json.has("related")) {
7773      JsonArray array = json.getAsJsonArray("related");
7774      for (int i = 0; i < array.size(); i++) {
7775        res.getRelated().add(parseDocumentReferenceDocumentReferenceContextRelatedComponent(array.get(i).getAsJsonObject(), owner));
7776      }
7777    };
7778  }
7779
7780  protected DocumentReference.DocumentReferenceContextRelatedComponent parseDocumentReferenceDocumentReferenceContextRelatedComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
7781    DocumentReference.DocumentReferenceContextRelatedComponent res = new DocumentReference.DocumentReferenceContextRelatedComponent();
7782    parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(json, owner, res);
7783    return res;
7784  }
7785
7786  protected void parseDocumentReferenceDocumentReferenceContextRelatedComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextRelatedComponent res) throws IOException, FHIRFormatError {
7787    parseBackboneProperties(json, res);
7788    if (json.has("identifier"))
7789      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7790    if (json.has("ref"))
7791      res.setRef(parseReference(json.getAsJsonObject("ref")));
7792  }
7793
7794  protected EligibilityRequest parseEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
7795    EligibilityRequest res = new EligibilityRequest();
7796    parseEligibilityRequestProperties(json, res);
7797    return res;
7798  }
7799
7800  protected void parseEligibilityRequestProperties(JsonObject json, EligibilityRequest res) throws IOException, FHIRFormatError {
7801    parseDomainResourceProperties(json, res);
7802    if (json.has("identifier")) {
7803      JsonArray array = json.getAsJsonArray("identifier");
7804      for (int i = 0; i < array.size(); i++) {
7805        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7806      }
7807    };
7808    if (json.has("status"))
7809      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityRequest.EligibilityRequestStatus.NULL, new EligibilityRequest.EligibilityRequestStatusEnumFactory()));
7810    if (json.has("_status"))
7811      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7812    if (json.has("priority"))
7813      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
7814    if (json.has("patient"))
7815      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7816    Type serviced = parseType("serviced", json);
7817    if (serviced != null)
7818      res.setServiced(serviced);
7819    if (json.has("created"))
7820      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7821    if (json.has("_created"))
7822      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7823    if (json.has("enterer"))
7824      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
7825    if (json.has("provider"))
7826      res.setProvider(parseReference(json.getAsJsonObject("provider")));
7827    if (json.has("organization"))
7828      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
7829    if (json.has("insurer"))
7830      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
7831    if (json.has("facility"))
7832      res.setFacility(parseReference(json.getAsJsonObject("facility")));
7833    if (json.has("coverage"))
7834      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
7835    if (json.has("businessArrangement"))
7836      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
7837    if (json.has("_businessArrangement"))
7838      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
7839    if (json.has("benefitCategory"))
7840      res.setBenefitCategory(parseCodeableConcept(json.getAsJsonObject("benefitCategory")));
7841    if (json.has("benefitSubCategory"))
7842      res.setBenefitSubCategory(parseCodeableConcept(json.getAsJsonObject("benefitSubCategory")));
7843  }
7844
7845  protected EligibilityResponse parseEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
7846    EligibilityResponse res = new EligibilityResponse();
7847    parseEligibilityResponseProperties(json, res);
7848    return res;
7849  }
7850
7851  protected void parseEligibilityResponseProperties(JsonObject json, EligibilityResponse res) throws IOException, FHIRFormatError {
7852    parseDomainResourceProperties(json, res);
7853    if (json.has("identifier")) {
7854      JsonArray array = json.getAsJsonArray("identifier");
7855      for (int i = 0; i < array.size(); i++) {
7856        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7857      }
7858    };
7859    if (json.has("status"))
7860      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EligibilityResponse.EligibilityResponseStatus.NULL, new EligibilityResponse.EligibilityResponseStatusEnumFactory()));
7861    if (json.has("_status"))
7862      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7863    if (json.has("created"))
7864      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
7865    if (json.has("_created"))
7866      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
7867    if (json.has("requestProvider"))
7868      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
7869    if (json.has("requestOrganization"))
7870      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
7871    if (json.has("request"))
7872      res.setRequest(parseReference(json.getAsJsonObject("request")));
7873    if (json.has("outcome"))
7874      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
7875    if (json.has("disposition"))
7876      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
7877    if (json.has("_disposition"))
7878      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
7879    if (json.has("insurer"))
7880      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
7881    if (json.has("inforce"))
7882      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
7883    if (json.has("_inforce"))
7884      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
7885    if (json.has("insurance")) {
7886      JsonArray array = json.getAsJsonArray("insurance");
7887      for (int i = 0; i < array.size(); i++) {
7888        res.getInsurance().add(parseEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
7889      }
7890    };
7891    if (json.has("form"))
7892      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
7893    if (json.has("error")) {
7894      JsonArray array = json.getAsJsonArray("error");
7895      for (int i = 0; i < array.size(); i++) {
7896        res.getError().add(parseEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
7897      }
7898    };
7899  }
7900
7901  protected EligibilityResponse.InsuranceComponent parseEligibilityResponseInsuranceComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7902    EligibilityResponse.InsuranceComponent res = new EligibilityResponse.InsuranceComponent();
7903    parseEligibilityResponseInsuranceComponentProperties(json, owner, res);
7904    return res;
7905  }
7906
7907  protected void parseEligibilityResponseInsuranceComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
7908    parseBackboneProperties(json, res);
7909    if (json.has("coverage"))
7910      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
7911    if (json.has("contract"))
7912      res.setContract(parseReference(json.getAsJsonObject("contract")));
7913    if (json.has("benefitBalance")) {
7914      JsonArray array = json.getAsJsonArray("benefitBalance");
7915      for (int i = 0; i < array.size(); i++) {
7916        res.getBenefitBalance().add(parseEligibilityResponseBenefitsComponent(array.get(i).getAsJsonObject(), owner));
7917      }
7918    };
7919  }
7920
7921  protected EligibilityResponse.BenefitsComponent parseEligibilityResponseBenefitsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7922    EligibilityResponse.BenefitsComponent res = new EligibilityResponse.BenefitsComponent();
7923    parseEligibilityResponseBenefitsComponentProperties(json, owner, res);
7924    return res;
7925  }
7926
7927  protected void parseEligibilityResponseBenefitsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitsComponent res) throws IOException, FHIRFormatError {
7928    parseBackboneProperties(json, res);
7929    if (json.has("category"))
7930      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
7931    if (json.has("subCategory"))
7932      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
7933    if (json.has("excluded"))
7934      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
7935    if (json.has("_excluded"))
7936      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
7937    if (json.has("name"))
7938      res.setNameElement(parseString(json.get("name").getAsString()));
7939    if (json.has("_name"))
7940      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7941    if (json.has("description"))
7942      res.setDescriptionElement(parseString(json.get("description").getAsString()));
7943    if (json.has("_description"))
7944      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
7945    if (json.has("network"))
7946      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
7947    if (json.has("unit"))
7948      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
7949    if (json.has("term"))
7950      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
7951    if (json.has("financial")) {
7952      JsonArray array = json.getAsJsonArray("financial");
7953      for (int i = 0; i < array.size(); i++) {
7954        res.getFinancial().add(parseEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
7955      }
7956    };
7957  }
7958
7959  protected EligibilityResponse.BenefitComponent parseEligibilityResponseBenefitComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7960    EligibilityResponse.BenefitComponent res = new EligibilityResponse.BenefitComponent();
7961    parseEligibilityResponseBenefitComponentProperties(json, owner, res);
7962    return res;
7963  }
7964
7965  protected void parseEligibilityResponseBenefitComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
7966    parseBackboneProperties(json, res);
7967    if (json.has("type"))
7968      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7969    Type allowed = parseType("allowed", json);
7970    if (allowed != null)
7971      res.setAllowed(allowed);
7972    Type used = parseType("used", json);
7973    if (used != null)
7974      res.setUsed(used);
7975  }
7976
7977  protected EligibilityResponse.ErrorsComponent parseEligibilityResponseErrorsComponent(JsonObject json, EligibilityResponse owner) throws IOException, FHIRFormatError {
7978    EligibilityResponse.ErrorsComponent res = new EligibilityResponse.ErrorsComponent();
7979    parseEligibilityResponseErrorsComponentProperties(json, owner, res);
7980    return res;
7981  }
7982
7983  protected void parseEligibilityResponseErrorsComponentProperties(JsonObject json, EligibilityResponse owner, EligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
7984    parseBackboneProperties(json, res);
7985    if (json.has("code"))
7986      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7987  }
7988
7989  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
7990    Encounter res = new Encounter();
7991    parseEncounterProperties(json, res);
7992    return res;
7993  }
7994
7995  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
7996    parseDomainResourceProperties(json, res);
7997    if (json.has("identifier")) {
7998      JsonArray array = json.getAsJsonArray("identifier");
7999      for (int i = 0; i < array.size(); i++) {
8000        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8001      }
8002    };
8003    if (json.has("status"))
8004      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8005    if (json.has("_status"))
8006      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8007    if (json.has("statusHistory")) {
8008      JsonArray array = json.getAsJsonArray("statusHistory");
8009      for (int i = 0; i < array.size(); i++) {
8010        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8011      }
8012    };
8013    if (json.has("class"))
8014      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8015    if (json.has("classHistory")) {
8016      JsonArray array = json.getAsJsonArray("classHistory");
8017      for (int i = 0; i < array.size(); i++) {
8018        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
8019      }
8020    };
8021    if (json.has("type")) {
8022      JsonArray array = json.getAsJsonArray("type");
8023      for (int i = 0; i < array.size(); i++) {
8024        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8025      }
8026    };
8027    if (json.has("priority"))
8028      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8029    if (json.has("subject"))
8030      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8031    if (json.has("episodeOfCare")) {
8032      JsonArray array = json.getAsJsonArray("episodeOfCare");
8033      for (int i = 0; i < array.size(); i++) {
8034        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
8035      }
8036    };
8037    if (json.has("incomingReferral")) {
8038      JsonArray array = json.getAsJsonArray("incomingReferral");
8039      for (int i = 0; i < array.size(); i++) {
8040        res.getIncomingReferral().add(parseReference(array.get(i).getAsJsonObject()));
8041      }
8042    };
8043    if (json.has("participant")) {
8044      JsonArray array = json.getAsJsonArray("participant");
8045      for (int i = 0; i < array.size(); i++) {
8046        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
8047      }
8048    };
8049    if (json.has("appointment"))
8050      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
8051    if (json.has("period"))
8052      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8053    if (json.has("length"))
8054      res.setLength(parseDuration(json.getAsJsonObject("length")));
8055    if (json.has("reason")) {
8056      JsonArray array = json.getAsJsonArray("reason");
8057      for (int i = 0; i < array.size(); i++) {
8058        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8059      }
8060    };
8061    if (json.has("diagnosis")) {
8062      JsonArray array = json.getAsJsonArray("diagnosis");
8063      for (int i = 0; i < array.size(); i++) {
8064        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8065      }
8066    };
8067    if (json.has("account")) {
8068      JsonArray array = json.getAsJsonArray("account");
8069      for (int i = 0; i < array.size(); i++) {
8070        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8071      }
8072    };
8073    if (json.has("hospitalization"))
8074      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
8075    if (json.has("location")) {
8076      JsonArray array = json.getAsJsonArray("location");
8077      for (int i = 0; i < array.size(); i++) {
8078        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
8079      }
8080    };
8081    if (json.has("serviceProvider"))
8082      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
8083    if (json.has("partOf"))
8084      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
8085  }
8086
8087  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8088    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
8089    parseEncounterStatusHistoryComponentProperties(json, owner, res);
8090    return res;
8091  }
8092
8093  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
8094    parseBackboneProperties(json, res);
8095    if (json.has("status"))
8096      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
8097    if (json.has("_status"))
8098      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8099    if (json.has("period"))
8100      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8101  }
8102
8103  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8104    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
8105    parseEncounterClassHistoryComponentProperties(json, owner, res);
8106    return res;
8107  }
8108
8109  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
8110    parseBackboneProperties(json, res);
8111    if (json.has("class"))
8112      res.setClass_(parseCoding(json.getAsJsonObject("class")));
8113    if (json.has("period"))
8114      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8115  }
8116
8117  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8118    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
8119    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
8120    return res;
8121  }
8122
8123  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
8124    parseBackboneProperties(json, res);
8125    if (json.has("type")) {
8126      JsonArray array = json.getAsJsonArray("type");
8127      for (int i = 0; i < array.size(); i++) {
8128        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8129      }
8130    };
8131    if (json.has("period"))
8132      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8133    if (json.has("individual"))
8134      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
8135  }
8136
8137  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8138    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
8139    parseEncounterDiagnosisComponentProperties(json, owner, res);
8140    return res;
8141  }
8142
8143  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
8144    parseBackboneProperties(json, res);
8145    if (json.has("condition"))
8146      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8147    if (json.has("role"))
8148      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8149    if (json.has("rank"))
8150      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8151    if (json.has("_rank"))
8152      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8153  }
8154
8155  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8156    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
8157    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
8158    return res;
8159  }
8160
8161  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
8162    parseBackboneProperties(json, res);
8163    if (json.has("preAdmissionIdentifier"))
8164      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
8165    if (json.has("origin"))
8166      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
8167    if (json.has("admitSource"))
8168      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
8169    if (json.has("reAdmission"))
8170      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
8171    if (json.has("dietPreference")) {
8172      JsonArray array = json.getAsJsonArray("dietPreference");
8173      for (int i = 0; i < array.size(); i++) {
8174        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8175      }
8176    };
8177    if (json.has("specialCourtesy")) {
8178      JsonArray array = json.getAsJsonArray("specialCourtesy");
8179      for (int i = 0; i < array.size(); i++) {
8180        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8181      }
8182    };
8183    if (json.has("specialArrangement")) {
8184      JsonArray array = json.getAsJsonArray("specialArrangement");
8185      for (int i = 0; i < array.size(); i++) {
8186        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8187      }
8188    };
8189    if (json.has("destination"))
8190      res.setDestination(parseReference(json.getAsJsonObject("destination")));
8191    if (json.has("dischargeDisposition"))
8192      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
8193  }
8194
8195  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
8196    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
8197    parseEncounterEncounterLocationComponentProperties(json, owner, res);
8198    return res;
8199  }
8200
8201  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
8202    parseBackboneProperties(json, res);
8203    if (json.has("location"))
8204      res.setLocation(parseReference(json.getAsJsonObject("location")));
8205    if (json.has("status"))
8206      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
8207    if (json.has("_status"))
8208      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8209    if (json.has("period"))
8210      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8211  }
8212
8213  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
8214    Endpoint res = new Endpoint();
8215    parseEndpointProperties(json, res);
8216    return res;
8217  }
8218
8219  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
8220    parseDomainResourceProperties(json, res);
8221    if (json.has("identifier")) {
8222      JsonArray array = json.getAsJsonArray("identifier");
8223      for (int i = 0; i < array.size(); i++) {
8224        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8225      }
8226    };
8227    if (json.has("status"))
8228      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
8229    if (json.has("_status"))
8230      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8231    if (json.has("connectionType"))
8232      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
8233    if (json.has("name"))
8234      res.setNameElement(parseString(json.get("name").getAsString()));
8235    if (json.has("_name"))
8236      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8237    if (json.has("managingOrganization"))
8238      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8239    if (json.has("contact")) {
8240      JsonArray array = json.getAsJsonArray("contact");
8241      for (int i = 0; i < array.size(); i++) {
8242        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8243      }
8244    };
8245    if (json.has("period"))
8246      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8247    if (json.has("payloadType")) {
8248      JsonArray array = json.getAsJsonArray("payloadType");
8249      for (int i = 0; i < array.size(); i++) {
8250        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8251      }
8252    };
8253    if (json.has("payloadMimeType")) {
8254      JsonArray array = json.getAsJsonArray("payloadMimeType");
8255      for (int i = 0; i < array.size(); i++) {
8256        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
8257      }
8258    };
8259    if (json.has("_payloadMimeType")) {
8260      JsonArray array = json.getAsJsonArray("_payloadMimeType");
8261      for (int i = 0; i < array.size(); i++) {
8262        if (i == res.getPayloadMimeType().size())
8263          res.getPayloadMimeType().add(parseCode(null));
8264        if (array.get(i) instanceof JsonObject) 
8265          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
8266      }
8267    };
8268    if (json.has("address"))
8269      res.setAddressElement(parseUri(json.get("address").getAsString()));
8270    if (json.has("_address"))
8271      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
8272    if (json.has("header")) {
8273      JsonArray array = json.getAsJsonArray("header");
8274      for (int i = 0; i < array.size(); i++) {
8275        res.getHeader().add(parseString(array.get(i).getAsString()));
8276      }
8277    };
8278    if (json.has("_header")) {
8279      JsonArray array = json.getAsJsonArray("_header");
8280      for (int i = 0; i < array.size(); i++) {
8281        if (i == res.getHeader().size())
8282          res.getHeader().add(parseString(null));
8283        if (array.get(i) instanceof JsonObject) 
8284          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
8285      }
8286    };
8287  }
8288
8289  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
8290    EnrollmentRequest res = new EnrollmentRequest();
8291    parseEnrollmentRequestProperties(json, res);
8292    return res;
8293  }
8294
8295  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
8296    parseDomainResourceProperties(json, res);
8297    if (json.has("identifier")) {
8298      JsonArray array = json.getAsJsonArray("identifier");
8299      for (int i = 0; i < array.size(); i++) {
8300        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8301      }
8302    };
8303    if (json.has("status"))
8304      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
8305    if (json.has("_status"))
8306      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8307    if (json.has("created"))
8308      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8309    if (json.has("_created"))
8310      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8311    if (json.has("insurer"))
8312      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8313    if (json.has("provider"))
8314      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8315    if (json.has("organization"))
8316      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8317    if (json.has("subject"))
8318      res.setSubject(parseReference(json.getAsJsonObject("subject")));
8319    if (json.has("coverage"))
8320      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8321  }
8322
8323  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
8324    EnrollmentResponse res = new EnrollmentResponse();
8325    parseEnrollmentResponseProperties(json, res);
8326    return res;
8327  }
8328
8329  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
8330    parseDomainResourceProperties(json, res);
8331    if (json.has("identifier")) {
8332      JsonArray array = json.getAsJsonArray("identifier");
8333      for (int i = 0; i < array.size(); i++) {
8334        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8335      }
8336    };
8337    if (json.has("status"))
8338      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
8339    if (json.has("_status"))
8340      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8341    if (json.has("request"))
8342      res.setRequest(parseReference(json.getAsJsonObject("request")));
8343    if (json.has("outcome"))
8344      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8345    if (json.has("disposition"))
8346      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8347    if (json.has("_disposition"))
8348      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8349    if (json.has("created"))
8350      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8351    if (json.has("_created"))
8352      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8353    if (json.has("organization"))
8354      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8355    if (json.has("requestProvider"))
8356      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8357    if (json.has("requestOrganization"))
8358      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
8359  }
8360
8361  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
8362    EpisodeOfCare res = new EpisodeOfCare();
8363    parseEpisodeOfCareProperties(json, res);
8364    return res;
8365  }
8366
8367  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
8368    parseDomainResourceProperties(json, res);
8369    if (json.has("identifier")) {
8370      JsonArray array = json.getAsJsonArray("identifier");
8371      for (int i = 0; i < array.size(); i++) {
8372        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8373      }
8374    };
8375    if (json.has("status"))
8376      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8377    if (json.has("_status"))
8378      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8379    if (json.has("statusHistory")) {
8380      JsonArray array = json.getAsJsonArray("statusHistory");
8381      for (int i = 0; i < array.size(); i++) {
8382        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
8383      }
8384    };
8385    if (json.has("type")) {
8386      JsonArray array = json.getAsJsonArray("type");
8387      for (int i = 0; i < array.size(); i++) {
8388        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8389      }
8390    };
8391    if (json.has("diagnosis")) {
8392      JsonArray array = json.getAsJsonArray("diagnosis");
8393      for (int i = 0; i < array.size(); i++) {
8394        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8395      }
8396    };
8397    if (json.has("patient"))
8398      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8399    if (json.has("managingOrganization"))
8400      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
8401    if (json.has("period"))
8402      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8403    if (json.has("referralRequest")) {
8404      JsonArray array = json.getAsJsonArray("referralRequest");
8405      for (int i = 0; i < array.size(); i++) {
8406        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
8407      }
8408    };
8409    if (json.has("careManager"))
8410      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
8411    if (json.has("team")) {
8412      JsonArray array = json.getAsJsonArray("team");
8413      for (int i = 0; i < array.size(); i++) {
8414        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
8415      }
8416    };
8417    if (json.has("account")) {
8418      JsonArray array = json.getAsJsonArray("account");
8419      for (int i = 0; i < array.size(); i++) {
8420        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
8421      }
8422    };
8423  }
8424
8425  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8426    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
8427    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
8428    return res;
8429  }
8430
8431  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
8432    parseBackboneProperties(json, res);
8433    if (json.has("status"))
8434      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
8435    if (json.has("_status"))
8436      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8437    if (json.has("period"))
8438      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8439  }
8440
8441  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
8442    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
8443    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
8444    return res;
8445  }
8446
8447  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
8448    parseBackboneProperties(json, res);
8449    if (json.has("condition"))
8450      res.setCondition(parseReference(json.getAsJsonObject("condition")));
8451    if (json.has("role"))
8452      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8453    if (json.has("rank"))
8454      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
8455    if (json.has("_rank"))
8456      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
8457  }
8458
8459  protected ExpansionProfile parseExpansionProfile(JsonObject json) throws IOException, FHIRFormatError {
8460    ExpansionProfile res = new ExpansionProfile();
8461    parseExpansionProfileProperties(json, res);
8462    return res;
8463  }
8464
8465  protected void parseExpansionProfileProperties(JsonObject json, ExpansionProfile res) throws IOException, FHIRFormatError {
8466    parseDomainResourceProperties(json, res);
8467    if (json.has("url"))
8468      res.setUrlElement(parseUri(json.get("url").getAsString()));
8469    if (json.has("_url"))
8470      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8471    if (json.has("identifier"))
8472      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
8473    if (json.has("version"))
8474      res.setVersionElement(parseString(json.get("version").getAsString()));
8475    if (json.has("_version"))
8476      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8477    if (json.has("name"))
8478      res.setNameElement(parseString(json.get("name").getAsString()));
8479    if (json.has("_name"))
8480      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8481    if (json.has("status"))
8482      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8483    if (json.has("_status"))
8484      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8485    if (json.has("experimental"))
8486      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
8487    if (json.has("_experimental"))
8488      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
8489    if (json.has("date"))
8490      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8491    if (json.has("_date"))
8492      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8493    if (json.has("publisher"))
8494      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
8495    if (json.has("_publisher"))
8496      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
8497    if (json.has("contact")) {
8498      JsonArray array = json.getAsJsonArray("contact");
8499      for (int i = 0; i < array.size(); i++) {
8500        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
8501      }
8502    };
8503    if (json.has("description"))
8504      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
8505    if (json.has("_description"))
8506      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8507    if (json.has("useContext")) {
8508      JsonArray array = json.getAsJsonArray("useContext");
8509      for (int i = 0; i < array.size(); i++) {
8510        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
8511      }
8512    };
8513    if (json.has("jurisdiction")) {
8514      JsonArray array = json.getAsJsonArray("jurisdiction");
8515      for (int i = 0; i < array.size(); i++) {
8516        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8517      }
8518    };
8519    if (json.has("fixedVersion")) {
8520      JsonArray array = json.getAsJsonArray("fixedVersion");
8521      for (int i = 0; i < array.size(); i++) {
8522        res.getFixedVersion().add(parseExpansionProfileExpansionProfileFixedVersionComponent(array.get(i).getAsJsonObject(), res));
8523      }
8524    };
8525    if (json.has("excludedSystem"))
8526      res.setExcludedSystem(parseExpansionProfileExpansionProfileExcludedSystemComponent(json.getAsJsonObject("excludedSystem"), res));
8527    if (json.has("includeDesignations"))
8528      res.setIncludeDesignationsElement(parseBoolean(json.get("includeDesignations").getAsBoolean()));
8529    if (json.has("_includeDesignations"))
8530      parseElementProperties(json.getAsJsonObject("_includeDesignations"), res.getIncludeDesignationsElement());
8531    if (json.has("designation"))
8532      res.setDesignation(parseExpansionProfileExpansionProfileDesignationComponent(json.getAsJsonObject("designation"), res));
8533    if (json.has("includeDefinition"))
8534      res.setIncludeDefinitionElement(parseBoolean(json.get("includeDefinition").getAsBoolean()));
8535    if (json.has("_includeDefinition"))
8536      parseElementProperties(json.getAsJsonObject("_includeDefinition"), res.getIncludeDefinitionElement());
8537    if (json.has("activeOnly"))
8538      res.setActiveOnlyElement(parseBoolean(json.get("activeOnly").getAsBoolean()));
8539    if (json.has("_activeOnly"))
8540      parseElementProperties(json.getAsJsonObject("_activeOnly"), res.getActiveOnlyElement());
8541    if (json.has("excludeNested"))
8542      res.setExcludeNestedElement(parseBoolean(json.get("excludeNested").getAsBoolean()));
8543    if (json.has("_excludeNested"))
8544      parseElementProperties(json.getAsJsonObject("_excludeNested"), res.getExcludeNestedElement());
8545    if (json.has("excludeNotForUI"))
8546      res.setExcludeNotForUIElement(parseBoolean(json.get("excludeNotForUI").getAsBoolean()));
8547    if (json.has("_excludeNotForUI"))
8548      parseElementProperties(json.getAsJsonObject("_excludeNotForUI"), res.getExcludeNotForUIElement());
8549    if (json.has("excludePostCoordinated"))
8550      res.setExcludePostCoordinatedElement(parseBoolean(json.get("excludePostCoordinated").getAsBoolean()));
8551    if (json.has("_excludePostCoordinated"))
8552      parseElementProperties(json.getAsJsonObject("_excludePostCoordinated"), res.getExcludePostCoordinatedElement());
8553    if (json.has("displayLanguage"))
8554      res.setDisplayLanguageElement(parseCode(json.get("displayLanguage").getAsString()));
8555    if (json.has("_displayLanguage"))
8556      parseElementProperties(json.getAsJsonObject("_displayLanguage"), res.getDisplayLanguageElement());
8557    if (json.has("limitedExpansion"))
8558      res.setLimitedExpansionElement(parseBoolean(json.get("limitedExpansion").getAsBoolean()));
8559    if (json.has("_limitedExpansion"))
8560      parseElementProperties(json.getAsJsonObject("_limitedExpansion"), res.getLimitedExpansionElement());
8561  }
8562
8563  protected ExpansionProfile.ExpansionProfileFixedVersionComponent parseExpansionProfileExpansionProfileFixedVersionComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8564    ExpansionProfile.ExpansionProfileFixedVersionComponent res = new ExpansionProfile.ExpansionProfileFixedVersionComponent();
8565    parseExpansionProfileExpansionProfileFixedVersionComponentProperties(json, owner, res);
8566    return res;
8567  }
8568
8569  protected void parseExpansionProfileExpansionProfileFixedVersionComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileFixedVersionComponent res) throws IOException, FHIRFormatError {
8570    parseBackboneProperties(json, res);
8571    if (json.has("system"))
8572      res.setSystemElement(parseUri(json.get("system").getAsString()));
8573    if (json.has("_system"))
8574      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8575    if (json.has("version"))
8576      res.setVersionElement(parseString(json.get("version").getAsString()));
8577    if (json.has("_version"))
8578      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8579    if (json.has("mode"))
8580      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ExpansionProfile.SystemVersionProcessingMode.NULL, new ExpansionProfile.SystemVersionProcessingModeEnumFactory()));
8581    if (json.has("_mode"))
8582      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
8583  }
8584
8585  protected ExpansionProfile.ExpansionProfileExcludedSystemComponent parseExpansionProfileExpansionProfileExcludedSystemComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8586    ExpansionProfile.ExpansionProfileExcludedSystemComponent res = new ExpansionProfile.ExpansionProfileExcludedSystemComponent();
8587    parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(json, owner, res);
8588    return res;
8589  }
8590
8591  protected void parseExpansionProfileExpansionProfileExcludedSystemComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileExcludedSystemComponent res) throws IOException, FHIRFormatError {
8592    parseBackboneProperties(json, res);
8593    if (json.has("system"))
8594      res.setSystemElement(parseUri(json.get("system").getAsString()));
8595    if (json.has("_system"))
8596      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
8597    if (json.has("version"))
8598      res.setVersionElement(parseString(json.get("version").getAsString()));
8599    if (json.has("_version"))
8600      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8601  }
8602
8603  protected ExpansionProfile.ExpansionProfileDesignationComponent parseExpansionProfileExpansionProfileDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8604    ExpansionProfile.ExpansionProfileDesignationComponent res = new ExpansionProfile.ExpansionProfileDesignationComponent();
8605    parseExpansionProfileExpansionProfileDesignationComponentProperties(json, owner, res);
8606    return res;
8607  }
8608
8609  protected void parseExpansionProfileExpansionProfileDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.ExpansionProfileDesignationComponent res) throws IOException, FHIRFormatError {
8610    parseBackboneProperties(json, res);
8611    if (json.has("include"))
8612      res.setInclude(parseExpansionProfileDesignationIncludeComponent(json.getAsJsonObject("include"), owner));
8613    if (json.has("exclude"))
8614      res.setExclude(parseExpansionProfileDesignationExcludeComponent(json.getAsJsonObject("exclude"), owner));
8615  }
8616
8617  protected ExpansionProfile.DesignationIncludeComponent parseExpansionProfileDesignationIncludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8618    ExpansionProfile.DesignationIncludeComponent res = new ExpansionProfile.DesignationIncludeComponent();
8619    parseExpansionProfileDesignationIncludeComponentProperties(json, owner, res);
8620    return res;
8621  }
8622
8623  protected void parseExpansionProfileDesignationIncludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeComponent res) throws IOException, FHIRFormatError {
8624    parseBackboneProperties(json, res);
8625    if (json.has("designation")) {
8626      JsonArray array = json.getAsJsonArray("designation");
8627      for (int i = 0; i < array.size(); i++) {
8628        res.getDesignation().add(parseExpansionProfileDesignationIncludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8629      }
8630    };
8631  }
8632
8633  protected ExpansionProfile.DesignationIncludeDesignationComponent parseExpansionProfileDesignationIncludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8634    ExpansionProfile.DesignationIncludeDesignationComponent res = new ExpansionProfile.DesignationIncludeDesignationComponent();
8635    parseExpansionProfileDesignationIncludeDesignationComponentProperties(json, owner, res);
8636    return res;
8637  }
8638
8639  protected void parseExpansionProfileDesignationIncludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationIncludeDesignationComponent res) throws IOException, FHIRFormatError {
8640    parseBackboneProperties(json, res);
8641    if (json.has("language"))
8642      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8643    if (json.has("_language"))
8644      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
8645    if (json.has("use"))
8646      res.setUse(parseCoding(json.getAsJsonObject("use")));
8647  }
8648
8649  protected ExpansionProfile.DesignationExcludeComponent parseExpansionProfileDesignationExcludeComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8650    ExpansionProfile.DesignationExcludeComponent res = new ExpansionProfile.DesignationExcludeComponent();
8651    parseExpansionProfileDesignationExcludeComponentProperties(json, owner, res);
8652    return res;
8653  }
8654
8655  protected void parseExpansionProfileDesignationExcludeComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeComponent res) throws IOException, FHIRFormatError {
8656    parseBackboneProperties(json, res);
8657    if (json.has("designation")) {
8658      JsonArray array = json.getAsJsonArray("designation");
8659      for (int i = 0; i < array.size(); i++) {
8660        res.getDesignation().add(parseExpansionProfileDesignationExcludeDesignationComponent(array.get(i).getAsJsonObject(), owner));
8661      }
8662    };
8663  }
8664
8665  protected ExpansionProfile.DesignationExcludeDesignationComponent parseExpansionProfileDesignationExcludeDesignationComponent(JsonObject json, ExpansionProfile owner) throws IOException, FHIRFormatError {
8666    ExpansionProfile.DesignationExcludeDesignationComponent res = new ExpansionProfile.DesignationExcludeDesignationComponent();
8667    parseExpansionProfileDesignationExcludeDesignationComponentProperties(json, owner, res);
8668    return res;
8669  }
8670
8671  protected void parseExpansionProfileDesignationExcludeDesignationComponentProperties(JsonObject json, ExpansionProfile owner, ExpansionProfile.DesignationExcludeDesignationComponent res) throws IOException, FHIRFormatError {
8672    parseBackboneProperties(json, res);
8673    if (json.has("language"))
8674      res.setLanguageElement(parseCode(json.get("language").getAsString()));
8675    if (json.has("_language"))
8676      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
8677    if (json.has("use"))
8678      res.setUse(parseCoding(json.getAsJsonObject("use")));
8679  }
8680
8681  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
8682    ExplanationOfBenefit res = new ExplanationOfBenefit();
8683    parseExplanationOfBenefitProperties(json, res);
8684    return res;
8685  }
8686
8687  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
8688    parseDomainResourceProperties(json, res);
8689    if (json.has("identifier")) {
8690      JsonArray array = json.getAsJsonArray("identifier");
8691      for (int i = 0; i < array.size(); i++) {
8692        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8693      }
8694    };
8695    if (json.has("status"))
8696      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
8697    if (json.has("_status"))
8698      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8699    if (json.has("type"))
8700      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8701    if (json.has("subType")) {
8702      JsonArray array = json.getAsJsonArray("subType");
8703      for (int i = 0; i < array.size(); i++) {
8704        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8705      }
8706    };
8707    if (json.has("patient"))
8708      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8709    if (json.has("billablePeriod"))
8710      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
8711    if (json.has("created"))
8712      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8713    if (json.has("_created"))
8714      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8715    if (json.has("enterer"))
8716      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8717    if (json.has("insurer"))
8718      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8719    if (json.has("provider"))
8720      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8721    if (json.has("organization"))
8722      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
8723    if (json.has("referral"))
8724      res.setReferral(parseReference(json.getAsJsonObject("referral")));
8725    if (json.has("facility"))
8726      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8727    if (json.has("claim"))
8728      res.setClaim(parseReference(json.getAsJsonObject("claim")));
8729    if (json.has("claimResponse"))
8730      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
8731    if (json.has("outcome"))
8732      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
8733    if (json.has("disposition"))
8734      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8735    if (json.has("_disposition"))
8736      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8737    if (json.has("related")) {
8738      JsonArray array = json.getAsJsonArray("related");
8739      for (int i = 0; i < array.size(); i++) {
8740        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
8741      }
8742    };
8743    if (json.has("prescription"))
8744      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
8745    if (json.has("originalPrescription"))
8746      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
8747    if (json.has("payee"))
8748      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
8749    if (json.has("information")) {
8750      JsonArray array = json.getAsJsonArray("information");
8751      for (int i = 0; i < array.size(); i++) {
8752        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
8753      }
8754    };
8755    if (json.has("careTeam")) {
8756      JsonArray array = json.getAsJsonArray("careTeam");
8757      for (int i = 0; i < array.size(); i++) {
8758        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
8759      }
8760    };
8761    if (json.has("diagnosis")) {
8762      JsonArray array = json.getAsJsonArray("diagnosis");
8763      for (int i = 0; i < array.size(); i++) {
8764        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
8765      }
8766    };
8767    if (json.has("procedure")) {
8768      JsonArray array = json.getAsJsonArray("procedure");
8769      for (int i = 0; i < array.size(); i++) {
8770        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
8771      }
8772    };
8773    if (json.has("precedence"))
8774      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
8775    if (json.has("_precedence"))
8776      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
8777    if (json.has("insurance"))
8778      res.setInsurance(parseExplanationOfBenefitInsuranceComponent(json.getAsJsonObject("insurance"), res));
8779    if (json.has("accident"))
8780      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
8781    if (json.has("employmentImpacted"))
8782      res.setEmploymentImpacted(parsePeriod(json.getAsJsonObject("employmentImpacted")));
8783    if (json.has("hospitalization"))
8784      res.setHospitalization(parsePeriod(json.getAsJsonObject("hospitalization")));
8785    if (json.has("item")) {
8786      JsonArray array = json.getAsJsonArray("item");
8787      for (int i = 0; i < array.size(); i++) {
8788        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
8789      }
8790    };
8791    if (json.has("addItem")) {
8792      JsonArray array = json.getAsJsonArray("addItem");
8793      for (int i = 0; i < array.size(); i++) {
8794        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
8795      }
8796    };
8797    if (json.has("totalCost"))
8798      res.setTotalCost(parseMoney(json.getAsJsonObject("totalCost")));
8799    if (json.has("unallocDeductable"))
8800      res.setUnallocDeductable(parseMoney(json.getAsJsonObject("unallocDeductable")));
8801    if (json.has("totalBenefit"))
8802      res.setTotalBenefit(parseMoney(json.getAsJsonObject("totalBenefit")));
8803    if (json.has("payment"))
8804      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
8805    if (json.has("form"))
8806      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8807    if (json.has("processNote")) {
8808      JsonArray array = json.getAsJsonArray("processNote");
8809      for (int i = 0; i < array.size(); i++) {
8810        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
8811      }
8812    };
8813    if (json.has("benefitBalance")) {
8814      JsonArray array = json.getAsJsonArray("benefitBalance");
8815      for (int i = 0; i < array.size(); i++) {
8816        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
8817      }
8818    };
8819  }
8820
8821  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8822    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
8823    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
8824    return res;
8825  }
8826
8827  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
8828    parseBackboneProperties(json, res);
8829    if (json.has("claim"))
8830      res.setClaim(parseReference(json.getAsJsonObject("claim")));
8831    if (json.has("relationship"))
8832      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
8833    if (json.has("reference"))
8834      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
8835  }
8836
8837  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8838    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
8839    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
8840    return res;
8841  }
8842
8843  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
8844    parseBackboneProperties(json, res);
8845    if (json.has("type"))
8846      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8847    if (json.has("resourceType"))
8848      res.setResourceType(parseCodeableConcept(json.getAsJsonObject("resourceType")));
8849    if (json.has("party"))
8850      res.setParty(parseReference(json.getAsJsonObject("party")));
8851  }
8852
8853  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8854    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
8855    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
8856    return res;
8857  }
8858
8859  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
8860    parseBackboneProperties(json, res);
8861    if (json.has("sequence"))
8862      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8863    if (json.has("_sequence"))
8864      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8865    if (json.has("category"))
8866      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8867    if (json.has("code"))
8868      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8869    Type timing = parseType("timing", json);
8870    if (timing != null)
8871      res.setTiming(timing);
8872    Type value = parseType("value", json);
8873    if (value != null)
8874      res.setValue(value);
8875    if (json.has("reason"))
8876      res.setReason(parseCoding(json.getAsJsonObject("reason")));
8877  }
8878
8879  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8880    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
8881    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
8882    return res;
8883  }
8884
8885  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
8886    parseBackboneProperties(json, res);
8887    if (json.has("sequence"))
8888      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8889    if (json.has("_sequence"))
8890      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8891    if (json.has("provider"))
8892      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8893    if (json.has("responsible"))
8894      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
8895    if (json.has("_responsible"))
8896      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
8897    if (json.has("role"))
8898      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8899    if (json.has("qualification"))
8900      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
8901  }
8902
8903  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8904    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
8905    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
8906    return res;
8907  }
8908
8909  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
8910    parseBackboneProperties(json, res);
8911    if (json.has("sequence"))
8912      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8913    if (json.has("_sequence"))
8914      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8915    Type diagnosis = parseType("diagnosis", json);
8916    if (diagnosis != null)
8917      res.setDiagnosis(diagnosis);
8918    if (json.has("type")) {
8919      JsonArray array = json.getAsJsonArray("type");
8920      for (int i = 0; i < array.size(); i++) {
8921        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8922      }
8923    };
8924    if (json.has("packageCode"))
8925      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
8926  }
8927
8928  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8929    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
8930    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
8931    return res;
8932  }
8933
8934  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
8935    parseBackboneProperties(json, res);
8936    if (json.has("sequence"))
8937      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8938    if (json.has("_sequence"))
8939      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8940    if (json.has("date"))
8941      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8942    if (json.has("_date"))
8943      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8944    Type procedure = parseType("procedure", json);
8945    if (procedure != null)
8946      res.setProcedure(procedure);
8947  }
8948
8949  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8950    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
8951    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
8952    return res;
8953  }
8954
8955  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
8956    parseBackboneProperties(json, res);
8957    if (json.has("coverage"))
8958      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8959    if (json.has("preAuthRef")) {
8960      JsonArray array = json.getAsJsonArray("preAuthRef");
8961      for (int i = 0; i < array.size(); i++) {
8962        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
8963      }
8964    };
8965    if (json.has("_preAuthRef")) {
8966      JsonArray array = json.getAsJsonArray("_preAuthRef");
8967      for (int i = 0; i < array.size(); i++) {
8968        if (i == res.getPreAuthRef().size())
8969          res.getPreAuthRef().add(parseString(null));
8970        if (array.get(i) instanceof JsonObject) 
8971          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
8972      }
8973    };
8974  }
8975
8976  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8977    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
8978    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
8979    return res;
8980  }
8981
8982  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
8983    parseBackboneProperties(json, res);
8984    if (json.has("date"))
8985      res.setDateElement(parseDate(json.get("date").getAsString()));
8986    if (json.has("_date"))
8987      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8988    if (json.has("type"))
8989      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8990    Type location = parseType("location", json);
8991    if (location != null)
8992      res.setLocation(location);
8993  }
8994
8995  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
8996    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
8997    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
8998    return res;
8999  }
9000
9001  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
9002    parseBackboneProperties(json, res);
9003    if (json.has("sequence"))
9004      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9005    if (json.has("_sequence"))
9006      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9007    if (json.has("careTeamLinkId")) {
9008      JsonArray array = json.getAsJsonArray("careTeamLinkId");
9009      for (int i = 0; i < array.size(); i++) {
9010        res.getCareTeamLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9011      }
9012    };
9013    if (json.has("_careTeamLinkId")) {
9014      JsonArray array = json.getAsJsonArray("_careTeamLinkId");
9015      for (int i = 0; i < array.size(); i++) {
9016        if (i == res.getCareTeamLinkId().size())
9017          res.getCareTeamLinkId().add(parsePositiveInt(null));
9018        if (array.get(i) instanceof JsonObject) 
9019          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamLinkId().get(i));
9020      }
9021    };
9022    if (json.has("diagnosisLinkId")) {
9023      JsonArray array = json.getAsJsonArray("diagnosisLinkId");
9024      for (int i = 0; i < array.size(); i++) {
9025        res.getDiagnosisLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9026      }
9027    };
9028    if (json.has("_diagnosisLinkId")) {
9029      JsonArray array = json.getAsJsonArray("_diagnosisLinkId");
9030      for (int i = 0; i < array.size(); i++) {
9031        if (i == res.getDiagnosisLinkId().size())
9032          res.getDiagnosisLinkId().add(parsePositiveInt(null));
9033        if (array.get(i) instanceof JsonObject) 
9034          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisLinkId().get(i));
9035      }
9036    };
9037    if (json.has("procedureLinkId")) {
9038      JsonArray array = json.getAsJsonArray("procedureLinkId");
9039      for (int i = 0; i < array.size(); i++) {
9040        res.getProcedureLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9041      }
9042    };
9043    if (json.has("_procedureLinkId")) {
9044      JsonArray array = json.getAsJsonArray("_procedureLinkId");
9045      for (int i = 0; i < array.size(); i++) {
9046        if (i == res.getProcedureLinkId().size())
9047          res.getProcedureLinkId().add(parsePositiveInt(null));
9048        if (array.get(i) instanceof JsonObject) 
9049          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureLinkId().get(i));
9050      }
9051    };
9052    if (json.has("informationLinkId")) {
9053      JsonArray array = json.getAsJsonArray("informationLinkId");
9054      for (int i = 0; i < array.size(); i++) {
9055        res.getInformationLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9056      }
9057    };
9058    if (json.has("_informationLinkId")) {
9059      JsonArray array = json.getAsJsonArray("_informationLinkId");
9060      for (int i = 0; i < array.size(); i++) {
9061        if (i == res.getInformationLinkId().size())
9062          res.getInformationLinkId().add(parsePositiveInt(null));
9063        if (array.get(i) instanceof JsonObject) 
9064          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationLinkId().get(i));
9065      }
9066    };
9067    if (json.has("revenue"))
9068      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9069    if (json.has("category"))
9070      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9071    if (json.has("service"))
9072      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9073    if (json.has("modifier")) {
9074      JsonArray array = json.getAsJsonArray("modifier");
9075      for (int i = 0; i < array.size(); i++) {
9076        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9077      }
9078    };
9079    if (json.has("programCode")) {
9080      JsonArray array = json.getAsJsonArray("programCode");
9081      for (int i = 0; i < array.size(); i++) {
9082        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9083      }
9084    };
9085    Type serviced = parseType("serviced", json);
9086    if (serviced != null)
9087      res.setServiced(serviced);
9088    Type location = parseType("location", json);
9089    if (location != null)
9090      res.setLocation(location);
9091    if (json.has("quantity"))
9092      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9093    if (json.has("unitPrice"))
9094      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9095    if (json.has("factor"))
9096      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9097    if (json.has("_factor"))
9098      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9099    if (json.has("net"))
9100      res.setNet(parseMoney(json.getAsJsonObject("net")));
9101    if (json.has("udi")) {
9102      JsonArray array = json.getAsJsonArray("udi");
9103      for (int i = 0; i < array.size(); i++) {
9104        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9105      }
9106    };
9107    if (json.has("bodySite"))
9108      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9109    if (json.has("subSite")) {
9110      JsonArray array = json.getAsJsonArray("subSite");
9111      for (int i = 0; i < array.size(); i++) {
9112        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9113      }
9114    };
9115    if (json.has("encounter")) {
9116      JsonArray array = json.getAsJsonArray("encounter");
9117      for (int i = 0; i < array.size(); i++) {
9118        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9119      }
9120    };
9121    if (json.has("noteNumber")) {
9122      JsonArray array = json.getAsJsonArray("noteNumber");
9123      for (int i = 0; i < array.size(); i++) {
9124        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9125      }
9126    };
9127    if (json.has("_noteNumber")) {
9128      JsonArray array = json.getAsJsonArray("_noteNumber");
9129      for (int i = 0; i < array.size(); i++) {
9130        if (i == res.getNoteNumber().size())
9131          res.getNoteNumber().add(parsePositiveInt(null));
9132        if (array.get(i) instanceof JsonObject) 
9133          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9134      }
9135    };
9136    if (json.has("adjudication")) {
9137      JsonArray array = json.getAsJsonArray("adjudication");
9138      for (int i = 0; i < array.size(); i++) {
9139        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9140      }
9141    };
9142    if (json.has("detail")) {
9143      JsonArray array = json.getAsJsonArray("detail");
9144      for (int i = 0; i < array.size(); i++) {
9145        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
9146      }
9147    };
9148  }
9149
9150  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9151    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
9152    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
9153    return res;
9154  }
9155
9156  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
9157    parseBackboneProperties(json, res);
9158    if (json.has("category"))
9159      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9160    if (json.has("reason"))
9161      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
9162    if (json.has("amount"))
9163      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
9164    if (json.has("value"))
9165      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
9166    if (json.has("_value"))
9167      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
9168  }
9169
9170  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9171    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
9172    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
9173    return res;
9174  }
9175
9176  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
9177    parseBackboneProperties(json, res);
9178    if (json.has("sequence"))
9179      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9180    if (json.has("_sequence"))
9181      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9182    if (json.has("type"))
9183      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9184    if (json.has("revenue"))
9185      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9186    if (json.has("category"))
9187      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9188    if (json.has("service"))
9189      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9190    if (json.has("modifier")) {
9191      JsonArray array = json.getAsJsonArray("modifier");
9192      for (int i = 0; i < array.size(); i++) {
9193        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9194      }
9195    };
9196    if (json.has("programCode")) {
9197      JsonArray array = json.getAsJsonArray("programCode");
9198      for (int i = 0; i < array.size(); i++) {
9199        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9200      }
9201    };
9202    if (json.has("quantity"))
9203      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9204    if (json.has("unitPrice"))
9205      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9206    if (json.has("factor"))
9207      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9208    if (json.has("_factor"))
9209      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9210    if (json.has("net"))
9211      res.setNet(parseMoney(json.getAsJsonObject("net")));
9212    if (json.has("udi")) {
9213      JsonArray array = json.getAsJsonArray("udi");
9214      for (int i = 0; i < array.size(); i++) {
9215        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9216      }
9217    };
9218    if (json.has("noteNumber")) {
9219      JsonArray array = json.getAsJsonArray("noteNumber");
9220      for (int i = 0; i < array.size(); i++) {
9221        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9222      }
9223    };
9224    if (json.has("_noteNumber")) {
9225      JsonArray array = json.getAsJsonArray("_noteNumber");
9226      for (int i = 0; i < array.size(); i++) {
9227        if (i == res.getNoteNumber().size())
9228          res.getNoteNumber().add(parsePositiveInt(null));
9229        if (array.get(i) instanceof JsonObject) 
9230          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9231      }
9232    };
9233    if (json.has("adjudication")) {
9234      JsonArray array = json.getAsJsonArray("adjudication");
9235      for (int i = 0; i < array.size(); i++) {
9236        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9237      }
9238    };
9239    if (json.has("subDetail")) {
9240      JsonArray array = json.getAsJsonArray("subDetail");
9241      for (int i = 0; i < array.size(); i++) {
9242        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
9243      }
9244    };
9245  }
9246
9247  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9248    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
9249    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
9250    return res;
9251  }
9252
9253  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
9254    parseBackboneProperties(json, res);
9255    if (json.has("sequence"))
9256      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
9257    if (json.has("_sequence"))
9258      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
9259    if (json.has("type"))
9260      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9261    if (json.has("revenue"))
9262      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9263    if (json.has("category"))
9264      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9265    if (json.has("service"))
9266      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9267    if (json.has("modifier")) {
9268      JsonArray array = json.getAsJsonArray("modifier");
9269      for (int i = 0; i < array.size(); i++) {
9270        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9271      }
9272    };
9273    if (json.has("programCode")) {
9274      JsonArray array = json.getAsJsonArray("programCode");
9275      for (int i = 0; i < array.size(); i++) {
9276        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9277      }
9278    };
9279    if (json.has("quantity"))
9280      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
9281    if (json.has("unitPrice"))
9282      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
9283    if (json.has("factor"))
9284      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
9285    if (json.has("_factor"))
9286      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
9287    if (json.has("net"))
9288      res.setNet(parseMoney(json.getAsJsonObject("net")));
9289    if (json.has("udi")) {
9290      JsonArray array = json.getAsJsonArray("udi");
9291      for (int i = 0; i < array.size(); i++) {
9292        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
9293      }
9294    };
9295    if (json.has("noteNumber")) {
9296      JsonArray array = json.getAsJsonArray("noteNumber");
9297      for (int i = 0; i < array.size(); i++) {
9298        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9299      }
9300    };
9301    if (json.has("_noteNumber")) {
9302      JsonArray array = json.getAsJsonArray("_noteNumber");
9303      for (int i = 0; i < array.size(); i++) {
9304        if (i == res.getNoteNumber().size())
9305          res.getNoteNumber().add(parsePositiveInt(null));
9306        if (array.get(i) instanceof JsonObject) 
9307          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9308      }
9309    };
9310    if (json.has("adjudication")) {
9311      JsonArray array = json.getAsJsonArray("adjudication");
9312      for (int i = 0; i < array.size(); i++) {
9313        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9314      }
9315    };
9316  }
9317
9318  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9319    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
9320    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
9321    return res;
9322  }
9323
9324  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
9325    parseBackboneProperties(json, res);
9326    if (json.has("sequenceLinkId")) {
9327      JsonArray array = json.getAsJsonArray("sequenceLinkId");
9328      for (int i = 0; i < array.size(); i++) {
9329        res.getSequenceLinkId().add(parsePositiveInt(array.get(i).getAsString()));
9330      }
9331    };
9332    if (json.has("_sequenceLinkId")) {
9333      JsonArray array = json.getAsJsonArray("_sequenceLinkId");
9334      for (int i = 0; i < array.size(); i++) {
9335        if (i == res.getSequenceLinkId().size())
9336          res.getSequenceLinkId().add(parsePositiveInt(null));
9337        if (array.get(i) instanceof JsonObject) 
9338          parseElementProperties(array.get(i).getAsJsonObject(), res.getSequenceLinkId().get(i));
9339      }
9340    };
9341    if (json.has("revenue"))
9342      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9343    if (json.has("category"))
9344      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9345    if (json.has("service"))
9346      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9347    if (json.has("modifier")) {
9348      JsonArray array = json.getAsJsonArray("modifier");
9349      for (int i = 0; i < array.size(); i++) {
9350        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9351      }
9352    };
9353    if (json.has("fee"))
9354      res.setFee(parseMoney(json.getAsJsonObject("fee")));
9355    if (json.has("noteNumber")) {
9356      JsonArray array = json.getAsJsonArray("noteNumber");
9357      for (int i = 0; i < array.size(); i++) {
9358        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9359      }
9360    };
9361    if (json.has("_noteNumber")) {
9362      JsonArray array = json.getAsJsonArray("_noteNumber");
9363      for (int i = 0; i < array.size(); i++) {
9364        if (i == res.getNoteNumber().size())
9365          res.getNoteNumber().add(parsePositiveInt(null));
9366        if (array.get(i) instanceof JsonObject) 
9367          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9368      }
9369    };
9370    if (json.has("adjudication")) {
9371      JsonArray array = json.getAsJsonArray("adjudication");
9372      for (int i = 0; i < array.size(); i++) {
9373        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9374      }
9375    };
9376    if (json.has("detail")) {
9377      JsonArray array = json.getAsJsonArray("detail");
9378      for (int i = 0; i < array.size(); i++) {
9379        res.getDetail().add(parseExplanationOfBenefitAddedItemsDetailComponent(array.get(i).getAsJsonObject(), owner));
9380      }
9381    };
9382  }
9383
9384  protected ExplanationOfBenefit.AddedItemsDetailComponent parseExplanationOfBenefitAddedItemsDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9385    ExplanationOfBenefit.AddedItemsDetailComponent res = new ExplanationOfBenefit.AddedItemsDetailComponent();
9386    parseExplanationOfBenefitAddedItemsDetailComponentProperties(json, owner, res);
9387    return res;
9388  }
9389
9390  protected void parseExplanationOfBenefitAddedItemsDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemsDetailComponent res) throws IOException, FHIRFormatError {
9391    parseBackboneProperties(json, res);
9392    if (json.has("revenue"))
9393      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
9394    if (json.has("category"))
9395      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9396    if (json.has("service"))
9397      res.setService(parseCodeableConcept(json.getAsJsonObject("service")));
9398    if (json.has("modifier")) {
9399      JsonArray array = json.getAsJsonArray("modifier");
9400      for (int i = 0; i < array.size(); i++) {
9401        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9402      }
9403    };
9404    if (json.has("fee"))
9405      res.setFee(parseMoney(json.getAsJsonObject("fee")));
9406    if (json.has("noteNumber")) {
9407      JsonArray array = json.getAsJsonArray("noteNumber");
9408      for (int i = 0; i < array.size(); i++) {
9409        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
9410      }
9411    };
9412    if (json.has("_noteNumber")) {
9413      JsonArray array = json.getAsJsonArray("_noteNumber");
9414      for (int i = 0; i < array.size(); i++) {
9415        if (i == res.getNoteNumber().size())
9416          res.getNoteNumber().add(parsePositiveInt(null));
9417        if (array.get(i) instanceof JsonObject) 
9418          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
9419      }
9420    };
9421    if (json.has("adjudication")) {
9422      JsonArray array = json.getAsJsonArray("adjudication");
9423      for (int i = 0; i < array.size(); i++) {
9424        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
9425      }
9426    };
9427  }
9428
9429  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9430    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
9431    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
9432    return res;
9433  }
9434
9435  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
9436    parseBackboneProperties(json, res);
9437    if (json.has("type"))
9438      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9439    if (json.has("adjustment"))
9440      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
9441    if (json.has("adjustmentReason"))
9442      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
9443    if (json.has("date"))
9444      res.setDateElement(parseDate(json.get("date").getAsString()));
9445    if (json.has("_date"))
9446      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9447    if (json.has("amount"))
9448      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
9449    if (json.has("identifier"))
9450      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9451  }
9452
9453  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9454    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
9455    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
9456    return res;
9457  }
9458
9459  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
9460    parseBackboneProperties(json, res);
9461    if (json.has("number"))
9462      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
9463    if (json.has("_number"))
9464      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
9465    if (json.has("type"))
9466      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9467    if (json.has("text"))
9468      res.setTextElement(parseString(json.get("text").getAsString()));
9469    if (json.has("_text"))
9470      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
9471    if (json.has("language"))
9472      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
9473  }
9474
9475  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9476    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
9477    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
9478    return res;
9479  }
9480
9481  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
9482    parseBackboneProperties(json, res);
9483    if (json.has("category"))
9484      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9485    if (json.has("subCategory"))
9486      res.setSubCategory(parseCodeableConcept(json.getAsJsonObject("subCategory")));
9487    if (json.has("excluded"))
9488      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
9489    if (json.has("_excluded"))
9490      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
9491    if (json.has("name"))
9492      res.setNameElement(parseString(json.get("name").getAsString()));
9493    if (json.has("_name"))
9494      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9495    if (json.has("description"))
9496      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9497    if (json.has("_description"))
9498      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9499    if (json.has("network"))
9500      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
9501    if (json.has("unit"))
9502      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9503    if (json.has("term"))
9504      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
9505    if (json.has("financial")) {
9506      JsonArray array = json.getAsJsonArray("financial");
9507      for (int i = 0; i < array.size(); i++) {
9508        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
9509      }
9510    };
9511  }
9512
9513  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
9514    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
9515    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
9516    return res;
9517  }
9518
9519  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
9520    parseBackboneProperties(json, res);
9521    if (json.has("type"))
9522      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9523    Type allowed = parseType("allowed", json);
9524    if (allowed != null)
9525      res.setAllowed(allowed);
9526    Type used = parseType("used", json);
9527    if (used != null)
9528      res.setUsed(used);
9529  }
9530
9531  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
9532    FamilyMemberHistory res = new FamilyMemberHistory();
9533    parseFamilyMemberHistoryProperties(json, res);
9534    return res;
9535  }
9536
9537  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
9538    parseDomainResourceProperties(json, res);
9539    if (json.has("identifier")) {
9540      JsonArray array = json.getAsJsonArray("identifier");
9541      for (int i = 0; i < array.size(); i++) {
9542        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9543      }
9544    };
9545    if (json.has("definition")) {
9546      JsonArray array = json.getAsJsonArray("definition");
9547      for (int i = 0; i < array.size(); i++) {
9548        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
9549      }
9550    };
9551    if (json.has("status"))
9552      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
9553    if (json.has("_status"))
9554      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9555    if (json.has("notDone"))
9556      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
9557    if (json.has("_notDone"))
9558      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
9559    if (json.has("notDoneReason"))
9560      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
9561    if (json.has("patient"))
9562      res.setPatient(parseReference(json.getAsJsonObject("patient")));
9563    if (json.has("date"))
9564      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9565    if (json.has("_date"))
9566      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9567    if (json.has("name"))
9568      res.setNameElement(parseString(json.get("name").getAsString()));
9569    if (json.has("_name"))
9570      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9571    if (json.has("relationship"))
9572      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
9573    if (json.has("gender"))
9574      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
9575    if (json.has("_gender"))
9576      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
9577    Type born = parseType("born", json);
9578    if (born != null)
9579      res.setBorn(born);
9580    Type age = parseType("age", json);
9581    if (age != null)
9582      res.setAge(age);
9583    if (json.has("estimatedAge"))
9584      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
9585    if (json.has("_estimatedAge"))
9586      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
9587    Type deceased = parseType("deceased", json);
9588    if (deceased != null)
9589      res.setDeceased(deceased);
9590    if (json.has("reasonCode")) {
9591      JsonArray array = json.getAsJsonArray("reasonCode");
9592      for (int i = 0; i < array.size(); i++) {
9593        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9594      }
9595    };
9596    if (json.has("reasonReference")) {
9597      JsonArray array = json.getAsJsonArray("reasonReference");
9598      for (int i = 0; i < array.size(); i++) {
9599        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9600      }
9601    };
9602    if (json.has("note")) {
9603      JsonArray array = json.getAsJsonArray("note");
9604      for (int i = 0; i < array.size(); i++) {
9605        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9606      }
9607    };
9608    if (json.has("condition")) {
9609      JsonArray array = json.getAsJsonArray("condition");
9610      for (int i = 0; i < array.size(); i++) {
9611        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
9612      }
9613    };
9614  }
9615
9616  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
9617    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
9618    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
9619    return res;
9620  }
9621
9622  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
9623    parseBackboneProperties(json, res);
9624    if (json.has("code"))
9625      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9626    if (json.has("outcome"))
9627      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
9628    Type onset = parseType("onset", json);
9629    if (onset != null)
9630      res.setOnset(onset);
9631    if (json.has("note")) {
9632      JsonArray array = json.getAsJsonArray("note");
9633      for (int i = 0; i < array.size(); i++) {
9634        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9635      }
9636    };
9637  }
9638
9639  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
9640    Flag res = new Flag();
9641    parseFlagProperties(json, res);
9642    return res;
9643  }
9644
9645  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
9646    parseDomainResourceProperties(json, res);
9647    if (json.has("identifier")) {
9648      JsonArray array = json.getAsJsonArray("identifier");
9649      for (int i = 0; i < array.size(); i++) {
9650        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9651      }
9652    };
9653    if (json.has("status"))
9654      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
9655    if (json.has("_status"))
9656      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9657    if (json.has("category"))
9658      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9659    if (json.has("code"))
9660      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9661    if (json.has("subject"))
9662      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9663    if (json.has("period"))
9664      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9665    if (json.has("encounter"))
9666      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
9667    if (json.has("author"))
9668      res.setAuthor(parseReference(json.getAsJsonObject("author")));
9669  }
9670
9671  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
9672    Goal res = new Goal();
9673    parseGoalProperties(json, res);
9674    return res;
9675  }
9676
9677  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
9678    parseDomainResourceProperties(json, res);
9679    if (json.has("identifier")) {
9680      JsonArray array = json.getAsJsonArray("identifier");
9681      for (int i = 0; i < array.size(); i++) {
9682        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9683      }
9684    };
9685    if (json.has("status"))
9686      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
9687    if (json.has("_status"))
9688      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9689    if (json.has("category")) {
9690      JsonArray array = json.getAsJsonArray("category");
9691      for (int i = 0; i < array.size(); i++) {
9692        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9693      }
9694    };
9695    if (json.has("priority"))
9696      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9697    if (json.has("description"))
9698      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
9699    if (json.has("subject"))
9700      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9701    Type start = parseType("start", json);
9702    if (start != null)
9703      res.setStart(start);
9704    if (json.has("target"))
9705      res.setTarget(parseGoalGoalTargetComponent(json.getAsJsonObject("target"), res));
9706    if (json.has("statusDate"))
9707      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
9708    if (json.has("_statusDate"))
9709      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
9710    if (json.has("statusReason"))
9711      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
9712    if (json.has("_statusReason"))
9713      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
9714    if (json.has("expressedBy"))
9715      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
9716    if (json.has("addresses")) {
9717      JsonArray array = json.getAsJsonArray("addresses");
9718      for (int i = 0; i < array.size(); i++) {
9719        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
9720      }
9721    };
9722    if (json.has("note")) {
9723      JsonArray array = json.getAsJsonArray("note");
9724      for (int i = 0; i < array.size(); i++) {
9725        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9726      }
9727    };
9728    if (json.has("outcomeCode")) {
9729      JsonArray array = json.getAsJsonArray("outcomeCode");
9730      for (int i = 0; i < array.size(); i++) {
9731        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9732      }
9733    };
9734    if (json.has("outcomeReference")) {
9735      JsonArray array = json.getAsJsonArray("outcomeReference");
9736      for (int i = 0; i < array.size(); i++) {
9737        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
9738      }
9739    };
9740  }
9741
9742  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
9743    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
9744    parseGoalGoalTargetComponentProperties(json, owner, res);
9745    return res;
9746  }
9747
9748  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
9749    parseBackboneProperties(json, res);
9750    if (json.has("measure"))
9751      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
9752    Type detail = parseType("detail", json);
9753    if (detail != null)
9754      res.setDetail(detail);
9755    Type due = parseType("due", json);
9756    if (due != null)
9757      res.setDue(due);
9758  }
9759
9760  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
9761    GraphDefinition res = new GraphDefinition();
9762    parseGraphDefinitionProperties(json, res);
9763    return res;
9764  }
9765
9766  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
9767    parseDomainResourceProperties(json, res);
9768    if (json.has("url"))
9769      res.setUrlElement(parseUri(json.get("url").getAsString()));
9770    if (json.has("_url"))
9771      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9772    if (json.has("version"))
9773      res.setVersionElement(parseString(json.get("version").getAsString()));
9774    if (json.has("_version"))
9775      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9776    if (json.has("name"))
9777      res.setNameElement(parseString(json.get("name").getAsString()));
9778    if (json.has("_name"))
9779      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9780    if (json.has("status"))
9781      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
9782    if (json.has("_status"))
9783      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9784    if (json.has("experimental"))
9785      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
9786    if (json.has("_experimental"))
9787      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
9788    if (json.has("date"))
9789      res.setDateElement(parseDateTime(json.get("date").getAsString()));
9790    if (json.has("_date"))
9791      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9792    if (json.has("publisher"))
9793      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
9794    if (json.has("_publisher"))
9795      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
9796    if (json.has("contact")) {
9797      JsonArray array = json.getAsJsonArray("contact");
9798      for (int i = 0; i < array.size(); i++) {
9799        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
9800      }
9801    };
9802    if (json.has("description"))
9803      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
9804    if (json.has("_description"))
9805      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9806    if (json.has("useContext")) {
9807      JsonArray array = json.getAsJsonArray("useContext");
9808      for (int i = 0; i < array.size(); i++) {
9809        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
9810      }
9811    };
9812    if (json.has("jurisdiction")) {
9813      JsonArray array = json.getAsJsonArray("jurisdiction");
9814      for (int i = 0; i < array.size(); i++) {
9815        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9816      }
9817    };
9818    if (json.has("purpose"))
9819      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
9820    if (json.has("_purpose"))
9821      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
9822    if (json.has("start"))
9823      res.setStartElement(parseCode(json.get("start").getAsString()));
9824    if (json.has("_start"))
9825      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
9826    if (json.has("profile"))
9827      res.setProfileElement(parseUri(json.get("profile").getAsString()));
9828    if (json.has("_profile"))
9829      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
9830    if (json.has("link")) {
9831      JsonArray array = json.getAsJsonArray("link");
9832      for (int i = 0; i < array.size(); i++) {
9833        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
9834      }
9835    };
9836  }
9837
9838  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9839    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
9840    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
9841    return res;
9842  }
9843
9844  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
9845    parseBackboneProperties(json, res);
9846    if (json.has("path"))
9847      res.setPathElement(parseString(json.get("path").getAsString()));
9848    if (json.has("_path"))
9849      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
9850    if (json.has("sliceName"))
9851      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
9852    if (json.has("_sliceName"))
9853      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
9854    if (json.has("min"))
9855      res.setMinElement(parseInteger(json.get("min").getAsLong()));
9856    if (json.has("_min"))
9857      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
9858    if (json.has("max"))
9859      res.setMaxElement(parseString(json.get("max").getAsString()));
9860    if (json.has("_max"))
9861      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
9862    if (json.has("description"))
9863      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9864    if (json.has("_description"))
9865      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9866    if (json.has("target")) {
9867      JsonArray array = json.getAsJsonArray("target");
9868      for (int i = 0; i < array.size(); i++) {
9869        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
9870      }
9871    };
9872  }
9873
9874  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9875    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
9876    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
9877    return res;
9878  }
9879
9880  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
9881    parseBackboneProperties(json, res);
9882    if (json.has("type"))
9883      res.setTypeElement(parseCode(json.get("type").getAsString()));
9884    if (json.has("_type"))
9885      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9886    if (json.has("profile"))
9887      res.setProfileElement(parseUri(json.get("profile").getAsString()));
9888    if (json.has("_profile"))
9889      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
9890    if (json.has("compartment")) {
9891      JsonArray array = json.getAsJsonArray("compartment");
9892      for (int i = 0; i < array.size(); i++) {
9893        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
9894      }
9895    };
9896    if (json.has("link")) {
9897      JsonArray array = json.getAsJsonArray("link");
9898      for (int i = 0; i < array.size(); i++) {
9899        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
9900      }
9901    };
9902  }
9903
9904  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
9905    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
9906    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
9907    return res;
9908  }
9909
9910  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
9911    parseBackboneProperties(json, res);
9912    if (json.has("code"))
9913      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
9914    if (json.has("_code"))
9915      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9916    if (json.has("rule"))
9917      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
9918    if (json.has("_rule"))
9919      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
9920    if (json.has("expression"))
9921      res.setExpressionElement(parseString(json.get("expression").getAsString()));
9922    if (json.has("_expression"))
9923      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
9924    if (json.has("description"))
9925      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9926    if (json.has("_description"))
9927      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9928  }
9929
9930  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
9931    Group res = new Group();
9932    parseGroupProperties(json, res);
9933    return res;
9934  }
9935
9936  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
9937    parseDomainResourceProperties(json, res);
9938    if (json.has("identifier")) {
9939      JsonArray array = json.getAsJsonArray("identifier");
9940      for (int i = 0; i < array.size(); i++) {
9941        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9942      }
9943    };
9944    if (json.has("active"))
9945      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
9946    if (json.has("_active"))
9947      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
9948    if (json.has("type"))
9949      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
9950    if (json.has("_type"))
9951      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9952    if (json.has("actual"))
9953      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
9954    if (json.has("_actual"))
9955      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
9956    if (json.has("code"))
9957      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9958    if (json.has("name"))
9959      res.setNameElement(parseString(json.get("name").getAsString()));
9960    if (json.has("_name"))
9961      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9962    if (json.has("quantity"))
9963      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
9964    if (json.has("_quantity"))
9965      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
9966    if (json.has("characteristic")) {
9967      JsonArray array = json.getAsJsonArray("characteristic");
9968      for (int i = 0; i < array.size(); i++) {
9969        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
9970      }
9971    };
9972    if (json.has("member")) {
9973      JsonArray array = json.getAsJsonArray("member");
9974      for (int i = 0; i < array.size(); i++) {
9975        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
9976      }
9977    };
9978  }
9979
9980  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
9981    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
9982    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
9983    return res;
9984  }
9985
9986  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
9987    parseBackboneProperties(json, res);
9988    if (json.has("code"))
9989      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9990    Type value = parseType("value", json);
9991    if (value != null)
9992      res.setValue(value);
9993    if (json.has("exclude"))
9994      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
9995    if (json.has("_exclude"))
9996      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
9997    if (json.has("period"))
9998      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9999  }
10000
10001  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
10002    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
10003    parseGroupGroupMemberComponentProperties(json, owner, res);
10004    return res;
10005  }
10006
10007  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
10008    parseBackboneProperties(json, res);
10009    if (json.has("entity"))
10010      res.setEntity(parseReference(json.getAsJsonObject("entity")));
10011    if (json.has("period"))
10012      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10013    if (json.has("inactive"))
10014      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
10015    if (json.has("_inactive"))
10016      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
10017  }
10018
10019  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
10020    GuidanceResponse res = new GuidanceResponse();
10021    parseGuidanceResponseProperties(json, res);
10022    return res;
10023  }
10024
10025  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
10026    parseDomainResourceProperties(json, res);
10027    if (json.has("requestId"))
10028      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
10029    if (json.has("_requestId"))
10030      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
10031    if (json.has("identifier"))
10032      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10033    if (json.has("module"))
10034      res.setModule(parseReference(json.getAsJsonObject("module")));
10035    if (json.has("status"))
10036      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
10037    if (json.has("_status"))
10038      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10039    if (json.has("subject"))
10040      res.setSubject(parseReference(json.getAsJsonObject("subject")));
10041    if (json.has("context"))
10042      res.setContext(parseReference(json.getAsJsonObject("context")));
10043    if (json.has("occurrenceDateTime"))
10044      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
10045    if (json.has("_occurrenceDateTime"))
10046      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
10047    if (json.has("performer"))
10048      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
10049    Type reason = parseType("reason", json);
10050    if (reason != null)
10051      res.setReason(reason);
10052    if (json.has("note")) {
10053      JsonArray array = json.getAsJsonArray("note");
10054      for (int i = 0; i < array.size(); i++) {
10055        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10056      }
10057    };
10058    if (json.has("evaluationMessage")) {
10059      JsonArray array = json.getAsJsonArray("evaluationMessage");
10060      for (int i = 0; i < array.size(); i++) {
10061        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
10062      }
10063    };
10064    if (json.has("outputParameters"))
10065      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
10066    if (json.has("result"))
10067      res.setResult(parseReference(json.getAsJsonObject("result")));
10068    if (json.has("dataRequirement")) {
10069      JsonArray array = json.getAsJsonArray("dataRequirement");
10070      for (int i = 0; i < array.size(); i++) {
10071        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
10072      }
10073    };
10074  }
10075
10076  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
10077    HealthcareService res = new HealthcareService();
10078    parseHealthcareServiceProperties(json, res);
10079    return res;
10080  }
10081
10082  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
10083    parseDomainResourceProperties(json, res);
10084    if (json.has("identifier")) {
10085      JsonArray array = json.getAsJsonArray("identifier");
10086      for (int i = 0; i < array.size(); i++) {
10087        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10088      }
10089    };
10090    if (json.has("active"))
10091      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
10092    if (json.has("_active"))
10093      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
10094    if (json.has("providedBy"))
10095      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
10096    if (json.has("category"))
10097      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
10098    if (json.has("type")) {
10099      JsonArray array = json.getAsJsonArray("type");
10100      for (int i = 0; i < array.size(); i++) {
10101        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10102      }
10103    };
10104    if (json.has("specialty")) {
10105      JsonArray array = json.getAsJsonArray("specialty");
10106      for (int i = 0; i < array.size(); i++) {
10107        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10108      }
10109    };
10110    if (json.has("location")) {
10111      JsonArray array = json.getAsJsonArray("location");
10112      for (int i = 0; i < array.size(); i++) {
10113        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
10114      }
10115    };
10116    if (json.has("name"))
10117      res.setNameElement(parseString(json.get("name").getAsString()));
10118    if (json.has("_name"))
10119      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10120    if (json.has("comment"))
10121      res.setCommentElement(parseString(json.get("comment").getAsString()));
10122    if (json.has("_comment"))
10123      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
10124    if (json.has("extraDetails"))
10125      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
10126    if (json.has("_extraDetails"))
10127      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
10128    if (json.has("photo"))
10129      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
10130    if (json.has("telecom")) {
10131      JsonArray array = json.getAsJsonArray("telecom");
10132      for (int i = 0; i < array.size(); i++) {
10133        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
10134      }
10135    };
10136    if (json.has("coverageArea")) {
10137      JsonArray array = json.getAsJsonArray("coverageArea");
10138      for (int i = 0; i < array.size(); i++) {
10139        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
10140      }
10141    };
10142    if (json.has("serviceProvisionCode")) {
10143      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
10144      for (int i = 0; i < array.size(); i++) {
10145        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10146      }
10147    };
10148    if (json.has("eligibility"))
10149      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
10150    if (json.has("eligibilityNote"))
10151      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
10152    if (json.has("_eligibilityNote"))
10153      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
10154    if (json.has("programName")) {
10155      JsonArray array = json.getAsJsonArray("programName");
10156      for (int i = 0; i < array.size(); i++) {
10157        res.getProgramName().add(parseString(array.get(i).getAsString()));
10158      }
10159    };
10160    if (json.has("_programName")) {
10161      JsonArray array = json.getAsJsonArray("_programName");
10162      for (int i = 0; i < array.size(); i++) {
10163        if (i == res.getProgramName().size())
10164          res.getProgramName().add(parseString(null));
10165        if (array.get(i) instanceof JsonObject) 
10166          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
10167      }
10168    };
10169    if (json.has("characteristic")) {
10170      JsonArray array = json.getAsJsonArray("characteristic");
10171      for (int i = 0; i < array.size(); i++) {
10172        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10173      }
10174    };
10175    if (json.has("referralMethod")) {
10176      JsonArray array = json.getAsJsonArray("referralMethod");
10177      for (int i = 0; i < array.size(); i++) {
10178        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10179      }
10180    };
10181    if (json.has("appointmentRequired"))
10182      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
10183    if (json.has("_appointmentRequired"))
10184      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
10185    if (json.has("availableTime")) {
10186      JsonArray array = json.getAsJsonArray("availableTime");
10187      for (int i = 0; i < array.size(); i++) {
10188        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
10189      }
10190    };
10191    if (json.has("notAvailable")) {
10192      JsonArray array = json.getAsJsonArray("notAvailable");
10193      for (int i = 0; i < array.size(); i++) {
10194        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
10195      }
10196    };
10197    if (json.has("availabilityExceptions"))
10198      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
10199    if (json.has("_availabilityExceptions"))
10200      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
10201    if (json.has("endpoint")) {
10202      JsonArray array = json.getAsJsonArray("endpoint");
10203      for (int i = 0; i < array.size(); i++) {
10204        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10205      }
10206    };
10207  }
10208
10209  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10210    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
10211    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
10212    return res;
10213  }
10214
10215  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
10216    parseBackboneProperties(json, res);
10217    if (json.has("daysOfWeek")) {
10218      JsonArray array = json.getAsJsonArray("daysOfWeek");
10219      for (int i = 0; i < array.size(); i++) {
10220        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10221      }
10222    };
10223    if (json.has("_daysOfWeek")) {
10224      JsonArray array = json.getAsJsonArray("_daysOfWeek");
10225      for (int i = 0; i < array.size(); i++) {
10226        if (i == res.getDaysOfWeek().size())
10227          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
10228        if (array.get(i) instanceof JsonObject) 
10229          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
10230      }
10231    };
10232    if (json.has("allDay"))
10233      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
10234    if (json.has("_allDay"))
10235      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
10236    if (json.has("availableStartTime"))
10237      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
10238    if (json.has("_availableStartTime"))
10239      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
10240    if (json.has("availableEndTime"))
10241      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
10242    if (json.has("_availableEndTime"))
10243      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
10244  }
10245
10246  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
10247    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
10248    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
10249    return res;
10250  }
10251
10252  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
10253    parseBackboneProperties(json, res);
10254    if (json.has("description"))
10255      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10256    if (json.has("_description"))
10257      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10258    if (json.has("during"))
10259      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
10260  }
10261
10262  protected ImagingManifest parseImagingManifest(JsonObject json) throws IOException, FHIRFormatError {
10263    ImagingManifest res = new ImagingManifest();
10264    parseImagingManifestProperties(json, res);
10265    return res;
10266  }
10267
10268  protected void parseImagingManifestProperties(JsonObject json, ImagingManifest res) throws IOException, FHIRFormatError {
10269    parseDomainResourceProperties(json, res);
10270    if (json.has("identifier"))
10271      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
10272    if (json.has("patient"))
10273      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10274    if (json.has("authoringTime"))
10275      res.setAuthoringTimeElement(parseDateTime(json.get("authoringTime").getAsString()));
10276    if (json.has("_authoringTime"))
10277      parseElementProperties(json.getAsJsonObject("_authoringTime"), res.getAuthoringTimeElement());
10278    if (json.has("author"))
10279      res.setAuthor(parseReference(json.getAsJsonObject("author")));
10280    if (json.has("description"))
10281      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10282    if (json.has("_description"))
10283      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10284    if (json.has("study")) {
10285      JsonArray array = json.getAsJsonArray("study");
10286      for (int i = 0; i < array.size(); i++) {
10287        res.getStudy().add(parseImagingManifestStudyComponent(array.get(i).getAsJsonObject(), res));
10288      }
10289    };
10290  }
10291
10292  protected ImagingManifest.StudyComponent parseImagingManifestStudyComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10293    ImagingManifest.StudyComponent res = new ImagingManifest.StudyComponent();
10294    parseImagingManifestStudyComponentProperties(json, owner, res);
10295    return res;
10296  }
10297
10298  protected void parseImagingManifestStudyComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.StudyComponent res) throws IOException, FHIRFormatError {
10299    parseBackboneProperties(json, res);
10300    if (json.has("uid"))
10301      res.setUidElement(parseOid(json.get("uid").getAsString()));
10302    if (json.has("_uid"))
10303      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10304    if (json.has("imagingStudy"))
10305      res.setImagingStudy(parseReference(json.getAsJsonObject("imagingStudy")));
10306    if (json.has("endpoint")) {
10307      JsonArray array = json.getAsJsonArray("endpoint");
10308      for (int i = 0; i < array.size(); i++) {
10309        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10310      }
10311    };
10312    if (json.has("series")) {
10313      JsonArray array = json.getAsJsonArray("series");
10314      for (int i = 0; i < array.size(); i++) {
10315        res.getSeries().add(parseImagingManifestSeriesComponent(array.get(i).getAsJsonObject(), owner));
10316      }
10317    };
10318  }
10319
10320  protected ImagingManifest.SeriesComponent parseImagingManifestSeriesComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10321    ImagingManifest.SeriesComponent res = new ImagingManifest.SeriesComponent();
10322    parseImagingManifestSeriesComponentProperties(json, owner, res);
10323    return res;
10324  }
10325
10326  protected void parseImagingManifestSeriesComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.SeriesComponent res) throws IOException, FHIRFormatError {
10327    parseBackboneProperties(json, res);
10328    if (json.has("uid"))
10329      res.setUidElement(parseOid(json.get("uid").getAsString()));
10330    if (json.has("_uid"))
10331      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10332    if (json.has("endpoint")) {
10333      JsonArray array = json.getAsJsonArray("endpoint");
10334      for (int i = 0; i < array.size(); i++) {
10335        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10336      }
10337    };
10338    if (json.has("instance")) {
10339      JsonArray array = json.getAsJsonArray("instance");
10340      for (int i = 0; i < array.size(); i++) {
10341        res.getInstance().add(parseImagingManifestInstanceComponent(array.get(i).getAsJsonObject(), owner));
10342      }
10343    };
10344  }
10345
10346  protected ImagingManifest.InstanceComponent parseImagingManifestInstanceComponent(JsonObject json, ImagingManifest owner) throws IOException, FHIRFormatError {
10347    ImagingManifest.InstanceComponent res = new ImagingManifest.InstanceComponent();
10348    parseImagingManifestInstanceComponentProperties(json, owner, res);
10349    return res;
10350  }
10351
10352  protected void parseImagingManifestInstanceComponentProperties(JsonObject json, ImagingManifest owner, ImagingManifest.InstanceComponent res) throws IOException, FHIRFormatError {
10353    parseBackboneProperties(json, res);
10354    if (json.has("sopClass"))
10355      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10356    if (json.has("_sopClass"))
10357      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
10358    if (json.has("uid"))
10359      res.setUidElement(parseOid(json.get("uid").getAsString()));
10360    if (json.has("_uid"))
10361      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10362  }
10363
10364  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
10365    ImagingStudy res = new ImagingStudy();
10366    parseImagingStudyProperties(json, res);
10367    return res;
10368  }
10369
10370  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
10371    parseDomainResourceProperties(json, res);
10372    if (json.has("uid"))
10373      res.setUidElement(parseOid(json.get("uid").getAsString()));
10374    if (json.has("_uid"))
10375      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10376    if (json.has("accession"))
10377      res.setAccession(parseIdentifier(json.getAsJsonObject("accession")));
10378    if (json.has("identifier")) {
10379      JsonArray array = json.getAsJsonArray("identifier");
10380      for (int i = 0; i < array.size(); i++) {
10381        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10382      }
10383    };
10384    if (json.has("availability"))
10385      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10386    if (json.has("_availability"))
10387      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
10388    if (json.has("modalityList")) {
10389      JsonArray array = json.getAsJsonArray("modalityList");
10390      for (int i = 0; i < array.size(); i++) {
10391        res.getModalityList().add(parseCoding(array.get(i).getAsJsonObject()));
10392      }
10393    };
10394    if (json.has("patient"))
10395      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10396    if (json.has("context"))
10397      res.setContext(parseReference(json.getAsJsonObject("context")));
10398    if (json.has("started"))
10399      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10400    if (json.has("_started"))
10401      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
10402    if (json.has("basedOn")) {
10403      JsonArray array = json.getAsJsonArray("basedOn");
10404      for (int i = 0; i < array.size(); i++) {
10405        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
10406      }
10407    };
10408    if (json.has("referrer"))
10409      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
10410    if (json.has("interpreter")) {
10411      JsonArray array = json.getAsJsonArray("interpreter");
10412      for (int i = 0; i < array.size(); i++) {
10413        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
10414      }
10415    };
10416    if (json.has("endpoint")) {
10417      JsonArray array = json.getAsJsonArray("endpoint");
10418      for (int i = 0; i < array.size(); i++) {
10419        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10420      }
10421    };
10422    if (json.has("numberOfSeries"))
10423      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
10424    if (json.has("_numberOfSeries"))
10425      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
10426    if (json.has("numberOfInstances"))
10427      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10428    if (json.has("_numberOfInstances"))
10429      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
10430    if (json.has("procedureReference")) {
10431      JsonArray array = json.getAsJsonArray("procedureReference");
10432      for (int i = 0; i < array.size(); i++) {
10433        res.getProcedureReference().add(parseReference(array.get(i).getAsJsonObject()));
10434      }
10435    };
10436    if (json.has("procedureCode")) {
10437      JsonArray array = json.getAsJsonArray("procedureCode");
10438      for (int i = 0; i < array.size(); i++) {
10439        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10440      }
10441    };
10442    if (json.has("reason"))
10443      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
10444    if (json.has("description"))
10445      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10446    if (json.has("_description"))
10447      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10448    if (json.has("series")) {
10449      JsonArray array = json.getAsJsonArray("series");
10450      for (int i = 0; i < array.size(); i++) {
10451        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
10452      }
10453    };
10454  }
10455
10456  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10457    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
10458    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
10459    return res;
10460  }
10461
10462  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
10463    parseBackboneProperties(json, res);
10464    if (json.has("uid"))
10465      res.setUidElement(parseOid(json.get("uid").getAsString()));
10466    if (json.has("_uid"))
10467      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10468    if (json.has("number"))
10469      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10470    if (json.has("_number"))
10471      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10472    if (json.has("modality"))
10473      res.setModality(parseCoding(json.getAsJsonObject("modality")));
10474    if (json.has("description"))
10475      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10476    if (json.has("_description"))
10477      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10478    if (json.has("numberOfInstances"))
10479      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
10480    if (json.has("_numberOfInstances"))
10481      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
10482    if (json.has("availability"))
10483      res.setAvailabilityElement(parseEnumeration(json.get("availability").getAsString(), ImagingStudy.InstanceAvailability.NULL, new ImagingStudy.InstanceAvailabilityEnumFactory()));
10484    if (json.has("_availability"))
10485      parseElementProperties(json.getAsJsonObject("_availability"), res.getAvailabilityElement());
10486    if (json.has("endpoint")) {
10487      JsonArray array = json.getAsJsonArray("endpoint");
10488      for (int i = 0; i < array.size(); i++) {
10489        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
10490      }
10491    };
10492    if (json.has("bodySite"))
10493      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
10494    if (json.has("laterality"))
10495      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
10496    if (json.has("started"))
10497      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
10498    if (json.has("_started"))
10499      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
10500    if (json.has("performer")) {
10501      JsonArray array = json.getAsJsonArray("performer");
10502      for (int i = 0; i < array.size(); i++) {
10503        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
10504      }
10505    };
10506    if (json.has("instance")) {
10507      JsonArray array = json.getAsJsonArray("instance");
10508      for (int i = 0; i < array.size(); i++) {
10509        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
10510      }
10511    };
10512  }
10513
10514  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
10515    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
10516    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
10517    return res;
10518  }
10519
10520  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
10521    parseBackboneProperties(json, res);
10522    if (json.has("uid"))
10523      res.setUidElement(parseOid(json.get("uid").getAsString()));
10524    if (json.has("_uid"))
10525      parseElementProperties(json.getAsJsonObject("_uid"), res.getUidElement());
10526    if (json.has("number"))
10527      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
10528    if (json.has("_number"))
10529      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10530    if (json.has("sopClass"))
10531      res.setSopClassElement(parseOid(json.get("sopClass").getAsString()));
10532    if (json.has("_sopClass"))
10533      parseElementProperties(json.getAsJsonObject("_sopClass"), res.getSopClassElement());
10534    if (json.has("title"))
10535      res.setTitleElement(parseString(json.get("title").getAsString()));
10536    if (json.has("_title"))
10537      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10538  }
10539
10540  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
10541    Immunization res = new Immunization();
10542    parseImmunizationProperties(json, res);
10543    return res;
10544  }
10545
10546  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
10547    parseDomainResourceProperties(json, res);
10548    if (json.has("identifier")) {
10549      JsonArray array = json.getAsJsonArray("identifier");
10550      for (int i = 0; i < array.size(); i++) {
10551        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10552      }
10553    };
10554    if (json.has("status"))
10555      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
10556    if (json.has("_status"))
10557      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10558    if (json.has("notGiven"))
10559      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
10560    if (json.has("_notGiven"))
10561      parseElementProperties(json.getAsJsonObject("_notGiven"), res.getNotGivenElement());
10562    if (json.has("vaccineCode"))
10563      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
10564    if (json.has("patient"))
10565      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10566    if (json.has("encounter"))
10567      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
10568    if (json.has("date"))
10569      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10570    if (json.has("_date"))
10571      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10572    if (json.has("primarySource"))
10573      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
10574    if (json.has("_primarySource"))
10575      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
10576    if (json.has("reportOrigin"))
10577      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
10578    if (json.has("location"))
10579      res.setLocation(parseReference(json.getAsJsonObject("location")));
10580    if (json.has("manufacturer"))
10581      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
10582    if (json.has("lotNumber"))
10583      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
10584    if (json.has("_lotNumber"))
10585      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
10586    if (json.has("expirationDate"))
10587      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
10588    if (json.has("_expirationDate"))
10589      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
10590    if (json.has("site"))
10591      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
10592    if (json.has("route"))
10593      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
10594    if (json.has("doseQuantity"))
10595      res.setDoseQuantity(parseSimpleQuantity(json.getAsJsonObject("doseQuantity")));
10596    if (json.has("practitioner")) {
10597      JsonArray array = json.getAsJsonArray("practitioner");
10598      for (int i = 0; i < array.size(); i++) {
10599        res.getPractitioner().add(parseImmunizationImmunizationPractitionerComponent(array.get(i).getAsJsonObject(), res));
10600      }
10601    };
10602    if (json.has("note")) {
10603      JsonArray array = json.getAsJsonArray("note");
10604      for (int i = 0; i < array.size(); i++) {
10605        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
10606      }
10607    };
10608    if (json.has("explanation"))
10609      res.setExplanation(parseImmunizationImmunizationExplanationComponent(json.getAsJsonObject("explanation"), res));
10610    if (json.has("reaction")) {
10611      JsonArray array = json.getAsJsonArray("reaction");
10612      for (int i = 0; i < array.size(); i++) {
10613        res.getReaction().add(parseImmunizationImmunizationReactionComponent(array.get(i).getAsJsonObject(), res));
10614      }
10615    };
10616    if (json.has("vaccinationProtocol")) {
10617      JsonArray array = json.getAsJsonArray("vaccinationProtocol");
10618      for (int i = 0; i < array.size(); i++) {
10619        res.getVaccinationProtocol().add(parseImmunizationImmunizationVaccinationProtocolComponent(array.get(i).getAsJsonObject(), res));
10620      }
10621    };
10622  }
10623
10624  protected Immunization.ImmunizationPractitionerComponent parseImmunizationImmunizationPractitionerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10625    Immunization.ImmunizationPractitionerComponent res = new Immunization.ImmunizationPractitionerComponent();
10626    parseImmunizationImmunizationPractitionerComponentProperties(json, owner, res);
10627    return res;
10628  }
10629
10630  protected void parseImmunizationImmunizationPractitionerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPractitionerComponent res) throws IOException, FHIRFormatError {
10631    parseBackboneProperties(json, res);
10632    if (json.has("role"))
10633      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10634    if (json.has("actor"))
10635      res.setActor(parseReference(json.getAsJsonObject("actor")));
10636  }
10637
10638  protected Immunization.ImmunizationExplanationComponent parseImmunizationImmunizationExplanationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10639    Immunization.ImmunizationExplanationComponent res = new Immunization.ImmunizationExplanationComponent();
10640    parseImmunizationImmunizationExplanationComponentProperties(json, owner, res);
10641    return res;
10642  }
10643
10644  protected void parseImmunizationImmunizationExplanationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationExplanationComponent res) throws IOException, FHIRFormatError {
10645    parseBackboneProperties(json, res);
10646    if (json.has("reason")) {
10647      JsonArray array = json.getAsJsonArray("reason");
10648      for (int i = 0; i < array.size(); i++) {
10649        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10650      }
10651    };
10652    if (json.has("reasonNotGiven")) {
10653      JsonArray array = json.getAsJsonArray("reasonNotGiven");
10654      for (int i = 0; i < array.size(); i++) {
10655        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10656      }
10657    };
10658  }
10659
10660  protected Immunization.ImmunizationReactionComponent parseImmunizationImmunizationReactionComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10661    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
10662    parseImmunizationImmunizationReactionComponentProperties(json, owner, res);
10663    return res;
10664  }
10665
10666  protected void parseImmunizationImmunizationReactionComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationReactionComponent res) throws IOException, FHIRFormatError {
10667    parseBackboneProperties(json, res);
10668    if (json.has("date"))
10669      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10670    if (json.has("_date"))
10671      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10672    if (json.has("detail"))
10673      res.setDetail(parseReference(json.getAsJsonObject("detail")));
10674    if (json.has("reported"))
10675      res.setReportedElement(parseBoolean(json.get("reported").getAsBoolean()));
10676    if (json.has("_reported"))
10677      parseElementProperties(json.getAsJsonObject("_reported"), res.getReportedElement());
10678  }
10679
10680  protected Immunization.ImmunizationVaccinationProtocolComponent parseImmunizationImmunizationVaccinationProtocolComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
10681    Immunization.ImmunizationVaccinationProtocolComponent res = new Immunization.ImmunizationVaccinationProtocolComponent();
10682    parseImmunizationImmunizationVaccinationProtocolComponentProperties(json, owner, res);
10683    return res;
10684  }
10685
10686  protected void parseImmunizationImmunizationVaccinationProtocolComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationVaccinationProtocolComponent res) throws IOException, FHIRFormatError {
10687    parseBackboneProperties(json, res);
10688    if (json.has("doseSequence"))
10689      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
10690    if (json.has("_doseSequence"))
10691      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
10692    if (json.has("description"))
10693      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10694    if (json.has("_description"))
10695      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10696    if (json.has("authority"))
10697      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
10698    if (json.has("series"))
10699      res.setSeriesElement(parseString(json.get("series").getAsString()));
10700    if (json.has("_series"))
10701      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
10702    if (json.has("seriesDoses"))
10703      res.setSeriesDosesElement(parsePositiveInt(json.get("seriesDoses").getAsString()));
10704    if (json.has("_seriesDoses"))
10705      parseElementProperties(json.getAsJsonObject("_seriesDoses"), res.getSeriesDosesElement());
10706    if (json.has("targetDisease")) {
10707      JsonArray array = json.getAsJsonArray("targetDisease");
10708      for (int i = 0; i < array.size(); i++) {
10709        res.getTargetDisease().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10710      }
10711    };
10712    if (json.has("doseStatus"))
10713      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
10714    if (json.has("doseStatusReason"))
10715      res.setDoseStatusReason(parseCodeableConcept(json.getAsJsonObject("doseStatusReason")));
10716  }
10717
10718  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
10719    ImmunizationRecommendation res = new ImmunizationRecommendation();
10720    parseImmunizationRecommendationProperties(json, res);
10721    return res;
10722  }
10723
10724  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
10725    parseDomainResourceProperties(json, res);
10726    if (json.has("identifier")) {
10727      JsonArray array = json.getAsJsonArray("identifier");
10728      for (int i = 0; i < array.size(); i++) {
10729        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10730      }
10731    };
10732    if (json.has("patient"))
10733      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10734    if (json.has("recommendation")) {
10735      JsonArray array = json.getAsJsonArray("recommendation");
10736      for (int i = 0; i < array.size(); i++) {
10737        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
10738      }
10739    };
10740  }
10741
10742  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10743    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
10744    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
10745    return res;
10746  }
10747
10748  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
10749    parseBackboneProperties(json, res);
10750    if (json.has("date"))
10751      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10752    if (json.has("_date"))
10753      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10754    if (json.has("vaccineCode"))
10755      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
10756    if (json.has("targetDisease"))
10757      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
10758    if (json.has("doseNumber"))
10759      res.setDoseNumberElement(parsePositiveInt(json.get("doseNumber").getAsString()));
10760    if (json.has("_doseNumber"))
10761      parseElementProperties(json.getAsJsonObject("_doseNumber"), res.getDoseNumberElement());
10762    if (json.has("forecastStatus"))
10763      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
10764    if (json.has("dateCriterion")) {
10765      JsonArray array = json.getAsJsonArray("dateCriterion");
10766      for (int i = 0; i < array.size(); i++) {
10767        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
10768      }
10769    };
10770    if (json.has("protocol"))
10771      res.setProtocol(parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(json.getAsJsonObject("protocol"), owner));
10772    if (json.has("supportingImmunization")) {
10773      JsonArray array = json.getAsJsonArray("supportingImmunization");
10774      for (int i = 0; i < array.size(); i++) {
10775        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
10776      }
10777    };
10778    if (json.has("supportingPatientInformation")) {
10779      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
10780      for (int i = 0; i < array.size(); i++) {
10781        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
10782      }
10783    };
10784  }
10785
10786  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10787    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
10788    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
10789    return res;
10790  }
10791
10792  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
10793    parseBackboneProperties(json, res);
10794    if (json.has("code"))
10795      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
10796    if (json.has("value"))
10797      res.setValueElement(parseDateTime(json.get("value").getAsString()));
10798    if (json.has("_value"))
10799      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
10800  }
10801
10802  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
10803    ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent();
10804    parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(json, owner, res);
10805    return res;
10806  }
10807
10808  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent res) throws IOException, FHIRFormatError {
10809    parseBackboneProperties(json, res);
10810    if (json.has("doseSequence"))
10811      res.setDoseSequenceElement(parsePositiveInt(json.get("doseSequence").getAsString()));
10812    if (json.has("_doseSequence"))
10813      parseElementProperties(json.getAsJsonObject("_doseSequence"), res.getDoseSequenceElement());
10814    if (json.has("description"))
10815      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10816    if (json.has("_description"))
10817      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10818    if (json.has("authority"))
10819      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
10820    if (json.has("series"))
10821      res.setSeriesElement(parseString(json.get("series").getAsString()));
10822    if (json.has("_series"))
10823      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
10824  }
10825
10826  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
10827    ImplementationGuide res = new ImplementationGuide();
10828    parseImplementationGuideProperties(json, res);
10829    return res;
10830  }
10831
10832  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
10833    parseDomainResourceProperties(json, res);
10834    if (json.has("url"))
10835      res.setUrlElement(parseUri(json.get("url").getAsString()));
10836    if (json.has("_url"))
10837      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10838    if (json.has("version"))
10839      res.setVersionElement(parseString(json.get("version").getAsString()));
10840    if (json.has("_version"))
10841      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10842    if (json.has("name"))
10843      res.setNameElement(parseString(json.get("name").getAsString()));
10844    if (json.has("_name"))
10845      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10846    if (json.has("status"))
10847      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10848    if (json.has("_status"))
10849      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10850    if (json.has("experimental"))
10851      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10852    if (json.has("_experimental"))
10853      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10854    if (json.has("date"))
10855      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10856    if (json.has("_date"))
10857      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10858    if (json.has("publisher"))
10859      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10860    if (json.has("_publisher"))
10861      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10862    if (json.has("contact")) {
10863      JsonArray array = json.getAsJsonArray("contact");
10864      for (int i = 0; i < array.size(); i++) {
10865        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10866      }
10867    };
10868    if (json.has("description"))
10869      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10870    if (json.has("_description"))
10871      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10872    if (json.has("useContext")) {
10873      JsonArray array = json.getAsJsonArray("useContext");
10874      for (int i = 0; i < array.size(); i++) {
10875        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10876      }
10877    };
10878    if (json.has("jurisdiction")) {
10879      JsonArray array = json.getAsJsonArray("jurisdiction");
10880      for (int i = 0; i < array.size(); i++) {
10881        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10882      }
10883    };
10884    if (json.has("copyright"))
10885      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10886    if (json.has("_copyright"))
10887      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10888    if (json.has("fhirVersion"))
10889      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
10890    if (json.has("_fhirVersion"))
10891      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
10892    if (json.has("dependency")) {
10893      JsonArray array = json.getAsJsonArray("dependency");
10894      for (int i = 0; i < array.size(); i++) {
10895        res.getDependency().add(parseImplementationGuideImplementationGuideDependencyComponent(array.get(i).getAsJsonObject(), res));
10896      }
10897    };
10898    if (json.has("package")) {
10899      JsonArray array = json.getAsJsonArray("package");
10900      for (int i = 0; i < array.size(); i++) {
10901        res.getPackage().add(parseImplementationGuideImplementationGuidePackageComponent(array.get(i).getAsJsonObject(), res));
10902      }
10903    };
10904    if (json.has("global")) {
10905      JsonArray array = json.getAsJsonArray("global");
10906      for (int i = 0; i < array.size(); i++) {
10907        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
10908      }
10909    };
10910    if (json.has("binary")) {
10911      JsonArray array = json.getAsJsonArray("binary");
10912      for (int i = 0; i < array.size(); i++) {
10913        res.getBinary().add(parseUri(array.get(i).getAsString()));
10914      }
10915    };
10916    if (json.has("_binary")) {
10917      JsonArray array = json.getAsJsonArray("_binary");
10918      for (int i = 0; i < array.size(); i++) {
10919        if (i == res.getBinary().size())
10920          res.getBinary().add(parseUri(null));
10921        if (array.get(i) instanceof JsonObject) 
10922          parseElementProperties(array.get(i).getAsJsonObject(), res.getBinary().get(i));
10923      }
10924    };
10925    if (json.has("page"))
10926      res.setPage(parseImplementationGuideImplementationGuidePageComponent(json.getAsJsonObject("page"), res));
10927  }
10928
10929  protected ImplementationGuide.ImplementationGuideDependencyComponent parseImplementationGuideImplementationGuideDependencyComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10930    ImplementationGuide.ImplementationGuideDependencyComponent res = new ImplementationGuide.ImplementationGuideDependencyComponent();
10931    parseImplementationGuideImplementationGuideDependencyComponentProperties(json, owner, res);
10932    return res;
10933  }
10934
10935  protected void parseImplementationGuideImplementationGuideDependencyComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependencyComponent res) throws IOException, FHIRFormatError {
10936    parseBackboneProperties(json, res);
10937    if (json.has("type"))
10938      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ImplementationGuide.GuideDependencyType.NULL, new ImplementationGuide.GuideDependencyTypeEnumFactory()));
10939    if (json.has("_type"))
10940      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10941    if (json.has("uri"))
10942      res.setUriElement(parseUri(json.get("uri").getAsString()));
10943    if (json.has("_uri"))
10944      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
10945  }
10946
10947  protected ImplementationGuide.ImplementationGuidePackageComponent parseImplementationGuideImplementationGuidePackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10948    ImplementationGuide.ImplementationGuidePackageComponent res = new ImplementationGuide.ImplementationGuidePackageComponent();
10949    parseImplementationGuideImplementationGuidePackageComponentProperties(json, owner, res);
10950    return res;
10951  }
10952
10953  protected void parseImplementationGuideImplementationGuidePackageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageComponent res) throws IOException, FHIRFormatError {
10954    parseBackboneProperties(json, res);
10955    if (json.has("name"))
10956      res.setNameElement(parseString(json.get("name").getAsString()));
10957    if (json.has("_name"))
10958      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10959    if (json.has("description"))
10960      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10961    if (json.has("_description"))
10962      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10963    if (json.has("resource")) {
10964      JsonArray array = json.getAsJsonArray("resource");
10965      for (int i = 0; i < array.size(); i++) {
10966        res.getResource().add(parseImplementationGuideImplementationGuidePackageResourceComponent(array.get(i).getAsJsonObject(), owner));
10967      }
10968    };
10969  }
10970
10971  protected ImplementationGuide.ImplementationGuidePackageResourceComponent parseImplementationGuideImplementationGuidePackageResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
10972    ImplementationGuide.ImplementationGuidePackageResourceComponent res = new ImplementationGuide.ImplementationGuidePackageResourceComponent();
10973    parseImplementationGuideImplementationGuidePackageResourceComponentProperties(json, owner, res);
10974    return res;
10975  }
10976
10977  protected void parseImplementationGuideImplementationGuidePackageResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePackageResourceComponent res) throws IOException, FHIRFormatError {
10978    parseBackboneProperties(json, res);
10979    if (json.has("example"))
10980      res.setExampleElement(parseBoolean(json.get("example").getAsBoolean()));
10981    if (json.has("_example"))
10982      parseElementProperties(json.getAsJsonObject("_example"), res.getExampleElement());
10983    if (json.has("name"))
10984      res.setNameElement(parseString(json.get("name").getAsString()));
10985    if (json.has("_name"))
10986      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10987    if (json.has("description"))
10988      res.setDescriptionElement(parseString(json.get("description").getAsString()));
10989    if (json.has("_description"))
10990      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10991    if (json.has("acronym"))
10992      res.setAcronymElement(parseString(json.get("acronym").getAsString()));
10993    if (json.has("_acronym"))
10994      parseElementProperties(json.getAsJsonObject("_acronym"), res.getAcronymElement());
10995    Type source = parseType("source", json);
10996    if (source != null)
10997      res.setSource(source);
10998    if (json.has("exampleFor"))
10999      res.setExampleFor(parseReference(json.getAsJsonObject("exampleFor")));
11000  }
11001
11002  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11003    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
11004    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
11005    return res;
11006  }
11007
11008  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
11009    parseBackboneProperties(json, res);
11010    if (json.has("type"))
11011      res.setTypeElement(parseCode(json.get("type").getAsString()));
11012    if (json.has("_type"))
11013      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11014    if (json.has("profile"))
11015      res.setProfile(parseReference(json.getAsJsonObject("profile")));
11016  }
11017
11018  protected ImplementationGuide.ImplementationGuidePageComponent parseImplementationGuideImplementationGuidePageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
11019    ImplementationGuide.ImplementationGuidePageComponent res = new ImplementationGuide.ImplementationGuidePageComponent();
11020    parseImplementationGuideImplementationGuidePageComponentProperties(json, owner, res);
11021    return res;
11022  }
11023
11024  protected void parseImplementationGuideImplementationGuidePageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuidePageComponent res) throws IOException, FHIRFormatError {
11025    parseBackboneProperties(json, res);
11026    if (json.has("source"))
11027      res.setSourceElement(parseUri(json.get("source").getAsString()));
11028    if (json.has("_source"))
11029      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
11030    if (json.has("title"))
11031      res.setTitleElement(parseString(json.get("title").getAsString()));
11032    if (json.has("_title"))
11033      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11034    if (json.has("kind"))
11035      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ImplementationGuide.GuidePageKind.NULL, new ImplementationGuide.GuidePageKindEnumFactory()));
11036    if (json.has("_kind"))
11037      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
11038    if (json.has("type")) {
11039      JsonArray array = json.getAsJsonArray("type");
11040      for (int i = 0; i < array.size(); i++) {
11041        res.getType().add(parseCode(array.get(i).getAsString()));
11042      }
11043    };
11044    if (json.has("_type")) {
11045      JsonArray array = json.getAsJsonArray("_type");
11046      for (int i = 0; i < array.size(); i++) {
11047        if (i == res.getType().size())
11048          res.getType().add(parseCode(null));
11049        if (array.get(i) instanceof JsonObject) 
11050          parseElementProperties(array.get(i).getAsJsonObject(), res.getType().get(i));
11051      }
11052    };
11053    if (json.has("package")) {
11054      JsonArray array = json.getAsJsonArray("package");
11055      for (int i = 0; i < array.size(); i++) {
11056        res.getPackage().add(parseString(array.get(i).getAsString()));
11057      }
11058    };
11059    if (json.has("_package")) {
11060      JsonArray array = json.getAsJsonArray("_package");
11061      for (int i = 0; i < array.size(); i++) {
11062        if (i == res.getPackage().size())
11063          res.getPackage().add(parseString(null));
11064        if (array.get(i) instanceof JsonObject) 
11065          parseElementProperties(array.get(i).getAsJsonObject(), res.getPackage().get(i));
11066      }
11067    };
11068    if (json.has("format"))
11069      res.setFormatElement(parseCode(json.get("format").getAsString()));
11070    if (json.has("_format"))
11071      parseElementProperties(json.getAsJsonObject("_format"), res.getFormatElement());
11072    if (json.has("page")) {
11073      JsonArray array = json.getAsJsonArray("page");
11074      for (int i = 0; i < array.size(); i++) {
11075        res.getPage().add(parseImplementationGuideImplementationGuidePageComponent(array.get(i).getAsJsonObject(), owner));
11076      }
11077    };
11078  }
11079
11080  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
11081    Library res = new Library();
11082    parseLibraryProperties(json, res);
11083    return res;
11084  }
11085
11086  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
11087    parseDomainResourceProperties(json, res);
11088    if (json.has("url"))
11089      res.setUrlElement(parseUri(json.get("url").getAsString()));
11090    if (json.has("_url"))
11091      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11092    if (json.has("identifier")) {
11093      JsonArray array = json.getAsJsonArray("identifier");
11094      for (int i = 0; i < array.size(); i++) {
11095        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11096      }
11097    };
11098    if (json.has("version"))
11099      res.setVersionElement(parseString(json.get("version").getAsString()));
11100    if (json.has("_version"))
11101      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11102    if (json.has("name"))
11103      res.setNameElement(parseString(json.get("name").getAsString()));
11104    if (json.has("_name"))
11105      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11106    if (json.has("title"))
11107      res.setTitleElement(parseString(json.get("title").getAsString()));
11108    if (json.has("_title"))
11109      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11110    if (json.has("status"))
11111      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11112    if (json.has("_status"))
11113      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11114    if (json.has("experimental"))
11115      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11116    if (json.has("_experimental"))
11117      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11118    if (json.has("type"))
11119      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11120    if (json.has("date"))
11121      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11122    if (json.has("_date"))
11123      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11124    if (json.has("publisher"))
11125      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11126    if (json.has("_publisher"))
11127      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11128    if (json.has("description"))
11129      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11130    if (json.has("_description"))
11131      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11132    if (json.has("purpose"))
11133      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11134    if (json.has("_purpose"))
11135      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11136    if (json.has("usage"))
11137      res.setUsageElement(parseString(json.get("usage").getAsString()));
11138    if (json.has("_usage"))
11139      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
11140    if (json.has("approvalDate"))
11141      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11142    if (json.has("_approvalDate"))
11143      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11144    if (json.has("lastReviewDate"))
11145      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11146    if (json.has("_lastReviewDate"))
11147      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11148    if (json.has("effectivePeriod"))
11149      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11150    if (json.has("useContext")) {
11151      JsonArray array = json.getAsJsonArray("useContext");
11152      for (int i = 0; i < array.size(); i++) {
11153        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11154      }
11155    };
11156    if (json.has("jurisdiction")) {
11157      JsonArray array = json.getAsJsonArray("jurisdiction");
11158      for (int i = 0; i < array.size(); i++) {
11159        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11160      }
11161    };
11162    if (json.has("topic")) {
11163      JsonArray array = json.getAsJsonArray("topic");
11164      for (int i = 0; i < array.size(); i++) {
11165        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11166      }
11167    };
11168    if (json.has("contributor")) {
11169      JsonArray array = json.getAsJsonArray("contributor");
11170      for (int i = 0; i < array.size(); i++) {
11171        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11172      }
11173    };
11174    if (json.has("contact")) {
11175      JsonArray array = json.getAsJsonArray("contact");
11176      for (int i = 0; i < array.size(); i++) {
11177        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11178      }
11179    };
11180    if (json.has("copyright"))
11181      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11182    if (json.has("_copyright"))
11183      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11184    if (json.has("relatedArtifact")) {
11185      JsonArray array = json.getAsJsonArray("relatedArtifact");
11186      for (int i = 0; i < array.size(); i++) {
11187        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11188      }
11189    };
11190    if (json.has("parameter")) {
11191      JsonArray array = json.getAsJsonArray("parameter");
11192      for (int i = 0; i < array.size(); i++) {
11193        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
11194      }
11195    };
11196    if (json.has("dataRequirement")) {
11197      JsonArray array = json.getAsJsonArray("dataRequirement");
11198      for (int i = 0; i < array.size(); i++) {
11199        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
11200      }
11201    };
11202    if (json.has("content")) {
11203      JsonArray array = json.getAsJsonArray("content");
11204      for (int i = 0; i < array.size(); i++) {
11205        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
11206      }
11207    };
11208  }
11209
11210  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
11211    Linkage res = new Linkage();
11212    parseLinkageProperties(json, res);
11213    return res;
11214  }
11215
11216  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
11217    parseDomainResourceProperties(json, res);
11218    if (json.has("active"))
11219      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
11220    if (json.has("_active"))
11221      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
11222    if (json.has("author"))
11223      res.setAuthor(parseReference(json.getAsJsonObject("author")));
11224    if (json.has("item")) {
11225      JsonArray array = json.getAsJsonArray("item");
11226      for (int i = 0; i < array.size(); i++) {
11227        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
11228      }
11229    };
11230  }
11231
11232  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
11233    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
11234    parseLinkageLinkageItemComponentProperties(json, owner, res);
11235    return res;
11236  }
11237
11238  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
11239    parseBackboneProperties(json, res);
11240    if (json.has("type"))
11241      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
11242    if (json.has("_type"))
11243      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11244    if (json.has("resource"))
11245      res.setResource(parseReference(json.getAsJsonObject("resource")));
11246  }
11247
11248  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
11249    ListResource res = new ListResource();
11250    parseListResourceProperties(json, res);
11251    return res;
11252  }
11253
11254  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
11255    parseDomainResourceProperties(json, res);
11256    if (json.has("identifier")) {
11257      JsonArray array = json.getAsJsonArray("identifier");
11258      for (int i = 0; i < array.size(); i++) {
11259        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11260      }
11261    };
11262    if (json.has("status"))
11263      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
11264    if (json.has("_status"))
11265      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11266    if (json.has("mode"))
11267      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
11268    if (json.has("_mode"))
11269      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
11270    if (json.has("title"))
11271      res.setTitleElement(parseString(json.get("title").getAsString()));
11272    if (json.has("_title"))
11273      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11274    if (json.has("code"))
11275      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11276    if (json.has("subject"))
11277      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11278    if (json.has("encounter"))
11279      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11280    if (json.has("date"))
11281      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11282    if (json.has("_date"))
11283      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11284    if (json.has("source"))
11285      res.setSource(parseReference(json.getAsJsonObject("source")));
11286    if (json.has("orderedBy"))
11287      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
11288    if (json.has("note")) {
11289      JsonArray array = json.getAsJsonArray("note");
11290      for (int i = 0; i < array.size(); i++) {
11291        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11292      }
11293    };
11294    if (json.has("entry")) {
11295      JsonArray array = json.getAsJsonArray("entry");
11296      for (int i = 0; i < array.size(); i++) {
11297        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
11298      }
11299    };
11300    if (json.has("emptyReason"))
11301      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
11302  }
11303
11304  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
11305    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
11306    parseListResourceListEntryComponentProperties(json, owner, res);
11307    return res;
11308  }
11309
11310  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
11311    parseBackboneProperties(json, res);
11312    if (json.has("flag"))
11313      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
11314    if (json.has("deleted"))
11315      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
11316    if (json.has("_deleted"))
11317      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
11318    if (json.has("date"))
11319      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11320    if (json.has("_date"))
11321      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11322    if (json.has("item"))
11323      res.setItem(parseReference(json.getAsJsonObject("item")));
11324  }
11325
11326  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
11327    Location res = new Location();
11328    parseLocationProperties(json, res);
11329    return res;
11330  }
11331
11332  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
11333    parseDomainResourceProperties(json, res);
11334    if (json.has("identifier")) {
11335      JsonArray array = json.getAsJsonArray("identifier");
11336      for (int i = 0; i < array.size(); i++) {
11337        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11338      }
11339    };
11340    if (json.has("status"))
11341      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
11342    if (json.has("_status"))
11343      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11344    if (json.has("operationalStatus"))
11345      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
11346    if (json.has("name"))
11347      res.setNameElement(parseString(json.get("name").getAsString()));
11348    if (json.has("_name"))
11349      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11350    if (json.has("alias")) {
11351      JsonArray array = json.getAsJsonArray("alias");
11352      for (int i = 0; i < array.size(); i++) {
11353        res.getAlias().add(parseString(array.get(i).getAsString()));
11354      }
11355    };
11356    if (json.has("_alias")) {
11357      JsonArray array = json.getAsJsonArray("_alias");
11358      for (int i = 0; i < array.size(); i++) {
11359        if (i == res.getAlias().size())
11360          res.getAlias().add(parseString(null));
11361        if (array.get(i) instanceof JsonObject) 
11362          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
11363      }
11364    };
11365    if (json.has("description"))
11366      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11367    if (json.has("_description"))
11368      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11369    if (json.has("mode"))
11370      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
11371    if (json.has("_mode"))
11372      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
11373    if (json.has("type"))
11374      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11375    if (json.has("telecom")) {
11376      JsonArray array = json.getAsJsonArray("telecom");
11377      for (int i = 0; i < array.size(); i++) {
11378        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
11379      }
11380    };
11381    if (json.has("address"))
11382      res.setAddress(parseAddress(json.getAsJsonObject("address")));
11383    if (json.has("physicalType"))
11384      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
11385    if (json.has("position"))
11386      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
11387    if (json.has("managingOrganization"))
11388      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
11389    if (json.has("partOf"))
11390      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
11391    if (json.has("endpoint")) {
11392      JsonArray array = json.getAsJsonArray("endpoint");
11393      for (int i = 0; i < array.size(); i++) {
11394        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
11395      }
11396    };
11397  }
11398
11399  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
11400    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
11401    parseLocationLocationPositionComponentProperties(json, owner, res);
11402    return res;
11403  }
11404
11405  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
11406    parseBackboneProperties(json, res);
11407    if (json.has("longitude"))
11408      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
11409    if (json.has("_longitude"))
11410      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
11411    if (json.has("latitude"))
11412      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
11413    if (json.has("_latitude"))
11414      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
11415    if (json.has("altitude"))
11416      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
11417    if (json.has("_altitude"))
11418      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
11419  }
11420
11421  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
11422    Measure res = new Measure();
11423    parseMeasureProperties(json, res);
11424    return res;
11425  }
11426
11427  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
11428    parseDomainResourceProperties(json, res);
11429    if (json.has("url"))
11430      res.setUrlElement(parseUri(json.get("url").getAsString()));
11431    if (json.has("_url"))
11432      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
11433    if (json.has("identifier")) {
11434      JsonArray array = json.getAsJsonArray("identifier");
11435      for (int i = 0; i < array.size(); i++) {
11436        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11437      }
11438    };
11439    if (json.has("version"))
11440      res.setVersionElement(parseString(json.get("version").getAsString()));
11441    if (json.has("_version"))
11442      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
11443    if (json.has("name"))
11444      res.setNameElement(parseString(json.get("name").getAsString()));
11445    if (json.has("_name"))
11446      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11447    if (json.has("title"))
11448      res.setTitleElement(parseString(json.get("title").getAsString()));
11449    if (json.has("_title"))
11450      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
11451    if (json.has("status"))
11452      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
11453    if (json.has("_status"))
11454      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11455    if (json.has("experimental"))
11456      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
11457    if (json.has("_experimental"))
11458      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
11459    if (json.has("date"))
11460      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11461    if (json.has("_date"))
11462      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11463    if (json.has("publisher"))
11464      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
11465    if (json.has("_publisher"))
11466      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
11467    if (json.has("description"))
11468      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
11469    if (json.has("_description"))
11470      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11471    if (json.has("purpose"))
11472      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
11473    if (json.has("_purpose"))
11474      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
11475    if (json.has("usage"))
11476      res.setUsageElement(parseString(json.get("usage").getAsString()));
11477    if (json.has("_usage"))
11478      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
11479    if (json.has("approvalDate"))
11480      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
11481    if (json.has("_approvalDate"))
11482      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
11483    if (json.has("lastReviewDate"))
11484      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
11485    if (json.has("_lastReviewDate"))
11486      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
11487    if (json.has("effectivePeriod"))
11488      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
11489    if (json.has("useContext")) {
11490      JsonArray array = json.getAsJsonArray("useContext");
11491      for (int i = 0; i < array.size(); i++) {
11492        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
11493      }
11494    };
11495    if (json.has("jurisdiction")) {
11496      JsonArray array = json.getAsJsonArray("jurisdiction");
11497      for (int i = 0; i < array.size(); i++) {
11498        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11499      }
11500    };
11501    if (json.has("topic")) {
11502      JsonArray array = json.getAsJsonArray("topic");
11503      for (int i = 0; i < array.size(); i++) {
11504        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11505      }
11506    };
11507    if (json.has("contributor")) {
11508      JsonArray array = json.getAsJsonArray("contributor");
11509      for (int i = 0; i < array.size(); i++) {
11510        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
11511      }
11512    };
11513    if (json.has("contact")) {
11514      JsonArray array = json.getAsJsonArray("contact");
11515      for (int i = 0; i < array.size(); i++) {
11516        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
11517      }
11518    };
11519    if (json.has("copyright"))
11520      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
11521    if (json.has("_copyright"))
11522      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
11523    if (json.has("relatedArtifact")) {
11524      JsonArray array = json.getAsJsonArray("relatedArtifact");
11525      for (int i = 0; i < array.size(); i++) {
11526        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
11527      }
11528    };
11529    if (json.has("library")) {
11530      JsonArray array = json.getAsJsonArray("library");
11531      for (int i = 0; i < array.size(); i++) {
11532        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
11533      }
11534    };
11535    if (json.has("disclaimer"))
11536      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
11537    if (json.has("_disclaimer"))
11538      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
11539    if (json.has("scoring"))
11540      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
11541    if (json.has("compositeScoring"))
11542      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
11543    if (json.has("type")) {
11544      JsonArray array = json.getAsJsonArray("type");
11545      for (int i = 0; i < array.size(); i++) {
11546        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11547      }
11548    };
11549    if (json.has("riskAdjustment"))
11550      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
11551    if (json.has("_riskAdjustment"))
11552      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
11553    if (json.has("rateAggregation"))
11554      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
11555    if (json.has("_rateAggregation"))
11556      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
11557    if (json.has("rationale"))
11558      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
11559    if (json.has("_rationale"))
11560      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
11561    if (json.has("clinicalRecommendationStatement"))
11562      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
11563    if (json.has("_clinicalRecommendationStatement"))
11564      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
11565    if (json.has("improvementNotation"))
11566      res.setImprovementNotationElement(parseString(json.get("improvementNotation").getAsString()));
11567    if (json.has("_improvementNotation"))
11568      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
11569    if (json.has("definition")) {
11570      JsonArray array = json.getAsJsonArray("definition");
11571      for (int i = 0; i < array.size(); i++) {
11572        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
11573      }
11574    };
11575    if (json.has("_definition")) {
11576      JsonArray array = json.getAsJsonArray("_definition");
11577      for (int i = 0; i < array.size(); i++) {
11578        if (i == res.getDefinition().size())
11579          res.getDefinition().add(parseMarkdown(null));
11580        if (array.get(i) instanceof JsonObject) 
11581          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
11582      }
11583    };
11584    if (json.has("guidance"))
11585      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
11586    if (json.has("_guidance"))
11587      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
11588    if (json.has("set"))
11589      res.setSetElement(parseString(json.get("set").getAsString()));
11590    if (json.has("_set"))
11591      parseElementProperties(json.getAsJsonObject("_set"), res.getSetElement());
11592    if (json.has("group")) {
11593      JsonArray array = json.getAsJsonArray("group");
11594      for (int i = 0; i < array.size(); i++) {
11595        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
11596      }
11597    };
11598    if (json.has("supplementalData")) {
11599      JsonArray array = json.getAsJsonArray("supplementalData");
11600      for (int i = 0; i < array.size(); i++) {
11601        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
11602      }
11603    };
11604  }
11605
11606  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11607    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
11608    parseMeasureMeasureGroupComponentProperties(json, owner, res);
11609    return res;
11610  }
11611
11612  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
11613    parseBackboneProperties(json, res);
11614    if (json.has("identifier"))
11615      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11616    if (json.has("name"))
11617      res.setNameElement(parseString(json.get("name").getAsString()));
11618    if (json.has("_name"))
11619      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11620    if (json.has("description"))
11621      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11622    if (json.has("_description"))
11623      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11624    if (json.has("population")) {
11625      JsonArray array = json.getAsJsonArray("population");
11626      for (int i = 0; i < array.size(); i++) {
11627        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11628      }
11629    };
11630    if (json.has("stratifier")) {
11631      JsonArray array = json.getAsJsonArray("stratifier");
11632      for (int i = 0; i < array.size(); i++) {
11633        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
11634      }
11635    };
11636  }
11637
11638  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11639    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
11640    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
11641    return res;
11642  }
11643
11644  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
11645    parseBackboneProperties(json, res);
11646    if (json.has("identifier"))
11647      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11648    if (json.has("code"))
11649      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11650    if (json.has("name"))
11651      res.setNameElement(parseString(json.get("name").getAsString()));
11652    if (json.has("_name"))
11653      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11654    if (json.has("description"))
11655      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11656    if (json.has("_description"))
11657      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11658    if (json.has("criteria"))
11659      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11660    if (json.has("_criteria"))
11661      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11662  }
11663
11664  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11665    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
11666    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
11667    return res;
11668  }
11669
11670  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
11671    parseBackboneProperties(json, res);
11672    if (json.has("identifier"))
11673      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11674    if (json.has("criteria"))
11675      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11676    if (json.has("_criteria"))
11677      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11678    if (json.has("path"))
11679      res.setPathElement(parseString(json.get("path").getAsString()));
11680    if (json.has("_path"))
11681      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
11682  }
11683
11684  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
11685    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
11686    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
11687    return res;
11688  }
11689
11690  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
11691    parseBackboneProperties(json, res);
11692    if (json.has("identifier"))
11693      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11694    if (json.has("usage")) {
11695      JsonArray array = json.getAsJsonArray("usage");
11696      for (int i = 0; i < array.size(); i++) {
11697        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11698      }
11699    };
11700    if (json.has("criteria"))
11701      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
11702    if (json.has("_criteria"))
11703      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
11704    if (json.has("path"))
11705      res.setPathElement(parseString(json.get("path").getAsString()));
11706    if (json.has("_path"))
11707      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
11708  }
11709
11710  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
11711    MeasureReport res = new MeasureReport();
11712    parseMeasureReportProperties(json, res);
11713    return res;
11714  }
11715
11716  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
11717    parseDomainResourceProperties(json, res);
11718    if (json.has("identifier"))
11719      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11720    if (json.has("status"))
11721      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
11722    if (json.has("_status"))
11723      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11724    if (json.has("type"))
11725      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
11726    if (json.has("_type"))
11727      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11728    if (json.has("measure"))
11729      res.setMeasure(parseReference(json.getAsJsonObject("measure")));
11730    if (json.has("patient"))
11731      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11732    if (json.has("date"))
11733      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11734    if (json.has("_date"))
11735      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11736    if (json.has("reportingOrganization"))
11737      res.setReportingOrganization(parseReference(json.getAsJsonObject("reportingOrganization")));
11738    if (json.has("period"))
11739      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11740    if (json.has("group")) {
11741      JsonArray array = json.getAsJsonArray("group");
11742      for (int i = 0; i < array.size(); i++) {
11743        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
11744      }
11745    };
11746    if (json.has("evaluatedResources"))
11747      res.setEvaluatedResources(parseReference(json.getAsJsonObject("evaluatedResources")));
11748  }
11749
11750  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11751    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
11752    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
11753    return res;
11754  }
11755
11756  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
11757    parseBackboneProperties(json, res);
11758    if (json.has("identifier"))
11759      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11760    if (json.has("population")) {
11761      JsonArray array = json.getAsJsonArray("population");
11762      for (int i = 0; i < array.size(); i++) {
11763        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11764      }
11765    };
11766    if (json.has("measureScore"))
11767      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
11768    if (json.has("_measureScore"))
11769      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
11770    if (json.has("stratifier")) {
11771      JsonArray array = json.getAsJsonArray("stratifier");
11772      for (int i = 0; i < array.size(); i++) {
11773        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
11774      }
11775    };
11776  }
11777
11778  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11779    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
11780    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
11781    return res;
11782  }
11783
11784  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
11785    parseBackboneProperties(json, res);
11786    if (json.has("identifier"))
11787      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11788    if (json.has("code"))
11789      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11790    if (json.has("count"))
11791      res.setCountElement(parseInteger(json.get("count").getAsLong()));
11792    if (json.has("_count"))
11793      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
11794    if (json.has("patients"))
11795      res.setPatients(parseReference(json.getAsJsonObject("patients")));
11796  }
11797
11798  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11799    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
11800    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
11801    return res;
11802  }
11803
11804  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
11805    parseBackboneProperties(json, res);
11806    if (json.has("identifier"))
11807      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11808    if (json.has("stratum")) {
11809      JsonArray array = json.getAsJsonArray("stratum");
11810      for (int i = 0; i < array.size(); i++) {
11811        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
11812      }
11813    };
11814  }
11815
11816  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11817    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
11818    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
11819    return res;
11820  }
11821
11822  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
11823    parseBackboneProperties(json, res);
11824    if (json.has("value"))
11825      res.setValueElement(parseString(json.get("value").getAsString()));
11826    if (json.has("_value"))
11827      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
11828    if (json.has("population")) {
11829      JsonArray array = json.getAsJsonArray("population");
11830      for (int i = 0; i < array.size(); i++) {
11831        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
11832      }
11833    };
11834    if (json.has("measureScore"))
11835      res.setMeasureScoreElement(parseDecimal(json.get("measureScore").getAsBigDecimal()));
11836    if (json.has("_measureScore"))
11837      parseElementProperties(json.getAsJsonObject("_measureScore"), res.getMeasureScoreElement());
11838  }
11839
11840  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
11841    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
11842    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
11843    return res;
11844  }
11845
11846  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
11847    parseBackboneProperties(json, res);
11848    if (json.has("identifier"))
11849      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11850    if (json.has("code"))
11851      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11852    if (json.has("count"))
11853      res.setCountElement(parseInteger(json.get("count").getAsLong()));
11854    if (json.has("_count"))
11855      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
11856    if (json.has("patients"))
11857      res.setPatients(parseReference(json.getAsJsonObject("patients")));
11858  }
11859
11860  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
11861    Media res = new Media();
11862    parseMediaProperties(json, res);
11863    return res;
11864  }
11865
11866  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
11867    parseDomainResourceProperties(json, res);
11868    if (json.has("identifier")) {
11869      JsonArray array = json.getAsJsonArray("identifier");
11870      for (int i = 0; i < array.size(); i++) {
11871        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11872      }
11873    };
11874    if (json.has("basedOn")) {
11875      JsonArray array = json.getAsJsonArray("basedOn");
11876      for (int i = 0; i < array.size(); i++) {
11877        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
11878      }
11879    };
11880    if (json.has("type"))
11881      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Media.DigitalMediaType.NULL, new Media.DigitalMediaTypeEnumFactory()));
11882    if (json.has("_type"))
11883      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11884    if (json.has("subtype"))
11885      res.setSubtype(parseCodeableConcept(json.getAsJsonObject("subtype")));
11886    if (json.has("view"))
11887      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
11888    if (json.has("subject"))
11889      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11890    if (json.has("context"))
11891      res.setContext(parseReference(json.getAsJsonObject("context")));
11892    Type occurrence = parseType("occurrence", json);
11893    if (occurrence != null)
11894      res.setOccurrence(occurrence);
11895    if (json.has("operator"))
11896      res.setOperator(parseReference(json.getAsJsonObject("operator")));
11897    if (json.has("reasonCode")) {
11898      JsonArray array = json.getAsJsonArray("reasonCode");
11899      for (int i = 0; i < array.size(); i++) {
11900        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11901      }
11902    };
11903    if (json.has("bodySite"))
11904      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11905    if (json.has("device"))
11906      res.setDevice(parseReference(json.getAsJsonObject("device")));
11907    if (json.has("height"))
11908      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
11909    if (json.has("_height"))
11910      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
11911    if (json.has("width"))
11912      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
11913    if (json.has("_width"))
11914      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
11915    if (json.has("frames"))
11916      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
11917    if (json.has("_frames"))
11918      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
11919    if (json.has("duration"))
11920      res.setDurationElement(parseUnsignedInt(json.get("duration").getAsString()));
11921    if (json.has("_duration"))
11922      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
11923    if (json.has("content"))
11924      res.setContent(parseAttachment(json.getAsJsonObject("content")));
11925    if (json.has("note")) {
11926      JsonArray array = json.getAsJsonArray("note");
11927      for (int i = 0; i < array.size(); i++) {
11928        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11929      }
11930    };
11931  }
11932
11933  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
11934    Medication res = new Medication();
11935    parseMedicationProperties(json, res);
11936    return res;
11937  }
11938
11939  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
11940    parseDomainResourceProperties(json, res);
11941    if (json.has("code"))
11942      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11943    if (json.has("status"))
11944      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
11945    if (json.has("_status"))
11946      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11947    if (json.has("isBrand"))
11948      res.setIsBrandElement(parseBoolean(json.get("isBrand").getAsBoolean()));
11949    if (json.has("_isBrand"))
11950      parseElementProperties(json.getAsJsonObject("_isBrand"), res.getIsBrandElement());
11951    if (json.has("isOverTheCounter"))
11952      res.setIsOverTheCounterElement(parseBoolean(json.get("isOverTheCounter").getAsBoolean()));
11953    if (json.has("_isOverTheCounter"))
11954      parseElementProperties(json.getAsJsonObject("_isOverTheCounter"), res.getIsOverTheCounterElement());
11955    if (json.has("manufacturer"))
11956      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
11957    if (json.has("form"))
11958      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
11959    if (json.has("ingredient")) {
11960      JsonArray array = json.getAsJsonArray("ingredient");
11961      for (int i = 0; i < array.size(); i++) {
11962        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
11963      }
11964    };
11965    if (json.has("package"))
11966      res.setPackage(parseMedicationMedicationPackageComponent(json.getAsJsonObject("package"), res));
11967    if (json.has("image")) {
11968      JsonArray array = json.getAsJsonArray("image");
11969      for (int i = 0; i < array.size(); i++) {
11970        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
11971      }
11972    };
11973  }
11974
11975  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
11976    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
11977    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
11978    return res;
11979  }
11980
11981  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
11982    parseBackboneProperties(json, res);
11983    Type item = parseType("item", json);
11984    if (item != null)
11985      res.setItem(item);
11986    if (json.has("isActive"))
11987      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
11988    if (json.has("_isActive"))
11989      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
11990    if (json.has("amount"))
11991      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
11992  }
11993
11994  protected Medication.MedicationPackageComponent parseMedicationMedicationPackageComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
11995    Medication.MedicationPackageComponent res = new Medication.MedicationPackageComponent();
11996    parseMedicationMedicationPackageComponentProperties(json, owner, res);
11997    return res;
11998  }
11999
12000  protected void parseMedicationMedicationPackageComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageComponent res) throws IOException, FHIRFormatError {
12001    parseBackboneProperties(json, res);
12002    if (json.has("container"))
12003      res.setContainer(parseCodeableConcept(json.getAsJsonObject("container")));
12004    if (json.has("content")) {
12005      JsonArray array = json.getAsJsonArray("content");
12006      for (int i = 0; i < array.size(); i++) {
12007        res.getContent().add(parseMedicationMedicationPackageContentComponent(array.get(i).getAsJsonObject(), owner));
12008      }
12009    };
12010    if (json.has("batch")) {
12011      JsonArray array = json.getAsJsonArray("batch");
12012      for (int i = 0; i < array.size(); i++) {
12013        res.getBatch().add(parseMedicationMedicationPackageBatchComponent(array.get(i).getAsJsonObject(), owner));
12014      }
12015    };
12016  }
12017
12018  protected Medication.MedicationPackageContentComponent parseMedicationMedicationPackageContentComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12019    Medication.MedicationPackageContentComponent res = new Medication.MedicationPackageContentComponent();
12020    parseMedicationMedicationPackageContentComponentProperties(json, owner, res);
12021    return res;
12022  }
12023
12024  protected void parseMedicationMedicationPackageContentComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageContentComponent res) throws IOException, FHIRFormatError {
12025    parseBackboneProperties(json, res);
12026    Type item = parseType("item", json);
12027    if (item != null)
12028      res.setItem(item);
12029    if (json.has("amount"))
12030      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
12031  }
12032
12033  protected Medication.MedicationPackageBatchComponent parseMedicationMedicationPackageBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
12034    Medication.MedicationPackageBatchComponent res = new Medication.MedicationPackageBatchComponent();
12035    parseMedicationMedicationPackageBatchComponentProperties(json, owner, res);
12036    return res;
12037  }
12038
12039  protected void parseMedicationMedicationPackageBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationPackageBatchComponent res) throws IOException, FHIRFormatError {
12040    parseBackboneProperties(json, res);
12041    if (json.has("lotNumber"))
12042      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12043    if (json.has("_lotNumber"))
12044      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
12045    if (json.has("expirationDate"))
12046      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
12047    if (json.has("_expirationDate"))
12048      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
12049  }
12050
12051  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
12052    MedicationAdministration res = new MedicationAdministration();
12053    parseMedicationAdministrationProperties(json, res);
12054    return res;
12055  }
12056
12057  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
12058    parseDomainResourceProperties(json, res);
12059    if (json.has("identifier")) {
12060      JsonArray array = json.getAsJsonArray("identifier");
12061      for (int i = 0; i < array.size(); i++) {
12062        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12063      }
12064    };
12065    if (json.has("definition")) {
12066      JsonArray array = json.getAsJsonArray("definition");
12067      for (int i = 0; i < array.size(); i++) {
12068        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12069      }
12070    };
12071    if (json.has("partOf")) {
12072      JsonArray array = json.getAsJsonArray("partOf");
12073      for (int i = 0; i < array.size(); i++) {
12074        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12075      }
12076    };
12077    if (json.has("status"))
12078      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
12079    if (json.has("_status"))
12080      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12081    if (json.has("category"))
12082      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12083    Type medication = parseType("medication", json);
12084    if (medication != null)
12085      res.setMedication(medication);
12086    if (json.has("subject"))
12087      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12088    if (json.has("context"))
12089      res.setContext(parseReference(json.getAsJsonObject("context")));
12090    if (json.has("supportingInformation")) {
12091      JsonArray array = json.getAsJsonArray("supportingInformation");
12092      for (int i = 0; i < array.size(); i++) {
12093        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12094      }
12095    };
12096    Type effective = parseType("effective", json);
12097    if (effective != null)
12098      res.setEffective(effective);
12099    if (json.has("performer")) {
12100      JsonArray array = json.getAsJsonArray("performer");
12101      for (int i = 0; i < array.size(); i++) {
12102        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
12103      }
12104    };
12105    if (json.has("notGiven"))
12106      res.setNotGivenElement(parseBoolean(json.get("notGiven").getAsBoolean()));
12107    if (json.has("_notGiven"))
12108      parseElementProperties(json.getAsJsonObject("_notGiven"), res.getNotGivenElement());
12109    if (json.has("reasonNotGiven")) {
12110      JsonArray array = json.getAsJsonArray("reasonNotGiven");
12111      for (int i = 0; i < array.size(); i++) {
12112        res.getReasonNotGiven().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12113      }
12114    };
12115    if (json.has("reasonCode")) {
12116      JsonArray array = json.getAsJsonArray("reasonCode");
12117      for (int i = 0; i < array.size(); i++) {
12118        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12119      }
12120    };
12121    if (json.has("reasonReference")) {
12122      JsonArray array = json.getAsJsonArray("reasonReference");
12123      for (int i = 0; i < array.size(); i++) {
12124        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12125      }
12126    };
12127    if (json.has("prescription"))
12128      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
12129    if (json.has("device")) {
12130      JsonArray array = json.getAsJsonArray("device");
12131      for (int i = 0; i < array.size(); i++) {
12132        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
12133      }
12134    };
12135    if (json.has("note")) {
12136      JsonArray array = json.getAsJsonArray("note");
12137      for (int i = 0; i < array.size(); i++) {
12138        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12139      }
12140    };
12141    if (json.has("dosage"))
12142      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
12143    if (json.has("eventHistory")) {
12144      JsonArray array = json.getAsJsonArray("eventHistory");
12145      for (int i = 0; i < array.size(); i++) {
12146        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12147      }
12148    };
12149  }
12150
12151  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12152    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
12153    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
12154    return res;
12155  }
12156
12157  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
12158    parseBackboneProperties(json, res);
12159    if (json.has("actor"))
12160      res.setActor(parseReference(json.getAsJsonObject("actor")));
12161    if (json.has("onBehalfOf"))
12162      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12163  }
12164
12165  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
12166    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
12167    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
12168    return res;
12169  }
12170
12171  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
12172    parseBackboneProperties(json, res);
12173    if (json.has("text"))
12174      res.setTextElement(parseString(json.get("text").getAsString()));
12175    if (json.has("_text"))
12176      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
12177    if (json.has("site"))
12178      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
12179    if (json.has("route"))
12180      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
12181    if (json.has("method"))
12182      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
12183    if (json.has("dose"))
12184      res.setDose(parseSimpleQuantity(json.getAsJsonObject("dose")));
12185    Type rate = parseType("rate", json);
12186    if (rate != null)
12187      res.setRate(rate);
12188  }
12189
12190  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
12191    MedicationDispense res = new MedicationDispense();
12192    parseMedicationDispenseProperties(json, res);
12193    return res;
12194  }
12195
12196  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
12197    parseDomainResourceProperties(json, res);
12198    if (json.has("identifier")) {
12199      JsonArray array = json.getAsJsonArray("identifier");
12200      for (int i = 0; i < array.size(); i++) {
12201        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12202      }
12203    };
12204    if (json.has("partOf")) {
12205      JsonArray array = json.getAsJsonArray("partOf");
12206      for (int i = 0; i < array.size(); i++) {
12207        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12208      }
12209    };
12210    if (json.has("status"))
12211      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
12212    if (json.has("_status"))
12213      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12214    if (json.has("category"))
12215      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12216    Type medication = parseType("medication", json);
12217    if (medication != null)
12218      res.setMedication(medication);
12219    if (json.has("subject"))
12220      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12221    if (json.has("context"))
12222      res.setContext(parseReference(json.getAsJsonObject("context")));
12223    if (json.has("supportingInformation")) {
12224      JsonArray array = json.getAsJsonArray("supportingInformation");
12225      for (int i = 0; i < array.size(); i++) {
12226        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12227      }
12228    };
12229    if (json.has("performer")) {
12230      JsonArray array = json.getAsJsonArray("performer");
12231      for (int i = 0; i < array.size(); i++) {
12232        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
12233      }
12234    };
12235    if (json.has("authorizingPrescription")) {
12236      JsonArray array = json.getAsJsonArray("authorizingPrescription");
12237      for (int i = 0; i < array.size(); i++) {
12238        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
12239      }
12240    };
12241    if (json.has("type"))
12242      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12243    if (json.has("quantity"))
12244      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
12245    if (json.has("daysSupply"))
12246      res.setDaysSupply(parseSimpleQuantity(json.getAsJsonObject("daysSupply")));
12247    if (json.has("whenPrepared"))
12248      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
12249    if (json.has("_whenPrepared"))
12250      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
12251    if (json.has("whenHandedOver"))
12252      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
12253    if (json.has("_whenHandedOver"))
12254      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
12255    if (json.has("destination"))
12256      res.setDestination(parseReference(json.getAsJsonObject("destination")));
12257    if (json.has("receiver")) {
12258      JsonArray array = json.getAsJsonArray("receiver");
12259      for (int i = 0; i < array.size(); i++) {
12260        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
12261      }
12262    };
12263    if (json.has("note")) {
12264      JsonArray array = json.getAsJsonArray("note");
12265      for (int i = 0; i < array.size(); i++) {
12266        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12267      }
12268    };
12269    if (json.has("dosageInstruction")) {
12270      JsonArray array = json.getAsJsonArray("dosageInstruction");
12271      for (int i = 0; i < array.size(); i++) {
12272        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12273      }
12274    };
12275    if (json.has("substitution"))
12276      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
12277    if (json.has("detectedIssue")) {
12278      JsonArray array = json.getAsJsonArray("detectedIssue");
12279      for (int i = 0; i < array.size(); i++) {
12280        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12281      }
12282    };
12283    if (json.has("notDone"))
12284      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
12285    if (json.has("_notDone"))
12286      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
12287    Type notDoneReason = parseType("notDoneReason", json);
12288    if (notDoneReason != null)
12289      res.setNotDoneReason(notDoneReason);
12290    if (json.has("eventHistory")) {
12291      JsonArray array = json.getAsJsonArray("eventHistory");
12292      for (int i = 0; i < array.size(); i++) {
12293        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12294      }
12295    };
12296  }
12297
12298  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12299    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
12300    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
12301    return res;
12302  }
12303
12304  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
12305    parseBackboneProperties(json, res);
12306    if (json.has("actor"))
12307      res.setActor(parseReference(json.getAsJsonObject("actor")));
12308    if (json.has("onBehalfOf"))
12309      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12310  }
12311
12312  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
12313    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
12314    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
12315    return res;
12316  }
12317
12318  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
12319    parseBackboneProperties(json, res);
12320    if (json.has("wasSubstituted"))
12321      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
12322    if (json.has("_wasSubstituted"))
12323      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
12324    if (json.has("type"))
12325      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12326    if (json.has("reason")) {
12327      JsonArray array = json.getAsJsonArray("reason");
12328      for (int i = 0; i < array.size(); i++) {
12329        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12330      }
12331    };
12332    if (json.has("responsibleParty")) {
12333      JsonArray array = json.getAsJsonArray("responsibleParty");
12334      for (int i = 0; i < array.size(); i++) {
12335        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
12336      }
12337    };
12338  }
12339
12340  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
12341    MedicationRequest res = new MedicationRequest();
12342    parseMedicationRequestProperties(json, res);
12343    return res;
12344  }
12345
12346  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
12347    parseDomainResourceProperties(json, res);
12348    if (json.has("identifier")) {
12349      JsonArray array = json.getAsJsonArray("identifier");
12350      for (int i = 0; i < array.size(); i++) {
12351        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12352      }
12353    };
12354    if (json.has("definition")) {
12355      JsonArray array = json.getAsJsonArray("definition");
12356      for (int i = 0; i < array.size(); i++) {
12357        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
12358      }
12359    };
12360    if (json.has("basedOn")) {
12361      JsonArray array = json.getAsJsonArray("basedOn");
12362      for (int i = 0; i < array.size(); i++) {
12363        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12364      }
12365    };
12366    if (json.has("groupIdentifier"))
12367      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
12368    if (json.has("status"))
12369      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
12370    if (json.has("_status"))
12371      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12372    if (json.has("intent"))
12373      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
12374    if (json.has("_intent"))
12375      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
12376    if (json.has("category"))
12377      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12378    if (json.has("priority"))
12379      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
12380    if (json.has("_priority"))
12381      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
12382    Type medication = parseType("medication", json);
12383    if (medication != null)
12384      res.setMedication(medication);
12385    if (json.has("subject"))
12386      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12387    if (json.has("context"))
12388      res.setContext(parseReference(json.getAsJsonObject("context")));
12389    if (json.has("supportingInformation")) {
12390      JsonArray array = json.getAsJsonArray("supportingInformation");
12391      for (int i = 0; i < array.size(); i++) {
12392        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
12393      }
12394    };
12395    if (json.has("authoredOn"))
12396      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
12397    if (json.has("_authoredOn"))
12398      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
12399    if (json.has("requester"))
12400      res.setRequester(parseMedicationRequestMedicationRequestRequesterComponent(json.getAsJsonObject("requester"), res));
12401    if (json.has("recorder"))
12402      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
12403    if (json.has("reasonCode")) {
12404      JsonArray array = json.getAsJsonArray("reasonCode");
12405      for (int i = 0; i < array.size(); i++) {
12406        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12407      }
12408    };
12409    if (json.has("reasonReference")) {
12410      JsonArray array = json.getAsJsonArray("reasonReference");
12411      for (int i = 0; i < array.size(); i++) {
12412        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12413      }
12414    };
12415    if (json.has("note")) {
12416      JsonArray array = json.getAsJsonArray("note");
12417      for (int i = 0; i < array.size(); i++) {
12418        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12419      }
12420    };
12421    if (json.has("dosageInstruction")) {
12422      JsonArray array = json.getAsJsonArray("dosageInstruction");
12423      for (int i = 0; i < array.size(); i++) {
12424        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
12425      }
12426    };
12427    if (json.has("dispenseRequest"))
12428      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
12429    if (json.has("substitution"))
12430      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
12431    if (json.has("priorPrescription"))
12432      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
12433    if (json.has("detectedIssue")) {
12434      JsonArray array = json.getAsJsonArray("detectedIssue");
12435      for (int i = 0; i < array.size(); i++) {
12436        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
12437      }
12438    };
12439    if (json.has("eventHistory")) {
12440      JsonArray array = json.getAsJsonArray("eventHistory");
12441      for (int i = 0; i < array.size(); i++) {
12442        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
12443      }
12444    };
12445  }
12446
12447  protected MedicationRequest.MedicationRequestRequesterComponent parseMedicationRequestMedicationRequestRequesterComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12448    MedicationRequest.MedicationRequestRequesterComponent res = new MedicationRequest.MedicationRequestRequesterComponent();
12449    parseMedicationRequestMedicationRequestRequesterComponentProperties(json, owner, res);
12450    return res;
12451  }
12452
12453  protected void parseMedicationRequestMedicationRequestRequesterComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestRequesterComponent res) throws IOException, FHIRFormatError {
12454    parseBackboneProperties(json, res);
12455    if (json.has("agent"))
12456      res.setAgent(parseReference(json.getAsJsonObject("agent")));
12457    if (json.has("onBehalfOf"))
12458      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
12459  }
12460
12461  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12462    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
12463    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
12464    return res;
12465  }
12466
12467  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
12468    parseBackboneProperties(json, res);
12469    if (json.has("validityPeriod"))
12470      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
12471    if (json.has("numberOfRepeatsAllowed"))
12472      res.setNumberOfRepeatsAllowedElement(parsePositiveInt(json.get("numberOfRepeatsAllowed").getAsString()));
12473    if (json.has("_numberOfRepeatsAllowed"))
12474      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
12475    if (json.has("quantity"))
12476      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
12477    if (json.has("expectedSupplyDuration"))
12478      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
12479    if (json.has("performer"))
12480      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
12481  }
12482
12483  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
12484    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
12485    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
12486    return res;
12487  }
12488
12489  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
12490    parseBackboneProperties(json, res);
12491    if (json.has("allowed"))
12492      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
12493    if (json.has("_allowed"))
12494      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
12495    if (json.has("reason"))
12496      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12497  }
12498
12499  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
12500    MedicationStatement res = new MedicationStatement();
12501    parseMedicationStatementProperties(json, res);
12502    return res;
12503  }
12504
12505  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
12506    parseDomainResourceProperties(json, res);
12507    if (json.has("identifier")) {
12508      JsonArray array = json.getAsJsonArray("identifier");
12509      for (int i = 0; i < array.size(); i++) {
12510        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12511      }
12512    };
12513    if (json.has("basedOn")) {
12514      JsonArray array = json.getAsJsonArray("basedOn");
12515      for (int i = 0; i < array.size(); i++) {
12516        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12517      }
12518    };
12519    if (json.has("partOf")) {
12520      JsonArray array = json.getAsJsonArray("partOf");
12521      for (int i = 0; i < array.size(); i++) {
12522        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
12523      }
12524    };
12525    if (json.has("context"))
12526      res.setContext(parseReference(json.getAsJsonObject("context")));
12527    if (json.has("status"))
12528      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
12529    if (json.has("_status"))
12530      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12531    if (json.has("category"))
12532      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
12533    Type medication = parseType("medication", json);
12534    if (medication != null)
12535      res.setMedication(medication);
12536    Type effective = parseType("effective", json);
12537    if (effective != null)
12538      res.setEffective(effective);
12539    if (json.has("dateAsserted"))
12540      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
12541    if (json.has("_dateAsserted"))
12542      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
12543    if (json.has("informationSource"))
12544      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
12545    if (json.has("subject"))
12546      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12547    if (json.has("derivedFrom")) {
12548      JsonArray array = json.getAsJsonArray("derivedFrom");
12549      for (int i = 0; i < array.size(); i++) {
12550        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
12551      }
12552    };
12553    if (json.has("taken"))
12554      res.setTakenElement(parseEnumeration(json.get("taken").getAsString(), MedicationStatement.MedicationStatementTaken.NULL, new MedicationStatement.MedicationStatementTakenEnumFactory()));
12555    if (json.has("_taken"))
12556      parseElementProperties(json.getAsJsonObject("_taken"), res.getTakenElement());
12557    if (json.has("reasonNotTaken")) {
12558      JsonArray array = json.getAsJsonArray("reasonNotTaken");
12559      for (int i = 0; i < array.size(); i++) {
12560        res.getReasonNotTaken().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12561      }
12562    };
12563    if (json.has("reasonCode")) {
12564      JsonArray array = json.getAsJsonArray("reasonCode");
12565      for (int i = 0; i < array.size(); i++) {
12566        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12567      }
12568    };
12569    if (json.has("reasonReference")) {
12570      JsonArray array = json.getAsJsonArray("reasonReference");
12571      for (int i = 0; i < array.size(); i++) {
12572        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12573      }
12574    };
12575    if (json.has("note")) {
12576      JsonArray array = json.getAsJsonArray("note");
12577      for (int i = 0; i < array.size(); i++) {
12578        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12579      }
12580    };
12581    if (json.has("dosage")) {
12582      JsonArray array = json.getAsJsonArray("dosage");
12583      for (int i = 0; i < array.size(); i++) {
12584        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
12585      }
12586    };
12587  }
12588
12589  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
12590    MessageDefinition res = new MessageDefinition();
12591    parseMessageDefinitionProperties(json, res);
12592    return res;
12593  }
12594
12595  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
12596    parseDomainResourceProperties(json, res);
12597    if (json.has("url"))
12598      res.setUrlElement(parseUri(json.get("url").getAsString()));
12599    if (json.has("_url"))
12600      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12601    if (json.has("identifier"))
12602      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12603    if (json.has("version"))
12604      res.setVersionElement(parseString(json.get("version").getAsString()));
12605    if (json.has("_version"))
12606      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12607    if (json.has("name"))
12608      res.setNameElement(parseString(json.get("name").getAsString()));
12609    if (json.has("_name"))
12610      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12611    if (json.has("title"))
12612      res.setTitleElement(parseString(json.get("title").getAsString()));
12613    if (json.has("_title"))
12614      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12615    if (json.has("status"))
12616      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12617    if (json.has("_status"))
12618      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12619    if (json.has("experimental"))
12620      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12621    if (json.has("_experimental"))
12622      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12623    if (json.has("date"))
12624      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12625    if (json.has("_date"))
12626      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12627    if (json.has("publisher"))
12628      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12629    if (json.has("_publisher"))
12630      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12631    if (json.has("contact")) {
12632      JsonArray array = json.getAsJsonArray("contact");
12633      for (int i = 0; i < array.size(); i++) {
12634        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12635      }
12636    };
12637    if (json.has("description"))
12638      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12639    if (json.has("_description"))
12640      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12641    if (json.has("useContext")) {
12642      JsonArray array = json.getAsJsonArray("useContext");
12643      for (int i = 0; i < array.size(); i++) {
12644        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12645      }
12646    };
12647    if (json.has("jurisdiction")) {
12648      JsonArray array = json.getAsJsonArray("jurisdiction");
12649      for (int i = 0; i < array.size(); i++) {
12650        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12651      }
12652    };
12653    if (json.has("purpose"))
12654      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12655    if (json.has("_purpose"))
12656      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12657    if (json.has("copyright"))
12658      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
12659    if (json.has("_copyright"))
12660      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
12661    if (json.has("base"))
12662      res.setBase(parseReference(json.getAsJsonObject("base")));
12663    if (json.has("parent")) {
12664      JsonArray array = json.getAsJsonArray("parent");
12665      for (int i = 0; i < array.size(); i++) {
12666        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
12667      }
12668    };
12669    if (json.has("replaces")) {
12670      JsonArray array = json.getAsJsonArray("replaces");
12671      for (int i = 0; i < array.size(); i++) {
12672        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
12673      }
12674    };
12675    if (json.has("event"))
12676      res.setEvent(parseCoding(json.getAsJsonObject("event")));
12677    if (json.has("category"))
12678      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
12679    if (json.has("_category"))
12680      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
12681    if (json.has("focus")) {
12682      JsonArray array = json.getAsJsonArray("focus");
12683      for (int i = 0; i < array.size(); i++) {
12684        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
12685      }
12686    };
12687    if (json.has("responseRequired"))
12688      res.setResponseRequiredElement(parseBoolean(json.get("responseRequired").getAsBoolean()));
12689    if (json.has("_responseRequired"))
12690      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
12691    if (json.has("allowedResponse")) {
12692      JsonArray array = json.getAsJsonArray("allowedResponse");
12693      for (int i = 0; i < array.size(); i++) {
12694        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
12695      }
12696    };
12697  }
12698
12699  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12700    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
12701    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
12702    return res;
12703  }
12704
12705  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
12706    parseBackboneProperties(json, res);
12707    if (json.has("code"))
12708      res.setCodeElement(parseCode(json.get("code").getAsString()));
12709    if (json.has("_code"))
12710      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12711    if (json.has("profile"))
12712      res.setProfile(parseReference(json.getAsJsonObject("profile")));
12713    if (json.has("min"))
12714      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
12715    if (json.has("_min"))
12716      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
12717    if (json.has("max"))
12718      res.setMaxElement(parseString(json.get("max").getAsString()));
12719    if (json.has("_max"))
12720      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
12721  }
12722
12723  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
12724    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
12725    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
12726    return res;
12727  }
12728
12729  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
12730    parseBackboneProperties(json, res);
12731    if (json.has("message"))
12732      res.setMessage(parseReference(json.getAsJsonObject("message")));
12733    if (json.has("situation"))
12734      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
12735    if (json.has("_situation"))
12736      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
12737  }
12738
12739  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
12740    MessageHeader res = new MessageHeader();
12741    parseMessageHeaderProperties(json, res);
12742    return res;
12743  }
12744
12745  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
12746    parseDomainResourceProperties(json, res);
12747    if (json.has("event"))
12748      res.setEvent(parseCoding(json.getAsJsonObject("event")));
12749    if (json.has("destination")) {
12750      JsonArray array = json.getAsJsonArray("destination");
12751      for (int i = 0; i < array.size(); i++) {
12752        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
12753      }
12754    };
12755    if (json.has("receiver"))
12756      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
12757    if (json.has("sender"))
12758      res.setSender(parseReference(json.getAsJsonObject("sender")));
12759    if (json.has("timestamp"))
12760      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
12761    if (json.has("_timestamp"))
12762      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
12763    if (json.has("enterer"))
12764      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
12765    if (json.has("author"))
12766      res.setAuthor(parseReference(json.getAsJsonObject("author")));
12767    if (json.has("source"))
12768      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
12769    if (json.has("responsible"))
12770      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
12771    if (json.has("reason"))
12772      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
12773    if (json.has("response"))
12774      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
12775    if (json.has("focus")) {
12776      JsonArray array = json.getAsJsonArray("focus");
12777      for (int i = 0; i < array.size(); i++) {
12778        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
12779      }
12780    };
12781  }
12782
12783  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12784    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
12785    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
12786    return res;
12787  }
12788
12789  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
12790    parseBackboneProperties(json, res);
12791    if (json.has("name"))
12792      res.setNameElement(parseString(json.get("name").getAsString()));
12793    if (json.has("_name"))
12794      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12795    if (json.has("target"))
12796      res.setTarget(parseReference(json.getAsJsonObject("target")));
12797    if (json.has("endpoint"))
12798      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
12799    if (json.has("_endpoint"))
12800      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
12801  }
12802
12803  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12804    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
12805    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
12806    return res;
12807  }
12808
12809  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
12810    parseBackboneProperties(json, res);
12811    if (json.has("name"))
12812      res.setNameElement(parseString(json.get("name").getAsString()));
12813    if (json.has("_name"))
12814      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12815    if (json.has("software"))
12816      res.setSoftwareElement(parseString(json.get("software").getAsString()));
12817    if (json.has("_software"))
12818      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
12819    if (json.has("version"))
12820      res.setVersionElement(parseString(json.get("version").getAsString()));
12821    if (json.has("_version"))
12822      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12823    if (json.has("contact"))
12824      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
12825    if (json.has("endpoint"))
12826      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
12827    if (json.has("_endpoint"))
12828      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
12829  }
12830
12831  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
12832    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
12833    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
12834    return res;
12835  }
12836
12837  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
12838    parseBackboneProperties(json, res);
12839    if (json.has("identifier"))
12840      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
12841    if (json.has("_identifier"))
12842      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
12843    if (json.has("code"))
12844      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
12845    if (json.has("_code"))
12846      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12847    if (json.has("details"))
12848      res.setDetails(parseReference(json.getAsJsonObject("details")));
12849  }
12850
12851  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
12852    NamingSystem res = new NamingSystem();
12853    parseNamingSystemProperties(json, res);
12854    return res;
12855  }
12856
12857  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
12858    parseDomainResourceProperties(json, res);
12859    if (json.has("name"))
12860      res.setNameElement(parseString(json.get("name").getAsString()));
12861    if (json.has("_name"))
12862      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12863    if (json.has("status"))
12864      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12865    if (json.has("_status"))
12866      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12867    if (json.has("kind"))
12868      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
12869    if (json.has("_kind"))
12870      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
12871    if (json.has("date"))
12872      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12873    if (json.has("_date"))
12874      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12875    if (json.has("publisher"))
12876      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12877    if (json.has("_publisher"))
12878      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12879    if (json.has("contact")) {
12880      JsonArray array = json.getAsJsonArray("contact");
12881      for (int i = 0; i < array.size(); i++) {
12882        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12883      }
12884    };
12885    if (json.has("responsible"))
12886      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
12887    if (json.has("_responsible"))
12888      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
12889    if (json.has("type"))
12890      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
12891    if (json.has("description"))
12892      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12893    if (json.has("_description"))
12894      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12895    if (json.has("useContext")) {
12896      JsonArray array = json.getAsJsonArray("useContext");
12897      for (int i = 0; i < array.size(); i++) {
12898        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12899      }
12900    };
12901    if (json.has("jurisdiction")) {
12902      JsonArray array = json.getAsJsonArray("jurisdiction");
12903      for (int i = 0; i < array.size(); i++) {
12904        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12905      }
12906    };
12907    if (json.has("usage"))
12908      res.setUsageElement(parseString(json.get("usage").getAsString()));
12909    if (json.has("_usage"))
12910      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
12911    if (json.has("uniqueId")) {
12912      JsonArray array = json.getAsJsonArray("uniqueId");
12913      for (int i = 0; i < array.size(); i++) {
12914        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
12915      }
12916    };
12917    if (json.has("replacedBy"))
12918      res.setReplacedBy(parseReference(json.getAsJsonObject("replacedBy")));
12919  }
12920
12921  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
12922    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
12923    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
12924    return res;
12925  }
12926
12927  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
12928    parseBackboneProperties(json, res);
12929    if (json.has("type"))
12930      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
12931    if (json.has("_type"))
12932      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12933    if (json.has("value"))
12934      res.setValueElement(parseString(json.get("value").getAsString()));
12935    if (json.has("_value"))
12936      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
12937    if (json.has("preferred"))
12938      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
12939    if (json.has("_preferred"))
12940      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
12941    if (json.has("comment"))
12942      res.setCommentElement(parseString(json.get("comment").getAsString()));
12943    if (json.has("_comment"))
12944      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
12945    if (json.has("period"))
12946      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12947  }
12948
12949  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
12950    NutritionOrder res = new NutritionOrder();
12951    parseNutritionOrderProperties(json, res);
12952    return res;
12953  }
12954
12955  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
12956    parseDomainResourceProperties(json, res);
12957    if (json.has("identifier")) {
12958      JsonArray array = json.getAsJsonArray("identifier");
12959      for (int i = 0; i < array.size(); i++) {
12960        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12961      }
12962    };
12963    if (json.has("status"))
12964      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
12965    if (json.has("_status"))
12966      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12967    if (json.has("patient"))
12968      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12969    if (json.has("encounter"))
12970      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12971    if (json.has("dateTime"))
12972      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
12973    if (json.has("_dateTime"))
12974      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
12975    if (json.has("orderer"))
12976      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
12977    if (json.has("allergyIntolerance")) {
12978      JsonArray array = json.getAsJsonArray("allergyIntolerance");
12979      for (int i = 0; i < array.size(); i++) {
12980        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
12981      }
12982    };
12983    if (json.has("foodPreferenceModifier")) {
12984      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
12985      for (int i = 0; i < array.size(); i++) {
12986        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12987      }
12988    };
12989    if (json.has("excludeFoodModifier")) {
12990      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
12991      for (int i = 0; i < array.size(); i++) {
12992        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12993      }
12994    };
12995    if (json.has("oralDiet"))
12996      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
12997    if (json.has("supplement")) {
12998      JsonArray array = json.getAsJsonArray("supplement");
12999      for (int i = 0; i < array.size(); i++) {
13000        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
13001      }
13002    };
13003    if (json.has("enteralFormula"))
13004      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
13005  }
13006
13007  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13008    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
13009    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
13010    return res;
13011  }
13012
13013  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
13014    parseBackboneProperties(json, res);
13015    if (json.has("type")) {
13016      JsonArray array = json.getAsJsonArray("type");
13017      for (int i = 0; i < array.size(); i++) {
13018        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13019      }
13020    };
13021    if (json.has("schedule")) {
13022      JsonArray array = json.getAsJsonArray("schedule");
13023      for (int i = 0; i < array.size(); i++) {
13024        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13025      }
13026    };
13027    if (json.has("nutrient")) {
13028      JsonArray array = json.getAsJsonArray("nutrient");
13029      for (int i = 0; i < array.size(); i++) {
13030        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
13031      }
13032    };
13033    if (json.has("texture")) {
13034      JsonArray array = json.getAsJsonArray("texture");
13035      for (int i = 0; i < array.size(); i++) {
13036        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
13037      }
13038    };
13039    if (json.has("fluidConsistencyType")) {
13040      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
13041      for (int i = 0; i < array.size(); i++) {
13042        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13043      }
13044    };
13045    if (json.has("instruction"))
13046      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13047    if (json.has("_instruction"))
13048      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
13049  }
13050
13051  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13052    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
13053    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
13054    return res;
13055  }
13056
13057  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
13058    parseBackboneProperties(json, res);
13059    if (json.has("modifier"))
13060      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
13061    if (json.has("amount"))
13062      res.setAmount(parseSimpleQuantity(json.getAsJsonObject("amount")));
13063  }
13064
13065  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13066    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
13067    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
13068    return res;
13069  }
13070
13071  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
13072    parseBackboneProperties(json, res);
13073    if (json.has("modifier"))
13074      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
13075    if (json.has("foodType"))
13076      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
13077  }
13078
13079  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13080    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
13081    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
13082    return res;
13083  }
13084
13085  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
13086    parseBackboneProperties(json, res);
13087    if (json.has("type"))
13088      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13089    if (json.has("productName"))
13090      res.setProductNameElement(parseString(json.get("productName").getAsString()));
13091    if (json.has("_productName"))
13092      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
13093    if (json.has("schedule")) {
13094      JsonArray array = json.getAsJsonArray("schedule");
13095      for (int i = 0; i < array.size(); i++) {
13096        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
13097      }
13098    };
13099    if (json.has("quantity"))
13100      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13101    if (json.has("instruction"))
13102      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
13103    if (json.has("_instruction"))
13104      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
13105  }
13106
13107  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13108    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
13109    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
13110    return res;
13111  }
13112
13113  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
13114    parseBackboneProperties(json, res);
13115    if (json.has("baseFormulaType"))
13116      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
13117    if (json.has("baseFormulaProductName"))
13118      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
13119    if (json.has("_baseFormulaProductName"))
13120      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
13121    if (json.has("additiveType"))
13122      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
13123    if (json.has("additiveProductName"))
13124      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
13125    if (json.has("_additiveProductName"))
13126      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
13127    if (json.has("caloricDensity"))
13128      res.setCaloricDensity(parseSimpleQuantity(json.getAsJsonObject("caloricDensity")));
13129    if (json.has("routeofAdministration"))
13130      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
13131    if (json.has("administration")) {
13132      JsonArray array = json.getAsJsonArray("administration");
13133      for (int i = 0; i < array.size(); i++) {
13134        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
13135      }
13136    };
13137    if (json.has("maxVolumeToDeliver"))
13138      res.setMaxVolumeToDeliver(parseSimpleQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
13139    if (json.has("administrationInstruction"))
13140      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
13141    if (json.has("_administrationInstruction"))
13142      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
13143  }
13144
13145  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
13146    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
13147    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
13148    return res;
13149  }
13150
13151  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
13152    parseBackboneProperties(json, res);
13153    if (json.has("schedule"))
13154      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
13155    if (json.has("quantity"))
13156      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
13157    Type rate = parseType("rate", json);
13158    if (rate != null)
13159      res.setRate(rate);
13160  }
13161
13162  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
13163    Observation res = new Observation();
13164    parseObservationProperties(json, res);
13165    return res;
13166  }
13167
13168  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
13169    parseDomainResourceProperties(json, res);
13170    if (json.has("identifier")) {
13171      JsonArray array = json.getAsJsonArray("identifier");
13172      for (int i = 0; i < array.size(); i++) {
13173        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13174      }
13175    };
13176    if (json.has("basedOn")) {
13177      JsonArray array = json.getAsJsonArray("basedOn");
13178      for (int i = 0; i < array.size(); i++) {
13179        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
13180      }
13181    };
13182    if (json.has("status"))
13183      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
13184    if (json.has("_status"))
13185      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13186    if (json.has("category")) {
13187      JsonArray array = json.getAsJsonArray("category");
13188      for (int i = 0; i < array.size(); i++) {
13189        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13190      }
13191    };
13192    if (json.has("code"))
13193      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13194    if (json.has("subject"))
13195      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13196    if (json.has("context"))
13197      res.setContext(parseReference(json.getAsJsonObject("context")));
13198    Type effective = parseType("effective", json);
13199    if (effective != null)
13200      res.setEffective(effective);
13201    if (json.has("issued"))
13202      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
13203    if (json.has("_issued"))
13204      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
13205    if (json.has("performer")) {
13206      JsonArray array = json.getAsJsonArray("performer");
13207      for (int i = 0; i < array.size(); i++) {
13208        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
13209      }
13210    };
13211    Type value = parseType("value", json);
13212    if (value != null)
13213      res.setValue(value);
13214    if (json.has("dataAbsentReason"))
13215      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
13216    if (json.has("interpretation"))
13217      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
13218    if (json.has("comment"))
13219      res.setCommentElement(parseString(json.get("comment").getAsString()));
13220    if (json.has("_comment"))
13221      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13222    if (json.has("bodySite"))
13223      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
13224    if (json.has("method"))
13225      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
13226    if (json.has("specimen"))
13227      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
13228    if (json.has("device"))
13229      res.setDevice(parseReference(json.getAsJsonObject("device")));
13230    if (json.has("referenceRange")) {
13231      JsonArray array = json.getAsJsonArray("referenceRange");
13232      for (int i = 0; i < array.size(); i++) {
13233        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
13234      }
13235    };
13236    if (json.has("related")) {
13237      JsonArray array = json.getAsJsonArray("related");
13238      for (int i = 0; i < array.size(); i++) {
13239        res.getRelated().add(parseObservationObservationRelatedComponent(array.get(i).getAsJsonObject(), res));
13240      }
13241    };
13242    if (json.has("component")) {
13243      JsonArray array = json.getAsJsonArray("component");
13244      for (int i = 0; i < array.size(); i++) {
13245        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
13246      }
13247    };
13248  }
13249
13250  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13251    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
13252    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
13253    return res;
13254  }
13255
13256  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
13257    parseBackboneProperties(json, res);
13258    if (json.has("low"))
13259      res.setLow(parseSimpleQuantity(json.getAsJsonObject("low")));
13260    if (json.has("high"))
13261      res.setHigh(parseSimpleQuantity(json.getAsJsonObject("high")));
13262    if (json.has("type"))
13263      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13264    if (json.has("appliesTo")) {
13265      JsonArray array = json.getAsJsonArray("appliesTo");
13266      for (int i = 0; i < array.size(); i++) {
13267        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13268      }
13269    };
13270    if (json.has("age"))
13271      res.setAge(parseRange(json.getAsJsonObject("age")));
13272    if (json.has("text"))
13273      res.setTextElement(parseString(json.get("text").getAsString()));
13274    if (json.has("_text"))
13275      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
13276  }
13277
13278  protected Observation.ObservationRelatedComponent parseObservationObservationRelatedComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13279    Observation.ObservationRelatedComponent res = new Observation.ObservationRelatedComponent();
13280    parseObservationObservationRelatedComponentProperties(json, owner, res);
13281    return res;
13282  }
13283
13284  protected void parseObservationObservationRelatedComponentProperties(JsonObject json, Observation owner, Observation.ObservationRelatedComponent res) throws IOException, FHIRFormatError {
13285    parseBackboneProperties(json, res);
13286    if (json.has("type"))
13287      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Observation.ObservationRelationshipType.NULL, new Observation.ObservationRelationshipTypeEnumFactory()));
13288    if (json.has("_type"))
13289      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13290    if (json.has("target"))
13291      res.setTarget(parseReference(json.getAsJsonObject("target")));
13292  }
13293
13294  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
13295    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
13296    parseObservationObservationComponentComponentProperties(json, owner, res);
13297    return res;
13298  }
13299
13300  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
13301    parseBackboneProperties(json, res);
13302    if (json.has("code"))
13303      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13304    Type value = parseType("value", json);
13305    if (value != null)
13306      res.setValue(value);
13307    if (json.has("dataAbsentReason"))
13308      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
13309    if (json.has("interpretation"))
13310      res.setInterpretation(parseCodeableConcept(json.getAsJsonObject("interpretation")));
13311    if (json.has("referenceRange")) {
13312      JsonArray array = json.getAsJsonArray("referenceRange");
13313      for (int i = 0; i < array.size(); i++) {
13314        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
13315      }
13316    };
13317  }
13318
13319  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
13320    OperationDefinition res = new OperationDefinition();
13321    parseOperationDefinitionProperties(json, res);
13322    return res;
13323  }
13324
13325  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
13326    parseDomainResourceProperties(json, res);
13327    if (json.has("url"))
13328      res.setUrlElement(parseUri(json.get("url").getAsString()));
13329    if (json.has("_url"))
13330      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13331    if (json.has("version"))
13332      res.setVersionElement(parseString(json.get("version").getAsString()));
13333    if (json.has("_version"))
13334      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13335    if (json.has("name"))
13336      res.setNameElement(parseString(json.get("name").getAsString()));
13337    if (json.has("_name"))
13338      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13339    if (json.has("status"))
13340      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13341    if (json.has("_status"))
13342      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13343    if (json.has("kind"))
13344      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
13345    if (json.has("_kind"))
13346      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
13347    if (json.has("experimental"))
13348      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13349    if (json.has("_experimental"))
13350      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13351    if (json.has("date"))
13352      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13353    if (json.has("_date"))
13354      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13355    if (json.has("publisher"))
13356      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13357    if (json.has("_publisher"))
13358      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13359    if (json.has("contact")) {
13360      JsonArray array = json.getAsJsonArray("contact");
13361      for (int i = 0; i < array.size(); i++) {
13362        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13363      }
13364    };
13365    if (json.has("description"))
13366      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13367    if (json.has("_description"))
13368      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13369    if (json.has("useContext")) {
13370      JsonArray array = json.getAsJsonArray("useContext");
13371      for (int i = 0; i < array.size(); i++) {
13372        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13373      }
13374    };
13375    if (json.has("jurisdiction")) {
13376      JsonArray array = json.getAsJsonArray("jurisdiction");
13377      for (int i = 0; i < array.size(); i++) {
13378        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13379      }
13380    };
13381    if (json.has("purpose"))
13382      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
13383    if (json.has("_purpose"))
13384      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
13385    if (json.has("idempotent"))
13386      res.setIdempotentElement(parseBoolean(json.get("idempotent").getAsBoolean()));
13387    if (json.has("_idempotent"))
13388      parseElementProperties(json.getAsJsonObject("_idempotent"), res.getIdempotentElement());
13389    if (json.has("code"))
13390      res.setCodeElement(parseCode(json.get("code").getAsString()));
13391    if (json.has("_code"))
13392      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13393    if (json.has("comment"))
13394      res.setCommentElement(parseString(json.get("comment").getAsString()));
13395    if (json.has("_comment"))
13396      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13397    if (json.has("base"))
13398      res.setBase(parseReference(json.getAsJsonObject("base")));
13399    if (json.has("resource")) {
13400      JsonArray array = json.getAsJsonArray("resource");
13401      for (int i = 0; i < array.size(); i++) {
13402        res.getResource().add(parseCode(array.get(i).getAsString()));
13403      }
13404    };
13405    if (json.has("_resource")) {
13406      JsonArray array = json.getAsJsonArray("_resource");
13407      for (int i = 0; i < array.size(); i++) {
13408        if (i == res.getResource().size())
13409          res.getResource().add(parseCode(null));
13410        if (array.get(i) instanceof JsonObject) 
13411          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
13412      }
13413    };
13414    if (json.has("system"))
13415      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
13416    if (json.has("_system"))
13417      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
13418    if (json.has("type"))
13419      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
13420    if (json.has("_type"))
13421      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13422    if (json.has("instance"))
13423      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
13424    if (json.has("_instance"))
13425      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
13426    if (json.has("parameter")) {
13427      JsonArray array = json.getAsJsonArray("parameter");
13428      for (int i = 0; i < array.size(); i++) {
13429        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
13430      }
13431    };
13432    if (json.has("overload")) {
13433      JsonArray array = json.getAsJsonArray("overload");
13434      for (int i = 0; i < array.size(); i++) {
13435        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
13436      }
13437    };
13438  }
13439
13440  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13441    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
13442    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
13443    return res;
13444  }
13445
13446  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
13447    parseBackboneProperties(json, res);
13448    if (json.has("name"))
13449      res.setNameElement(parseCode(json.get("name").getAsString()));
13450    if (json.has("_name"))
13451      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13452    if (json.has("use"))
13453      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
13454    if (json.has("_use"))
13455      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
13456    if (json.has("min"))
13457      res.setMinElement(parseInteger(json.get("min").getAsLong()));
13458    if (json.has("_min"))
13459      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
13460    if (json.has("max"))
13461      res.setMaxElement(parseString(json.get("max").getAsString()));
13462    if (json.has("_max"))
13463      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
13464    if (json.has("documentation"))
13465      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
13466    if (json.has("_documentation"))
13467      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
13468    if (json.has("type"))
13469      res.setTypeElement(parseCode(json.get("type").getAsString()));
13470    if (json.has("_type"))
13471      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13472    if (json.has("searchType"))
13473      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
13474    if (json.has("_searchType"))
13475      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
13476    if (json.has("profile"))
13477      res.setProfile(parseReference(json.getAsJsonObject("profile")));
13478    if (json.has("binding"))
13479      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
13480    if (json.has("part")) {
13481      JsonArray array = json.getAsJsonArray("part");
13482      for (int i = 0; i < array.size(); i++) {
13483        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
13484      }
13485    };
13486  }
13487
13488  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13489    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
13490    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
13491    return res;
13492  }
13493
13494  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
13495    parseBackboneProperties(json, res);
13496    if (json.has("strength"))
13497      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
13498    if (json.has("_strength"))
13499      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
13500    Type valueSet = parseType("valueSet", json);
13501    if (valueSet != null)
13502      res.setValueSet(valueSet);
13503  }
13504
13505  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
13506    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
13507    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
13508    return res;
13509  }
13510
13511  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
13512    parseBackboneProperties(json, res);
13513    if (json.has("parameterName")) {
13514      JsonArray array = json.getAsJsonArray("parameterName");
13515      for (int i = 0; i < array.size(); i++) {
13516        res.getParameterName().add(parseString(array.get(i).getAsString()));
13517      }
13518    };
13519    if (json.has("_parameterName")) {
13520      JsonArray array = json.getAsJsonArray("_parameterName");
13521      for (int i = 0; i < array.size(); i++) {
13522        if (i == res.getParameterName().size())
13523          res.getParameterName().add(parseString(null));
13524        if (array.get(i) instanceof JsonObject) 
13525          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
13526      }
13527    };
13528    if (json.has("comment"))
13529      res.setCommentElement(parseString(json.get("comment").getAsString()));
13530    if (json.has("_comment"))
13531      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13532  }
13533
13534  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
13535    OperationOutcome res = new OperationOutcome();
13536    parseOperationOutcomeProperties(json, res);
13537    return res;
13538  }
13539
13540  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
13541    parseDomainResourceProperties(json, res);
13542    if (json.has("issue")) {
13543      JsonArray array = json.getAsJsonArray("issue");
13544      for (int i = 0; i < array.size(); i++) {
13545        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
13546      }
13547    };
13548  }
13549
13550  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
13551    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
13552    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
13553    return res;
13554  }
13555
13556  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
13557    parseBackboneProperties(json, res);
13558    if (json.has("severity"))
13559      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
13560    if (json.has("_severity"))
13561      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
13562    if (json.has("code"))
13563      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
13564    if (json.has("_code"))
13565      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13566    if (json.has("details"))
13567      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
13568    if (json.has("diagnostics"))
13569      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
13570    if (json.has("_diagnostics"))
13571      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
13572    if (json.has("location")) {
13573      JsonArray array = json.getAsJsonArray("location");
13574      for (int i = 0; i < array.size(); i++) {
13575        res.getLocation().add(parseString(array.get(i).getAsString()));
13576      }
13577    };
13578    if (json.has("_location")) {
13579      JsonArray array = json.getAsJsonArray("_location");
13580      for (int i = 0; i < array.size(); i++) {
13581        if (i == res.getLocation().size())
13582          res.getLocation().add(parseString(null));
13583        if (array.get(i) instanceof JsonObject) 
13584          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
13585      }
13586    };
13587    if (json.has("expression")) {
13588      JsonArray array = json.getAsJsonArray("expression");
13589      for (int i = 0; i < array.size(); i++) {
13590        res.getExpression().add(parseString(array.get(i).getAsString()));
13591      }
13592    };
13593    if (json.has("_expression")) {
13594      JsonArray array = json.getAsJsonArray("_expression");
13595      for (int i = 0; i < array.size(); i++) {
13596        if (i == res.getExpression().size())
13597          res.getExpression().add(parseString(null));
13598        if (array.get(i) instanceof JsonObject) 
13599          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
13600      }
13601    };
13602  }
13603
13604  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
13605    Organization res = new Organization();
13606    parseOrganizationProperties(json, res);
13607    return res;
13608  }
13609
13610  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
13611    parseDomainResourceProperties(json, res);
13612    if (json.has("identifier")) {
13613      JsonArray array = json.getAsJsonArray("identifier");
13614      for (int i = 0; i < array.size(); i++) {
13615        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13616      }
13617    };
13618    if (json.has("active"))
13619      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13620    if (json.has("_active"))
13621      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13622    if (json.has("type")) {
13623      JsonArray array = json.getAsJsonArray("type");
13624      for (int i = 0; i < array.size(); i++) {
13625        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13626      }
13627    };
13628    if (json.has("name"))
13629      res.setNameElement(parseString(json.get("name").getAsString()));
13630    if (json.has("_name"))
13631      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13632    if (json.has("alias")) {
13633      JsonArray array = json.getAsJsonArray("alias");
13634      for (int i = 0; i < array.size(); i++) {
13635        res.getAlias().add(parseString(array.get(i).getAsString()));
13636      }
13637    };
13638    if (json.has("_alias")) {
13639      JsonArray array = json.getAsJsonArray("_alias");
13640      for (int i = 0; i < array.size(); i++) {
13641        if (i == res.getAlias().size())
13642          res.getAlias().add(parseString(null));
13643        if (array.get(i) instanceof JsonObject) 
13644          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
13645      }
13646    };
13647    if (json.has("telecom")) {
13648      JsonArray array = json.getAsJsonArray("telecom");
13649      for (int i = 0; i < array.size(); i++) {
13650        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13651      }
13652    };
13653    if (json.has("address")) {
13654      JsonArray array = json.getAsJsonArray("address");
13655      for (int i = 0; i < array.size(); i++) {
13656        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13657      }
13658    };
13659    if (json.has("partOf"))
13660      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
13661    if (json.has("contact")) {
13662      JsonArray array = json.getAsJsonArray("contact");
13663      for (int i = 0; i < array.size(); i++) {
13664        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
13665      }
13666    };
13667    if (json.has("endpoint")) {
13668      JsonArray array = json.getAsJsonArray("endpoint");
13669      for (int i = 0; i < array.size(); i++) {
13670        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13671      }
13672    };
13673  }
13674
13675  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
13676    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
13677    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
13678    return res;
13679  }
13680
13681  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
13682    parseBackboneProperties(json, res);
13683    if (json.has("purpose"))
13684      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
13685    if (json.has("name"))
13686      res.setName(parseHumanName(json.getAsJsonObject("name")));
13687    if (json.has("telecom")) {
13688      JsonArray array = json.getAsJsonArray("telecom");
13689      for (int i = 0; i < array.size(); i++) {
13690        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13691      }
13692    };
13693    if (json.has("address"))
13694      res.setAddress(parseAddress(json.getAsJsonObject("address")));
13695  }
13696
13697  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
13698    Patient res = new Patient();
13699    parsePatientProperties(json, res);
13700    return res;
13701  }
13702
13703  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
13704    parseDomainResourceProperties(json, res);
13705    if (json.has("identifier")) {
13706      JsonArray array = json.getAsJsonArray("identifier");
13707      for (int i = 0; i < array.size(); i++) {
13708        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13709      }
13710    };
13711    if (json.has("active"))
13712      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
13713    if (json.has("_active"))
13714      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
13715    if (json.has("name")) {
13716      JsonArray array = json.getAsJsonArray("name");
13717      for (int i = 0; i < array.size(); i++) {
13718        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
13719      }
13720    };
13721    if (json.has("telecom")) {
13722      JsonArray array = json.getAsJsonArray("telecom");
13723      for (int i = 0; i < array.size(); i++) {
13724        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13725      }
13726    };
13727    if (json.has("gender"))
13728      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13729    if (json.has("_gender"))
13730      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
13731    if (json.has("birthDate"))
13732      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
13733    if (json.has("_birthDate"))
13734      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
13735    Type deceased = parseType("deceased", json);
13736    if (deceased != null)
13737      res.setDeceased(deceased);
13738    if (json.has("address")) {
13739      JsonArray array = json.getAsJsonArray("address");
13740      for (int i = 0; i < array.size(); i++) {
13741        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
13742      }
13743    };
13744    if (json.has("maritalStatus"))
13745      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
13746    Type multipleBirth = parseType("multipleBirth", json);
13747    if (multipleBirth != null)
13748      res.setMultipleBirth(multipleBirth);
13749    if (json.has("photo")) {
13750      JsonArray array = json.getAsJsonArray("photo");
13751      for (int i = 0; i < array.size(); i++) {
13752        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
13753      }
13754    };
13755    if (json.has("contact")) {
13756      JsonArray array = json.getAsJsonArray("contact");
13757      for (int i = 0; i < array.size(); i++) {
13758        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
13759      }
13760    };
13761    if (json.has("animal"))
13762      res.setAnimal(parsePatientAnimalComponent(json.getAsJsonObject("animal"), res));
13763    if (json.has("communication")) {
13764      JsonArray array = json.getAsJsonArray("communication");
13765      for (int i = 0; i < array.size(); i++) {
13766        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
13767      }
13768    };
13769    if (json.has("generalPractitioner")) {
13770      JsonArray array = json.getAsJsonArray("generalPractitioner");
13771      for (int i = 0; i < array.size(); i++) {
13772        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
13773      }
13774    };
13775    if (json.has("managingOrganization"))
13776      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
13777    if (json.has("link")) {
13778      JsonArray array = json.getAsJsonArray("link");
13779      for (int i = 0; i < array.size(); i++) {
13780        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
13781      }
13782    };
13783  }
13784
13785  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13786    Patient.ContactComponent res = new Patient.ContactComponent();
13787    parsePatientContactComponentProperties(json, owner, res);
13788    return res;
13789  }
13790
13791  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
13792    parseBackboneProperties(json, res);
13793    if (json.has("relationship")) {
13794      JsonArray array = json.getAsJsonArray("relationship");
13795      for (int i = 0; i < array.size(); i++) {
13796        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13797      }
13798    };
13799    if (json.has("name"))
13800      res.setName(parseHumanName(json.getAsJsonObject("name")));
13801    if (json.has("telecom")) {
13802      JsonArray array = json.getAsJsonArray("telecom");
13803      for (int i = 0; i < array.size(); i++) {
13804        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13805      }
13806    };
13807    if (json.has("address"))
13808      res.setAddress(parseAddress(json.getAsJsonObject("address")));
13809    if (json.has("gender"))
13810      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
13811    if (json.has("_gender"))
13812      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
13813    if (json.has("organization"))
13814      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13815    if (json.has("period"))
13816      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13817  }
13818
13819  protected Patient.AnimalComponent parsePatientAnimalComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13820    Patient.AnimalComponent res = new Patient.AnimalComponent();
13821    parsePatientAnimalComponentProperties(json, owner, res);
13822    return res;
13823  }
13824
13825  protected void parsePatientAnimalComponentProperties(JsonObject json, Patient owner, Patient.AnimalComponent res) throws IOException, FHIRFormatError {
13826    parseBackboneProperties(json, res);
13827    if (json.has("species"))
13828      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
13829    if (json.has("breed"))
13830      res.setBreed(parseCodeableConcept(json.getAsJsonObject("breed")));
13831    if (json.has("genderStatus"))
13832      res.setGenderStatus(parseCodeableConcept(json.getAsJsonObject("genderStatus")));
13833  }
13834
13835  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13836    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
13837    parsePatientPatientCommunicationComponentProperties(json, owner, res);
13838    return res;
13839  }
13840
13841  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
13842    parseBackboneProperties(json, res);
13843    if (json.has("language"))
13844      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
13845    if (json.has("preferred"))
13846      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
13847    if (json.has("_preferred"))
13848      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
13849  }
13850
13851  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
13852    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
13853    parsePatientPatientLinkComponentProperties(json, owner, res);
13854    return res;
13855  }
13856
13857  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
13858    parseBackboneProperties(json, res);
13859    if (json.has("other"))
13860      res.setOther(parseReference(json.getAsJsonObject("other")));
13861    if (json.has("type"))
13862      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
13863    if (json.has("_type"))
13864      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13865  }
13866
13867  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
13868    PaymentNotice res = new PaymentNotice();
13869    parsePaymentNoticeProperties(json, res);
13870    return res;
13871  }
13872
13873  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
13874    parseDomainResourceProperties(json, res);
13875    if (json.has("identifier")) {
13876      JsonArray array = json.getAsJsonArray("identifier");
13877      for (int i = 0; i < array.size(); i++) {
13878        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13879      }
13880    };
13881    if (json.has("status"))
13882      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
13883    if (json.has("_status"))
13884      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13885    if (json.has("request"))
13886      res.setRequest(parseReference(json.getAsJsonObject("request")));
13887    if (json.has("response"))
13888      res.setResponse(parseReference(json.getAsJsonObject("response")));
13889    if (json.has("statusDate"))
13890      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
13891    if (json.has("_statusDate"))
13892      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
13893    if (json.has("created"))
13894      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13895    if (json.has("_created"))
13896      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
13897    if (json.has("target"))
13898      res.setTarget(parseReference(json.getAsJsonObject("target")));
13899    if (json.has("provider"))
13900      res.setProvider(parseReference(json.getAsJsonObject("provider")));
13901    if (json.has("organization"))
13902      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13903    if (json.has("paymentStatus"))
13904      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
13905  }
13906
13907  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
13908    PaymentReconciliation res = new PaymentReconciliation();
13909    parsePaymentReconciliationProperties(json, res);
13910    return res;
13911  }
13912
13913  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
13914    parseDomainResourceProperties(json, res);
13915    if (json.has("identifier")) {
13916      JsonArray array = json.getAsJsonArray("identifier");
13917      for (int i = 0; i < array.size(); i++) {
13918        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13919      }
13920    };
13921    if (json.has("status"))
13922      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
13923    if (json.has("_status"))
13924      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13925    if (json.has("period"))
13926      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13927    if (json.has("created"))
13928      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
13929    if (json.has("_created"))
13930      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
13931    if (json.has("organization"))
13932      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
13933    if (json.has("request"))
13934      res.setRequest(parseReference(json.getAsJsonObject("request")));
13935    if (json.has("outcome"))
13936      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
13937    if (json.has("disposition"))
13938      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
13939    if (json.has("_disposition"))
13940      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
13941    if (json.has("requestProvider"))
13942      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
13943    if (json.has("requestOrganization"))
13944      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
13945    if (json.has("detail")) {
13946      JsonArray array = json.getAsJsonArray("detail");
13947      for (int i = 0; i < array.size(); i++) {
13948        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
13949      }
13950    };
13951    if (json.has("form"))
13952      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
13953    if (json.has("total"))
13954      res.setTotal(parseMoney(json.getAsJsonObject("total")));
13955    if (json.has("processNote")) {
13956      JsonArray array = json.getAsJsonArray("processNote");
13957      for (int i = 0; i < array.size(); i++) {
13958        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
13959      }
13960    };
13961  }
13962
13963  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
13964    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
13965    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
13966    return res;
13967  }
13968
13969  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
13970    parseBackboneProperties(json, res);
13971    if (json.has("type"))
13972      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13973    if (json.has("request"))
13974      res.setRequest(parseReference(json.getAsJsonObject("request")));
13975    if (json.has("response"))
13976      res.setResponse(parseReference(json.getAsJsonObject("response")));
13977    if (json.has("submitter"))
13978      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
13979    if (json.has("payee"))
13980      res.setPayee(parseReference(json.getAsJsonObject("payee")));
13981    if (json.has("date"))
13982      res.setDateElement(parseDate(json.get("date").getAsString()));
13983    if (json.has("_date"))
13984      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13985    if (json.has("amount"))
13986      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13987  }
13988
13989  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
13990    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
13991    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
13992    return res;
13993  }
13994
13995  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
13996    parseBackboneProperties(json, res);
13997    if (json.has("type"))
13998      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13999    if (json.has("text"))
14000      res.setTextElement(parseString(json.get("text").getAsString()));
14001    if (json.has("_text"))
14002      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
14003  }
14004
14005  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
14006    Person res = new Person();
14007    parsePersonProperties(json, res);
14008    return res;
14009  }
14010
14011  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
14012    parseDomainResourceProperties(json, res);
14013    if (json.has("identifier")) {
14014      JsonArray array = json.getAsJsonArray("identifier");
14015      for (int i = 0; i < array.size(); i++) {
14016        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14017      }
14018    };
14019    if (json.has("name")) {
14020      JsonArray array = json.getAsJsonArray("name");
14021      for (int i = 0; i < array.size(); i++) {
14022        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14023      }
14024    };
14025    if (json.has("telecom")) {
14026      JsonArray array = json.getAsJsonArray("telecom");
14027      for (int i = 0; i < array.size(); i++) {
14028        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14029      }
14030    };
14031    if (json.has("gender"))
14032      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14033    if (json.has("_gender"))
14034      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
14035    if (json.has("birthDate"))
14036      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14037    if (json.has("_birthDate"))
14038      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
14039    if (json.has("address")) {
14040      JsonArray array = json.getAsJsonArray("address");
14041      for (int i = 0; i < array.size(); i++) {
14042        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14043      }
14044    };
14045    if (json.has("photo"))
14046      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
14047    if (json.has("managingOrganization"))
14048      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
14049    if (json.has("active"))
14050      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14051    if (json.has("_active"))
14052      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14053    if (json.has("link")) {
14054      JsonArray array = json.getAsJsonArray("link");
14055      for (int i = 0; i < array.size(); i++) {
14056        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
14057      }
14058    };
14059  }
14060
14061  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
14062    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
14063    parsePersonPersonLinkComponentProperties(json, owner, res);
14064    return res;
14065  }
14066
14067  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
14068    parseBackboneProperties(json, res);
14069    if (json.has("target"))
14070      res.setTarget(parseReference(json.getAsJsonObject("target")));
14071    if (json.has("assurance"))
14072      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
14073    if (json.has("_assurance"))
14074      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
14075  }
14076
14077  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
14078    PlanDefinition res = new PlanDefinition();
14079    parsePlanDefinitionProperties(json, res);
14080    return res;
14081  }
14082
14083  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
14084    parseDomainResourceProperties(json, res);
14085    if (json.has("url"))
14086      res.setUrlElement(parseUri(json.get("url").getAsString()));
14087    if (json.has("_url"))
14088      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14089    if (json.has("identifier")) {
14090      JsonArray array = json.getAsJsonArray("identifier");
14091      for (int i = 0; i < array.size(); i++) {
14092        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14093      }
14094    };
14095    if (json.has("version"))
14096      res.setVersionElement(parseString(json.get("version").getAsString()));
14097    if (json.has("_version"))
14098      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14099    if (json.has("name"))
14100      res.setNameElement(parseString(json.get("name").getAsString()));
14101    if (json.has("_name"))
14102      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14103    if (json.has("title"))
14104      res.setTitleElement(parseString(json.get("title").getAsString()));
14105    if (json.has("_title"))
14106      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14107    if (json.has("type"))
14108      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14109    if (json.has("status"))
14110      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14111    if (json.has("_status"))
14112      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14113    if (json.has("experimental"))
14114      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14115    if (json.has("_experimental"))
14116      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14117    if (json.has("date"))
14118      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14119    if (json.has("_date"))
14120      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14121    if (json.has("publisher"))
14122      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14123    if (json.has("_publisher"))
14124      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14125    if (json.has("description"))
14126      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14127    if (json.has("_description"))
14128      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14129    if (json.has("purpose"))
14130      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14131    if (json.has("_purpose"))
14132      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14133    if (json.has("usage"))
14134      res.setUsageElement(parseString(json.get("usage").getAsString()));
14135    if (json.has("_usage"))
14136      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14137    if (json.has("approvalDate"))
14138      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14139    if (json.has("_approvalDate"))
14140      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14141    if (json.has("lastReviewDate"))
14142      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14143    if (json.has("_lastReviewDate"))
14144      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14145    if (json.has("effectivePeriod"))
14146      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14147    if (json.has("useContext")) {
14148      JsonArray array = json.getAsJsonArray("useContext");
14149      for (int i = 0; i < array.size(); i++) {
14150        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14151      }
14152    };
14153    if (json.has("jurisdiction")) {
14154      JsonArray array = json.getAsJsonArray("jurisdiction");
14155      for (int i = 0; i < array.size(); i++) {
14156        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14157      }
14158    };
14159    if (json.has("topic")) {
14160      JsonArray array = json.getAsJsonArray("topic");
14161      for (int i = 0; i < array.size(); i++) {
14162        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14163      }
14164    };
14165    if (json.has("contributor")) {
14166      JsonArray array = json.getAsJsonArray("contributor");
14167      for (int i = 0; i < array.size(); i++) {
14168        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
14169      }
14170    };
14171    if (json.has("contact")) {
14172      JsonArray array = json.getAsJsonArray("contact");
14173      for (int i = 0; i < array.size(); i++) {
14174        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14175      }
14176    };
14177    if (json.has("copyright"))
14178      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14179    if (json.has("_copyright"))
14180      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14181    if (json.has("relatedArtifact")) {
14182      JsonArray array = json.getAsJsonArray("relatedArtifact");
14183      for (int i = 0; i < array.size(); i++) {
14184        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14185      }
14186    };
14187    if (json.has("library")) {
14188      JsonArray array = json.getAsJsonArray("library");
14189      for (int i = 0; i < array.size(); i++) {
14190        res.getLibrary().add(parseReference(array.get(i).getAsJsonObject()));
14191      }
14192    };
14193    if (json.has("goal")) {
14194      JsonArray array = json.getAsJsonArray("goal");
14195      for (int i = 0; i < array.size(); i++) {
14196        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
14197      }
14198    };
14199    if (json.has("action")) {
14200      JsonArray array = json.getAsJsonArray("action");
14201      for (int i = 0; i < array.size(); i++) {
14202        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
14203      }
14204    };
14205  }
14206
14207  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14208    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
14209    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
14210    return res;
14211  }
14212
14213  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
14214    parseBackboneProperties(json, res);
14215    if (json.has("category"))
14216      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14217    if (json.has("description"))
14218      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
14219    if (json.has("priority"))
14220      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
14221    if (json.has("start"))
14222      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
14223    if (json.has("addresses")) {
14224      JsonArray array = json.getAsJsonArray("addresses");
14225      for (int i = 0; i < array.size(); i++) {
14226        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14227      }
14228    };
14229    if (json.has("documentation")) {
14230      JsonArray array = json.getAsJsonArray("documentation");
14231      for (int i = 0; i < array.size(); i++) {
14232        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14233      }
14234    };
14235    if (json.has("target")) {
14236      JsonArray array = json.getAsJsonArray("target");
14237      for (int i = 0; i < array.size(); i++) {
14238        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
14239      }
14240    };
14241  }
14242
14243  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14244    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
14245    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
14246    return res;
14247  }
14248
14249  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
14250    parseBackboneProperties(json, res);
14251    if (json.has("measure"))
14252      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
14253    Type detail = parseType("detail", json);
14254    if (detail != null)
14255      res.setDetail(detail);
14256    if (json.has("due"))
14257      res.setDue(parseDuration(json.getAsJsonObject("due")));
14258  }
14259
14260  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14261    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
14262    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
14263    return res;
14264  }
14265
14266  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
14267    parseBackboneProperties(json, res);
14268    if (json.has("label"))
14269      res.setLabelElement(parseString(json.get("label").getAsString()));
14270    if (json.has("_label"))
14271      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
14272    if (json.has("title"))
14273      res.setTitleElement(parseString(json.get("title").getAsString()));
14274    if (json.has("_title"))
14275      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14276    if (json.has("description"))
14277      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14278    if (json.has("_description"))
14279      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14280    if (json.has("textEquivalent"))
14281      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
14282    if (json.has("_textEquivalent"))
14283      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
14284    if (json.has("code")) {
14285      JsonArray array = json.getAsJsonArray("code");
14286      for (int i = 0; i < array.size(); i++) {
14287        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14288      }
14289    };
14290    if (json.has("reason")) {
14291      JsonArray array = json.getAsJsonArray("reason");
14292      for (int i = 0; i < array.size(); i++) {
14293        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14294      }
14295    };
14296    if (json.has("documentation")) {
14297      JsonArray array = json.getAsJsonArray("documentation");
14298      for (int i = 0; i < array.size(); i++) {
14299        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14300      }
14301    };
14302    if (json.has("goalId")) {
14303      JsonArray array = json.getAsJsonArray("goalId");
14304      for (int i = 0; i < array.size(); i++) {
14305        res.getGoalId().add(parseId(array.get(i).getAsString()));
14306      }
14307    };
14308    if (json.has("_goalId")) {
14309      JsonArray array = json.getAsJsonArray("_goalId");
14310      for (int i = 0; i < array.size(); i++) {
14311        if (i == res.getGoalId().size())
14312          res.getGoalId().add(parseId(null));
14313        if (array.get(i) instanceof JsonObject) 
14314          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
14315      }
14316    };
14317    if (json.has("triggerDefinition")) {
14318      JsonArray array = json.getAsJsonArray("triggerDefinition");
14319      for (int i = 0; i < array.size(); i++) {
14320        res.getTriggerDefinition().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
14321      }
14322    };
14323    if (json.has("condition")) {
14324      JsonArray array = json.getAsJsonArray("condition");
14325      for (int i = 0; i < array.size(); i++) {
14326        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
14327      }
14328    };
14329    if (json.has("input")) {
14330      JsonArray array = json.getAsJsonArray("input");
14331      for (int i = 0; i < array.size(); i++) {
14332        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14333      }
14334    };
14335    if (json.has("output")) {
14336      JsonArray array = json.getAsJsonArray("output");
14337      for (int i = 0; i < array.size(); i++) {
14338        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14339      }
14340    };
14341    if (json.has("relatedAction")) {
14342      JsonArray array = json.getAsJsonArray("relatedAction");
14343      for (int i = 0; i < array.size(); i++) {
14344        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
14345      }
14346    };
14347    Type timing = parseType("timing", json);
14348    if (timing != null)
14349      res.setTiming(timing);
14350    if (json.has("participant")) {
14351      JsonArray array = json.getAsJsonArray("participant");
14352      for (int i = 0; i < array.size(); i++) {
14353        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
14354      }
14355    };
14356    if (json.has("type"))
14357      res.setType(parseCoding(json.getAsJsonObject("type")));
14358    if (json.has("groupingBehavior"))
14359      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
14360    if (json.has("_groupingBehavior"))
14361      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
14362    if (json.has("selectionBehavior"))
14363      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
14364    if (json.has("_selectionBehavior"))
14365      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
14366    if (json.has("requiredBehavior"))
14367      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
14368    if (json.has("_requiredBehavior"))
14369      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
14370    if (json.has("precheckBehavior"))
14371      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
14372    if (json.has("_precheckBehavior"))
14373      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
14374    if (json.has("cardinalityBehavior"))
14375      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
14376    if (json.has("_cardinalityBehavior"))
14377      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
14378    if (json.has("definition"))
14379      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
14380    if (json.has("transform"))
14381      res.setTransform(parseReference(json.getAsJsonObject("transform")));
14382    if (json.has("dynamicValue")) {
14383      JsonArray array = json.getAsJsonArray("dynamicValue");
14384      for (int i = 0; i < array.size(); i++) {
14385        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
14386      }
14387    };
14388    if (json.has("action")) {
14389      JsonArray array = json.getAsJsonArray("action");
14390      for (int i = 0; i < array.size(); i++) {
14391        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
14392      }
14393    };
14394  }
14395
14396  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14397    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
14398    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
14399    return res;
14400  }
14401
14402  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
14403    parseBackboneProperties(json, res);
14404    if (json.has("kind"))
14405      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
14406    if (json.has("_kind"))
14407      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
14408    if (json.has("description"))
14409      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14410    if (json.has("_description"))
14411      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14412    if (json.has("language"))
14413      res.setLanguageElement(parseString(json.get("language").getAsString()));
14414    if (json.has("_language"))
14415      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
14416    if (json.has("expression"))
14417      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14418    if (json.has("_expression"))
14419      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
14420  }
14421
14422  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14423    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
14424    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
14425    return res;
14426  }
14427
14428  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
14429    parseBackboneProperties(json, res);
14430    if (json.has("actionId"))
14431      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
14432    if (json.has("_actionId"))
14433      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
14434    if (json.has("relationship"))
14435      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
14436    if (json.has("_relationship"))
14437      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
14438    Type offset = parseType("offset", json);
14439    if (offset != null)
14440      res.setOffset(offset);
14441  }
14442
14443  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14444    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
14445    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
14446    return res;
14447  }
14448
14449  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
14450    parseBackboneProperties(json, res);
14451    if (json.has("type"))
14452      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
14453    if (json.has("_type"))
14454      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14455    if (json.has("role"))
14456      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14457  }
14458
14459  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
14460    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
14461    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
14462    return res;
14463  }
14464
14465  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
14466    parseBackboneProperties(json, res);
14467    if (json.has("description"))
14468      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14469    if (json.has("_description"))
14470      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14471    if (json.has("path"))
14472      res.setPathElement(parseString(json.get("path").getAsString()));
14473    if (json.has("_path"))
14474      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
14475    if (json.has("language"))
14476      res.setLanguageElement(parseString(json.get("language").getAsString()));
14477    if (json.has("_language"))
14478      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
14479    if (json.has("expression"))
14480      res.setExpressionElement(parseString(json.get("expression").getAsString()));
14481    if (json.has("_expression"))
14482      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
14483  }
14484
14485  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
14486    Practitioner res = new Practitioner();
14487    parsePractitionerProperties(json, res);
14488    return res;
14489  }
14490
14491  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
14492    parseDomainResourceProperties(json, res);
14493    if (json.has("identifier")) {
14494      JsonArray array = json.getAsJsonArray("identifier");
14495      for (int i = 0; i < array.size(); i++) {
14496        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14497      }
14498    };
14499    if (json.has("active"))
14500      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14501    if (json.has("_active"))
14502      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14503    if (json.has("name")) {
14504      JsonArray array = json.getAsJsonArray("name");
14505      for (int i = 0; i < array.size(); i++) {
14506        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
14507      }
14508    };
14509    if (json.has("telecom")) {
14510      JsonArray array = json.getAsJsonArray("telecom");
14511      for (int i = 0; i < array.size(); i++) {
14512        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14513      }
14514    };
14515    if (json.has("address")) {
14516      JsonArray array = json.getAsJsonArray("address");
14517      for (int i = 0; i < array.size(); i++) {
14518        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
14519      }
14520    };
14521    if (json.has("gender"))
14522      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
14523    if (json.has("_gender"))
14524      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
14525    if (json.has("birthDate"))
14526      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
14527    if (json.has("_birthDate"))
14528      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
14529    if (json.has("photo")) {
14530      JsonArray array = json.getAsJsonArray("photo");
14531      for (int i = 0; i < array.size(); i++) {
14532        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
14533      }
14534    };
14535    if (json.has("qualification")) {
14536      JsonArray array = json.getAsJsonArray("qualification");
14537      for (int i = 0; i < array.size(); i++) {
14538        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
14539      }
14540    };
14541    if (json.has("communication")) {
14542      JsonArray array = json.getAsJsonArray("communication");
14543      for (int i = 0; i < array.size(); i++) {
14544        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14545      }
14546    };
14547  }
14548
14549  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
14550    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
14551    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
14552    return res;
14553  }
14554
14555  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
14556    parseBackboneProperties(json, res);
14557    if (json.has("identifier")) {
14558      JsonArray array = json.getAsJsonArray("identifier");
14559      for (int i = 0; i < array.size(); i++) {
14560        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14561      }
14562    };
14563    if (json.has("code"))
14564      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14565    if (json.has("period"))
14566      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14567    if (json.has("issuer"))
14568      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
14569  }
14570
14571  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
14572    PractitionerRole res = new PractitionerRole();
14573    parsePractitionerRoleProperties(json, res);
14574    return res;
14575  }
14576
14577  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
14578    parseDomainResourceProperties(json, res);
14579    if (json.has("identifier")) {
14580      JsonArray array = json.getAsJsonArray("identifier");
14581      for (int i = 0; i < array.size(); i++) {
14582        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14583      }
14584    };
14585    if (json.has("active"))
14586      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14587    if (json.has("_active"))
14588      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14589    if (json.has("period"))
14590      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14591    if (json.has("practitioner"))
14592      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
14593    if (json.has("organization"))
14594      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
14595    if (json.has("code")) {
14596      JsonArray array = json.getAsJsonArray("code");
14597      for (int i = 0; i < array.size(); i++) {
14598        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14599      }
14600    };
14601    if (json.has("specialty")) {
14602      JsonArray array = json.getAsJsonArray("specialty");
14603      for (int i = 0; i < array.size(); i++) {
14604        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14605      }
14606    };
14607    if (json.has("location")) {
14608      JsonArray array = json.getAsJsonArray("location");
14609      for (int i = 0; i < array.size(); i++) {
14610        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
14611      }
14612    };
14613    if (json.has("healthcareService")) {
14614      JsonArray array = json.getAsJsonArray("healthcareService");
14615      for (int i = 0; i < array.size(); i++) {
14616        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
14617      }
14618    };
14619    if (json.has("telecom")) {
14620      JsonArray array = json.getAsJsonArray("telecom");
14621      for (int i = 0; i < array.size(); i++) {
14622        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14623      }
14624    };
14625    if (json.has("availableTime")) {
14626      JsonArray array = json.getAsJsonArray("availableTime");
14627      for (int i = 0; i < array.size(); i++) {
14628        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
14629      }
14630    };
14631    if (json.has("notAvailable")) {
14632      JsonArray array = json.getAsJsonArray("notAvailable");
14633      for (int i = 0; i < array.size(); i++) {
14634        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
14635      }
14636    };
14637    if (json.has("availabilityExceptions"))
14638      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14639    if (json.has("_availabilityExceptions"))
14640      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14641    if (json.has("endpoint")) {
14642      JsonArray array = json.getAsJsonArray("endpoint");
14643      for (int i = 0; i < array.size(); i++) {
14644        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14645      }
14646    };
14647  }
14648
14649  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14650    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
14651    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
14652    return res;
14653  }
14654
14655  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
14656    parseBackboneProperties(json, res);
14657    if (json.has("daysOfWeek")) {
14658      JsonArray array = json.getAsJsonArray("daysOfWeek");
14659      for (int i = 0; i < array.size(); i++) {
14660        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14661      }
14662    };
14663    if (json.has("_daysOfWeek")) {
14664      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14665      for (int i = 0; i < array.size(); i++) {
14666        if (i == res.getDaysOfWeek().size())
14667          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
14668        if (array.get(i) instanceof JsonObject) 
14669          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14670      }
14671    };
14672    if (json.has("allDay"))
14673      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14674    if (json.has("_allDay"))
14675      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
14676    if (json.has("availableStartTime"))
14677      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
14678    if (json.has("_availableStartTime"))
14679      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
14680    if (json.has("availableEndTime"))
14681      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
14682    if (json.has("_availableEndTime"))
14683      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
14684  }
14685
14686  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
14687    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
14688    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
14689    return res;
14690  }
14691
14692  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
14693    parseBackboneProperties(json, res);
14694    if (json.has("description"))
14695      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14696    if (json.has("_description"))
14697      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14698    if (json.has("during"))
14699      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
14700  }
14701
14702  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
14703    Procedure res = new Procedure();
14704    parseProcedureProperties(json, res);
14705    return res;
14706  }
14707
14708  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
14709    parseDomainResourceProperties(json, res);
14710    if (json.has("identifier")) {
14711      JsonArray array = json.getAsJsonArray("identifier");
14712      for (int i = 0; i < array.size(); i++) {
14713        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14714      }
14715    };
14716    if (json.has("definition")) {
14717      JsonArray array = json.getAsJsonArray("definition");
14718      for (int i = 0; i < array.size(); i++) {
14719        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
14720      }
14721    };
14722    if (json.has("basedOn")) {
14723      JsonArray array = json.getAsJsonArray("basedOn");
14724      for (int i = 0; i < array.size(); i++) {
14725        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14726      }
14727    };
14728    if (json.has("partOf")) {
14729      JsonArray array = json.getAsJsonArray("partOf");
14730      for (int i = 0; i < array.size(); i++) {
14731        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
14732      }
14733    };
14734    if (json.has("status"))
14735      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
14736    if (json.has("_status"))
14737      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14738    if (json.has("notDone"))
14739      res.setNotDoneElement(parseBoolean(json.get("notDone").getAsBoolean()));
14740    if (json.has("_notDone"))
14741      parseElementProperties(json.getAsJsonObject("_notDone"), res.getNotDoneElement());
14742    if (json.has("notDoneReason"))
14743      res.setNotDoneReason(parseCodeableConcept(json.getAsJsonObject("notDoneReason")));
14744    if (json.has("category"))
14745      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
14746    if (json.has("code"))
14747      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14748    if (json.has("subject"))
14749      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14750    if (json.has("context"))
14751      res.setContext(parseReference(json.getAsJsonObject("context")));
14752    Type performed = parseType("performed", json);
14753    if (performed != null)
14754      res.setPerformed(performed);
14755    if (json.has("performer")) {
14756      JsonArray array = json.getAsJsonArray("performer");
14757      for (int i = 0; i < array.size(); i++) {
14758        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
14759      }
14760    };
14761    if (json.has("location"))
14762      res.setLocation(parseReference(json.getAsJsonObject("location")));
14763    if (json.has("reasonCode")) {
14764      JsonArray array = json.getAsJsonArray("reasonCode");
14765      for (int i = 0; i < array.size(); i++) {
14766        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14767      }
14768    };
14769    if (json.has("reasonReference")) {
14770      JsonArray array = json.getAsJsonArray("reasonReference");
14771      for (int i = 0; i < array.size(); i++) {
14772        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14773      }
14774    };
14775    if (json.has("bodySite")) {
14776      JsonArray array = json.getAsJsonArray("bodySite");
14777      for (int i = 0; i < array.size(); i++) {
14778        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14779      }
14780    };
14781    if (json.has("outcome"))
14782      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
14783    if (json.has("report")) {
14784      JsonArray array = json.getAsJsonArray("report");
14785      for (int i = 0; i < array.size(); i++) {
14786        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
14787      }
14788    };
14789    if (json.has("complication")) {
14790      JsonArray array = json.getAsJsonArray("complication");
14791      for (int i = 0; i < array.size(); i++) {
14792        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14793      }
14794    };
14795    if (json.has("complicationDetail")) {
14796      JsonArray array = json.getAsJsonArray("complicationDetail");
14797      for (int i = 0; i < array.size(); i++) {
14798        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
14799      }
14800    };
14801    if (json.has("followUp")) {
14802      JsonArray array = json.getAsJsonArray("followUp");
14803      for (int i = 0; i < array.size(); i++) {
14804        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14805      }
14806    };
14807    if (json.has("note")) {
14808      JsonArray array = json.getAsJsonArray("note");
14809      for (int i = 0; i < array.size(); i++) {
14810        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14811      }
14812    };
14813    if (json.has("focalDevice")) {
14814      JsonArray array = json.getAsJsonArray("focalDevice");
14815      for (int i = 0; i < array.size(); i++) {
14816        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
14817      }
14818    };
14819    if (json.has("usedReference")) {
14820      JsonArray array = json.getAsJsonArray("usedReference");
14821      for (int i = 0; i < array.size(); i++) {
14822        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
14823      }
14824    };
14825    if (json.has("usedCode")) {
14826      JsonArray array = json.getAsJsonArray("usedCode");
14827      for (int i = 0; i < array.size(); i++) {
14828        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14829      }
14830    };
14831  }
14832
14833  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
14834    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
14835    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
14836    return res;
14837  }
14838
14839  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
14840    parseBackboneProperties(json, res);
14841    if (json.has("role"))
14842      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
14843    if (json.has("actor"))
14844      res.setActor(parseReference(json.getAsJsonObject("actor")));
14845    if (json.has("onBehalfOf"))
14846      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
14847  }
14848
14849  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
14850    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
14851    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
14852    return res;
14853  }
14854
14855  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
14856    parseBackboneProperties(json, res);
14857    if (json.has("action"))
14858      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
14859    if (json.has("manipulated"))
14860      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
14861  }
14862
14863  protected ProcedureRequest parseProcedureRequest(JsonObject json) throws IOException, FHIRFormatError {
14864    ProcedureRequest res = new ProcedureRequest();
14865    parseProcedureRequestProperties(json, res);
14866    return res;
14867  }
14868
14869  protected void parseProcedureRequestProperties(JsonObject json, ProcedureRequest res) throws IOException, FHIRFormatError {
14870    parseDomainResourceProperties(json, res);
14871    if (json.has("identifier")) {
14872      JsonArray array = json.getAsJsonArray("identifier");
14873      for (int i = 0; i < array.size(); i++) {
14874        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14875      }
14876    };
14877    if (json.has("definition")) {
14878      JsonArray array = json.getAsJsonArray("definition");
14879      for (int i = 0; i < array.size(); i++) {
14880        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
14881      }
14882    };
14883    if (json.has("basedOn")) {
14884      JsonArray array = json.getAsJsonArray("basedOn");
14885      for (int i = 0; i < array.size(); i++) {
14886        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14887      }
14888    };
14889    if (json.has("replaces")) {
14890      JsonArray array = json.getAsJsonArray("replaces");
14891      for (int i = 0; i < array.size(); i++) {
14892        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
14893      }
14894    };
14895    if (json.has("requisition"))
14896      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
14897    if (json.has("status"))
14898      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcedureRequest.ProcedureRequestStatus.NULL, new ProcedureRequest.ProcedureRequestStatusEnumFactory()));
14899    if (json.has("_status"))
14900      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14901    if (json.has("intent"))
14902      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ProcedureRequest.ProcedureRequestIntent.NULL, new ProcedureRequest.ProcedureRequestIntentEnumFactory()));
14903    if (json.has("_intent"))
14904      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
14905    if (json.has("priority"))
14906      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ProcedureRequest.ProcedureRequestPriority.NULL, new ProcedureRequest.ProcedureRequestPriorityEnumFactory()));
14907    if (json.has("_priority"))
14908      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
14909    if (json.has("doNotPerform"))
14910      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
14911    if (json.has("_doNotPerform"))
14912      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
14913    if (json.has("category")) {
14914      JsonArray array = json.getAsJsonArray("category");
14915      for (int i = 0; i < array.size(); i++) {
14916        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14917      }
14918    };
14919    if (json.has("code"))
14920      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14921    if (json.has("subject"))
14922      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14923    if (json.has("context"))
14924      res.setContext(parseReference(json.getAsJsonObject("context")));
14925    Type occurrence = parseType("occurrence", json);
14926    if (occurrence != null)
14927      res.setOccurrence(occurrence);
14928    Type asNeeded = parseType("asNeeded", json);
14929    if (asNeeded != null)
14930      res.setAsNeeded(asNeeded);
14931    if (json.has("authoredOn"))
14932      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
14933    if (json.has("_authoredOn"))
14934      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
14935    if (json.has("requester"))
14936      res.setRequester(parseProcedureRequestProcedureRequestRequesterComponent(json.getAsJsonObject("requester"), res));
14937    if (json.has("performerType"))
14938      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
14939    if (json.has("performer"))
14940      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
14941    if (json.has("reasonCode")) {
14942      JsonArray array = json.getAsJsonArray("reasonCode");
14943      for (int i = 0; i < array.size(); i++) {
14944        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14945      }
14946    };
14947    if (json.has("reasonReference")) {
14948      JsonArray array = json.getAsJsonArray("reasonReference");
14949      for (int i = 0; i < array.size(); i++) {
14950        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
14951      }
14952    };
14953    if (json.has("supportingInfo")) {
14954      JsonArray array = json.getAsJsonArray("supportingInfo");
14955      for (int i = 0; i < array.size(); i++) {
14956        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
14957      }
14958    };
14959    if (json.has("specimen")) {
14960      JsonArray array = json.getAsJsonArray("specimen");
14961      for (int i = 0; i < array.size(); i++) {
14962        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
14963      }
14964    };
14965    if (json.has("bodySite")) {
14966      JsonArray array = json.getAsJsonArray("bodySite");
14967      for (int i = 0; i < array.size(); i++) {
14968        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14969      }
14970    };
14971    if (json.has("note")) {
14972      JsonArray array = json.getAsJsonArray("note");
14973      for (int i = 0; i < array.size(); i++) {
14974        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14975      }
14976    };
14977    if (json.has("relevantHistory")) {
14978      JsonArray array = json.getAsJsonArray("relevantHistory");
14979      for (int i = 0; i < array.size(); i++) {
14980        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
14981      }
14982    };
14983  }
14984
14985  protected ProcedureRequest.ProcedureRequestRequesterComponent parseProcedureRequestProcedureRequestRequesterComponent(JsonObject json, ProcedureRequest owner) throws IOException, FHIRFormatError {
14986    ProcedureRequest.ProcedureRequestRequesterComponent res = new ProcedureRequest.ProcedureRequestRequesterComponent();
14987    parseProcedureRequestProcedureRequestRequesterComponentProperties(json, owner, res);
14988    return res;
14989  }
14990
14991  protected void parseProcedureRequestProcedureRequestRequesterComponentProperties(JsonObject json, ProcedureRequest owner, ProcedureRequest.ProcedureRequestRequesterComponent res) throws IOException, FHIRFormatError {
14992    parseBackboneProperties(json, res);
14993    if (json.has("agent"))
14994      res.setAgent(parseReference(json.getAsJsonObject("agent")));
14995    if (json.has("onBehalfOf"))
14996      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
14997  }
14998
14999  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
15000    ProcessRequest res = new ProcessRequest();
15001    parseProcessRequestProperties(json, res);
15002    return res;
15003  }
15004
15005  protected void parseProcessRequestProperties(JsonObject json, ProcessRequest res) throws IOException, FHIRFormatError {
15006    parseDomainResourceProperties(json, res);
15007    if (json.has("identifier")) {
15008      JsonArray array = json.getAsJsonArray("identifier");
15009      for (int i = 0; i < array.size(); i++) {
15010        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15011      }
15012    };
15013    if (json.has("status"))
15014      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
15015    if (json.has("_status"))
15016      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15017    if (json.has("action"))
15018      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
15019    if (json.has("_action"))
15020      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
15021    if (json.has("target"))
15022      res.setTarget(parseReference(json.getAsJsonObject("target")));
15023    if (json.has("created"))
15024      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15025    if (json.has("_created"))
15026      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
15027    if (json.has("provider"))
15028      res.setProvider(parseReference(json.getAsJsonObject("provider")));
15029    if (json.has("organization"))
15030      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
15031    if (json.has("request"))
15032      res.setRequest(parseReference(json.getAsJsonObject("request")));
15033    if (json.has("response"))
15034      res.setResponse(parseReference(json.getAsJsonObject("response")));
15035    if (json.has("nullify"))
15036      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
15037    if (json.has("_nullify"))
15038      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
15039    if (json.has("reference"))
15040      res.setReferenceElement(parseString(json.get("reference").getAsString()));
15041    if (json.has("_reference"))
15042      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
15043    if (json.has("item")) {
15044      JsonArray array = json.getAsJsonArray("item");
15045      for (int i = 0; i < array.size(); i++) {
15046        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
15047      }
15048    };
15049    if (json.has("include")) {
15050      JsonArray array = json.getAsJsonArray("include");
15051      for (int i = 0; i < array.size(); i++) {
15052        res.getInclude().add(parseString(array.get(i).getAsString()));
15053      }
15054    };
15055    if (json.has("_include")) {
15056      JsonArray array = json.getAsJsonArray("_include");
15057      for (int i = 0; i < array.size(); i++) {
15058        if (i == res.getInclude().size())
15059          res.getInclude().add(parseString(null));
15060        if (array.get(i) instanceof JsonObject) 
15061          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
15062      }
15063    };
15064    if (json.has("exclude")) {
15065      JsonArray array = json.getAsJsonArray("exclude");
15066      for (int i = 0; i < array.size(); i++) {
15067        res.getExclude().add(parseString(array.get(i).getAsString()));
15068      }
15069    };
15070    if (json.has("_exclude")) {
15071      JsonArray array = json.getAsJsonArray("_exclude");
15072      for (int i = 0; i < array.size(); i++) {
15073        if (i == res.getExclude().size())
15074          res.getExclude().add(parseString(null));
15075        if (array.get(i) instanceof JsonObject) 
15076          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
15077      }
15078    };
15079    if (json.has("period"))
15080      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15081  }
15082
15083  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
15084    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
15085    parseProcessRequestItemsComponentProperties(json, owner, res);
15086    return res;
15087  }
15088
15089  protected void parseProcessRequestItemsComponentProperties(JsonObject json, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws IOException, FHIRFormatError {
15090    parseBackboneProperties(json, res);
15091    if (json.has("sequenceLinkId"))
15092      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
15093    if (json.has("_sequenceLinkId"))
15094      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
15095  }
15096
15097  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
15098    ProcessResponse res = new ProcessResponse();
15099    parseProcessResponseProperties(json, res);
15100    return res;
15101  }
15102
15103  protected void parseProcessResponseProperties(JsonObject json, ProcessResponse res) throws IOException, FHIRFormatError {
15104    parseDomainResourceProperties(json, res);
15105    if (json.has("identifier")) {
15106      JsonArray array = json.getAsJsonArray("identifier");
15107      for (int i = 0; i < array.size(); i++) {
15108        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15109      }
15110    };
15111    if (json.has("status"))
15112      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
15113    if (json.has("_status"))
15114      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15115    if (json.has("created"))
15116      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
15117    if (json.has("_created"))
15118      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
15119    if (json.has("organization"))
15120      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
15121    if (json.has("request"))
15122      res.setRequest(parseReference(json.getAsJsonObject("request")));
15123    if (json.has("outcome"))
15124      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
15125    if (json.has("disposition"))
15126      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
15127    if (json.has("_disposition"))
15128      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
15129    if (json.has("requestProvider"))
15130      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
15131    if (json.has("requestOrganization"))
15132      res.setRequestOrganization(parseReference(json.getAsJsonObject("requestOrganization")));
15133    if (json.has("form"))
15134      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
15135    if (json.has("processNote")) {
15136      JsonArray array = json.getAsJsonArray("processNote");
15137      for (int i = 0; i < array.size(); i++) {
15138        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(array.get(i).getAsJsonObject(), res));
15139      }
15140    };
15141    if (json.has("error")) {
15142      JsonArray array = json.getAsJsonArray("error");
15143      for (int i = 0; i < array.size(); i++) {
15144        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15145      }
15146    };
15147    if (json.has("communicationRequest")) {
15148      JsonArray array = json.getAsJsonArray("communicationRequest");
15149      for (int i = 0; i < array.size(); i++) {
15150        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
15151      }
15152    };
15153  }
15154
15155  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
15156    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
15157    parseProcessResponseProcessResponseProcessNoteComponentProperties(json, owner, res);
15158    return res;
15159  }
15160
15161  protected void parseProcessResponseProcessResponseProcessNoteComponentProperties(JsonObject json, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws IOException, FHIRFormatError {
15162    parseBackboneProperties(json, res);
15163    if (json.has("type"))
15164      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15165    if (json.has("text"))
15166      res.setTextElement(parseString(json.get("text").getAsString()));
15167    if (json.has("_text"))
15168      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15169  }
15170
15171  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
15172    Provenance res = new Provenance();
15173    parseProvenanceProperties(json, res);
15174    return res;
15175  }
15176
15177  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
15178    parseDomainResourceProperties(json, res);
15179    if (json.has("target")) {
15180      JsonArray array = json.getAsJsonArray("target");
15181      for (int i = 0; i < array.size(); i++) {
15182        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
15183      }
15184    };
15185    if (json.has("period"))
15186      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15187    if (json.has("recorded"))
15188      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
15189    if (json.has("_recorded"))
15190      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
15191    if (json.has("policy")) {
15192      JsonArray array = json.getAsJsonArray("policy");
15193      for (int i = 0; i < array.size(); i++) {
15194        res.getPolicy().add(parseUri(array.get(i).getAsString()));
15195      }
15196    };
15197    if (json.has("_policy")) {
15198      JsonArray array = json.getAsJsonArray("_policy");
15199      for (int i = 0; i < array.size(); i++) {
15200        if (i == res.getPolicy().size())
15201          res.getPolicy().add(parseUri(null));
15202        if (array.get(i) instanceof JsonObject) 
15203          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
15204      }
15205    };
15206    if (json.has("location"))
15207      res.setLocation(parseReference(json.getAsJsonObject("location")));
15208    if (json.has("reason")) {
15209      JsonArray array = json.getAsJsonArray("reason");
15210      for (int i = 0; i < array.size(); i++) {
15211        res.getReason().add(parseCoding(array.get(i).getAsJsonObject()));
15212      }
15213    };
15214    if (json.has("activity"))
15215      res.setActivity(parseCoding(json.getAsJsonObject("activity")));
15216    if (json.has("agent")) {
15217      JsonArray array = json.getAsJsonArray("agent");
15218      for (int i = 0; i < array.size(); i++) {
15219        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
15220      }
15221    };
15222    if (json.has("entity")) {
15223      JsonArray array = json.getAsJsonArray("entity");
15224      for (int i = 0; i < array.size(); i++) {
15225        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
15226      }
15227    };
15228    if (json.has("signature")) {
15229      JsonArray array = json.getAsJsonArray("signature");
15230      for (int i = 0; i < array.size(); i++) {
15231        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
15232      }
15233    };
15234  }
15235
15236  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15237    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
15238    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
15239    return res;
15240  }
15241
15242  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
15243    parseBackboneProperties(json, res);
15244    if (json.has("role")) {
15245      JsonArray array = json.getAsJsonArray("role");
15246      for (int i = 0; i < array.size(); i++) {
15247        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15248      }
15249    };
15250    Type who = parseType("who", json);
15251    if (who != null)
15252      res.setWho(who);
15253    Type onBehalfOf = parseType("onBehalfOf", json);
15254    if (onBehalfOf != null)
15255      res.setOnBehalfOf(onBehalfOf);
15256    if (json.has("relatedAgentType"))
15257      res.setRelatedAgentType(parseCodeableConcept(json.getAsJsonObject("relatedAgentType")));
15258  }
15259
15260  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
15261    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
15262    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
15263    return res;
15264  }
15265
15266  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
15267    parseBackboneProperties(json, res);
15268    if (json.has("role"))
15269      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
15270    if (json.has("_role"))
15271      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
15272    Type what = parseType("what", json);
15273    if (what != null)
15274      res.setWhat(what);
15275    if (json.has("agent")) {
15276      JsonArray array = json.getAsJsonArray("agent");
15277      for (int i = 0; i < array.size(); i++) {
15278        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
15279      }
15280    };
15281  }
15282
15283  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
15284    Questionnaire res = new Questionnaire();
15285    parseQuestionnaireProperties(json, res);
15286    return res;
15287  }
15288
15289  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
15290    parseDomainResourceProperties(json, res);
15291    if (json.has("url"))
15292      res.setUrlElement(parseUri(json.get("url").getAsString()));
15293    if (json.has("_url"))
15294      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
15295    if (json.has("identifier")) {
15296      JsonArray array = json.getAsJsonArray("identifier");
15297      for (int i = 0; i < array.size(); i++) {
15298        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15299      }
15300    };
15301    if (json.has("version"))
15302      res.setVersionElement(parseString(json.get("version").getAsString()));
15303    if (json.has("_version"))
15304      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
15305    if (json.has("name"))
15306      res.setNameElement(parseString(json.get("name").getAsString()));
15307    if (json.has("_name"))
15308      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15309    if (json.has("title"))
15310      res.setTitleElement(parseString(json.get("title").getAsString()));
15311    if (json.has("_title"))
15312      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15313    if (json.has("status"))
15314      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
15315    if (json.has("_status"))
15316      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15317    if (json.has("experimental"))
15318      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
15319    if (json.has("_experimental"))
15320      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
15321    if (json.has("date"))
15322      res.setDateElement(parseDateTime(json.get("date").getAsString()));
15323    if (json.has("_date"))
15324      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
15325    if (json.has("publisher"))
15326      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
15327    if (json.has("_publisher"))
15328      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
15329    if (json.has("description"))
15330      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
15331    if (json.has("_description"))
15332      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15333    if (json.has("purpose"))
15334      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
15335    if (json.has("_purpose"))
15336      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
15337    if (json.has("approvalDate"))
15338      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
15339    if (json.has("_approvalDate"))
15340      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
15341    if (json.has("lastReviewDate"))
15342      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
15343    if (json.has("_lastReviewDate"))
15344      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
15345    if (json.has("effectivePeriod"))
15346      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
15347    if (json.has("useContext")) {
15348      JsonArray array = json.getAsJsonArray("useContext");
15349      for (int i = 0; i < array.size(); i++) {
15350        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
15351      }
15352    };
15353    if (json.has("jurisdiction")) {
15354      JsonArray array = json.getAsJsonArray("jurisdiction");
15355      for (int i = 0; i < array.size(); i++) {
15356        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15357      }
15358    };
15359    if (json.has("contact")) {
15360      JsonArray array = json.getAsJsonArray("contact");
15361      for (int i = 0; i < array.size(); i++) {
15362        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
15363      }
15364    };
15365    if (json.has("copyright"))
15366      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
15367    if (json.has("_copyright"))
15368      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
15369    if (json.has("code")) {
15370      JsonArray array = json.getAsJsonArray("code");
15371      for (int i = 0; i < array.size(); i++) {
15372        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15373      }
15374    };
15375    if (json.has("subjectType")) {
15376      JsonArray array = json.getAsJsonArray("subjectType");
15377      for (int i = 0; i < array.size(); i++) {
15378        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
15379      }
15380    };
15381    if (json.has("_subjectType")) {
15382      JsonArray array = json.getAsJsonArray("_subjectType");
15383      for (int i = 0; i < array.size(); i++) {
15384        if (i == res.getSubjectType().size())
15385          res.getSubjectType().add(parseCode(null));
15386        if (array.get(i) instanceof JsonObject) 
15387          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
15388      }
15389    };
15390    if (json.has("item")) {
15391      JsonArray array = json.getAsJsonArray("item");
15392      for (int i = 0; i < array.size(); i++) {
15393        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
15394      }
15395    };
15396  }
15397
15398  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15399    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
15400    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
15401    return res;
15402  }
15403
15404  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
15405    parseBackboneProperties(json, res);
15406    if (json.has("linkId"))
15407      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15408    if (json.has("_linkId"))
15409      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
15410    if (json.has("definition"))
15411      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15412    if (json.has("_definition"))
15413      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
15414    if (json.has("code")) {
15415      JsonArray array = json.getAsJsonArray("code");
15416      for (int i = 0; i < array.size(); i++) {
15417        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
15418      }
15419    };
15420    if (json.has("prefix"))
15421      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
15422    if (json.has("_prefix"))
15423      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
15424    if (json.has("text"))
15425      res.setTextElement(parseString(json.get("text").getAsString()));
15426    if (json.has("_text"))
15427      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15428    if (json.has("type"))
15429      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
15430    if (json.has("_type"))
15431      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
15432    if (json.has("enableWhen")) {
15433      JsonArray array = json.getAsJsonArray("enableWhen");
15434      for (int i = 0; i < array.size(); i++) {
15435        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
15436      }
15437    };
15438    if (json.has("required"))
15439      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
15440    if (json.has("_required"))
15441      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
15442    if (json.has("repeats"))
15443      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
15444    if (json.has("_repeats"))
15445      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
15446    if (json.has("readOnly"))
15447      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
15448    if (json.has("_readOnly"))
15449      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
15450    if (json.has("maxLength"))
15451      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
15452    if (json.has("_maxLength"))
15453      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
15454    if (json.has("options"))
15455      res.setOptions(parseReference(json.getAsJsonObject("options")));
15456    if (json.has("option")) {
15457      JsonArray array = json.getAsJsonArray("option");
15458      for (int i = 0; i < array.size(); i++) {
15459        res.getOption().add(parseQuestionnaireQuestionnaireItemOptionComponent(array.get(i).getAsJsonObject(), owner));
15460      }
15461    };
15462    Type initial = parseType("initial", json);
15463    if (initial != null)
15464      res.setInitial(initial);
15465    if (json.has("item")) {
15466      JsonArray array = json.getAsJsonArray("item");
15467      for (int i = 0; i < array.size(); i++) {
15468        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
15469      }
15470    };
15471  }
15472
15473  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15474    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
15475    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
15476    return res;
15477  }
15478
15479  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
15480    parseBackboneProperties(json, res);
15481    if (json.has("question"))
15482      res.setQuestionElement(parseString(json.get("question").getAsString()));
15483    if (json.has("_question"))
15484      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
15485    if (json.has("hasAnswer"))
15486      res.setHasAnswerElement(parseBoolean(json.get("hasAnswer").getAsBoolean()));
15487    if (json.has("_hasAnswer"))
15488      parseElementProperties(json.getAsJsonObject("_hasAnswer"), res.getHasAnswerElement());
15489    Type answer = parseType("answer", json);
15490    if (answer != null)
15491      res.setAnswer(answer);
15492  }
15493
15494  protected Questionnaire.QuestionnaireItemOptionComponent parseQuestionnaireQuestionnaireItemOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
15495    Questionnaire.QuestionnaireItemOptionComponent res = new Questionnaire.QuestionnaireItemOptionComponent();
15496    parseQuestionnaireQuestionnaireItemOptionComponentProperties(json, owner, res);
15497    return res;
15498  }
15499
15500  protected void parseQuestionnaireQuestionnaireItemOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemOptionComponent res) throws IOException, FHIRFormatError {
15501    parseBackboneProperties(json, res);
15502    Type value = parseType("value", json);
15503    if (value != null)
15504      res.setValue(value);
15505  }
15506
15507  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
15508    QuestionnaireResponse res = new QuestionnaireResponse();
15509    parseQuestionnaireResponseProperties(json, res);
15510    return res;
15511  }
15512
15513  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
15514    parseDomainResourceProperties(json, res);
15515    if (json.has("identifier"))
15516      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
15517    if (json.has("basedOn")) {
15518      JsonArray array = json.getAsJsonArray("basedOn");
15519      for (int i = 0; i < array.size(); i++) {
15520        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15521      }
15522    };
15523    if (json.has("parent")) {
15524      JsonArray array = json.getAsJsonArray("parent");
15525      for (int i = 0; i < array.size(); i++) {
15526        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
15527      }
15528    };
15529    if (json.has("questionnaire"))
15530      res.setQuestionnaire(parseReference(json.getAsJsonObject("questionnaire")));
15531    if (json.has("status"))
15532      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
15533    if (json.has("_status"))
15534      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15535    if (json.has("subject"))
15536      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15537    if (json.has("context"))
15538      res.setContext(parseReference(json.getAsJsonObject("context")));
15539    if (json.has("authored"))
15540      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
15541    if (json.has("_authored"))
15542      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
15543    if (json.has("author"))
15544      res.setAuthor(parseReference(json.getAsJsonObject("author")));
15545    if (json.has("source"))
15546      res.setSource(parseReference(json.getAsJsonObject("source")));
15547    if (json.has("item")) {
15548      JsonArray array = json.getAsJsonArray("item");
15549      for (int i = 0; i < array.size(); i++) {
15550        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
15551      }
15552    };
15553  }
15554
15555  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15556    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
15557    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
15558    return res;
15559  }
15560
15561  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
15562    parseBackboneProperties(json, res);
15563    if (json.has("linkId"))
15564      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
15565    if (json.has("_linkId"))
15566      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
15567    if (json.has("definition"))
15568      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
15569    if (json.has("_definition"))
15570      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
15571    if (json.has("text"))
15572      res.setTextElement(parseString(json.get("text").getAsString()));
15573    if (json.has("_text"))
15574      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15575    if (json.has("subject"))
15576      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15577    if (json.has("answer")) {
15578      JsonArray array = json.getAsJsonArray("answer");
15579      for (int i = 0; i < array.size(); i++) {
15580        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
15581      }
15582    };
15583    if (json.has("item")) {
15584      JsonArray array = json.getAsJsonArray("item");
15585      for (int i = 0; i < array.size(); i++) {
15586        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15587      }
15588    };
15589  }
15590
15591  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
15592    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
15593    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
15594    return res;
15595  }
15596
15597  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
15598    parseBackboneProperties(json, res);
15599    Type value = parseType("value", json);
15600    if (value != null)
15601      res.setValue(value);
15602    if (json.has("item")) {
15603      JsonArray array = json.getAsJsonArray("item");
15604      for (int i = 0; i < array.size(); i++) {
15605        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
15606      }
15607    };
15608  }
15609
15610  protected ReferralRequest parseReferralRequest(JsonObject json) throws IOException, FHIRFormatError {
15611    ReferralRequest res = new ReferralRequest();
15612    parseReferralRequestProperties(json, res);
15613    return res;
15614  }
15615
15616  protected void parseReferralRequestProperties(JsonObject json, ReferralRequest res) throws IOException, FHIRFormatError {
15617    parseDomainResourceProperties(json, res);
15618    if (json.has("identifier")) {
15619      JsonArray array = json.getAsJsonArray("identifier");
15620      for (int i = 0; i < array.size(); i++) {
15621        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15622      }
15623    };
15624    if (json.has("definition")) {
15625      JsonArray array = json.getAsJsonArray("definition");
15626      for (int i = 0; i < array.size(); i++) {
15627        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15628      }
15629    };
15630    if (json.has("basedOn")) {
15631      JsonArray array = json.getAsJsonArray("basedOn");
15632      for (int i = 0; i < array.size(); i++) {
15633        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15634      }
15635    };
15636    if (json.has("replaces")) {
15637      JsonArray array = json.getAsJsonArray("replaces");
15638      for (int i = 0; i < array.size(); i++) {
15639        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15640      }
15641    };
15642    if (json.has("groupIdentifier"))
15643      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
15644    if (json.has("status"))
15645      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ReferralRequest.ReferralRequestStatus.NULL, new ReferralRequest.ReferralRequestStatusEnumFactory()));
15646    if (json.has("_status"))
15647      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15648    if (json.has("intent"))
15649      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ReferralRequest.ReferralCategory.NULL, new ReferralRequest.ReferralCategoryEnumFactory()));
15650    if (json.has("_intent"))
15651      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15652    if (json.has("type"))
15653      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15654    if (json.has("priority"))
15655      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ReferralRequest.ReferralPriority.NULL, new ReferralRequest.ReferralPriorityEnumFactory()));
15656    if (json.has("_priority"))
15657      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
15658    if (json.has("serviceRequested")) {
15659      JsonArray array = json.getAsJsonArray("serviceRequested");
15660      for (int i = 0; i < array.size(); i++) {
15661        res.getServiceRequested().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15662      }
15663    };
15664    if (json.has("subject"))
15665      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15666    if (json.has("context"))
15667      res.setContext(parseReference(json.getAsJsonObject("context")));
15668    Type occurrence = parseType("occurrence", json);
15669    if (occurrence != null)
15670      res.setOccurrence(occurrence);
15671    if (json.has("authoredOn"))
15672      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15673    if (json.has("_authoredOn"))
15674      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
15675    if (json.has("requester"))
15676      res.setRequester(parseReferralRequestReferralRequestRequesterComponent(json.getAsJsonObject("requester"), res));
15677    if (json.has("specialty"))
15678      res.setSpecialty(parseCodeableConcept(json.getAsJsonObject("specialty")));
15679    if (json.has("recipient")) {
15680      JsonArray array = json.getAsJsonArray("recipient");
15681      for (int i = 0; i < array.size(); i++) {
15682        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
15683      }
15684    };
15685    if (json.has("reasonCode")) {
15686      JsonArray array = json.getAsJsonArray("reasonCode");
15687      for (int i = 0; i < array.size(); i++) {
15688        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15689      }
15690    };
15691    if (json.has("reasonReference")) {
15692      JsonArray array = json.getAsJsonArray("reasonReference");
15693      for (int i = 0; i < array.size(); i++) {
15694        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15695      }
15696    };
15697    if (json.has("description"))
15698      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15699    if (json.has("_description"))
15700      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15701    if (json.has("supportingInfo")) {
15702      JsonArray array = json.getAsJsonArray("supportingInfo");
15703      for (int i = 0; i < array.size(); i++) {
15704        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
15705      }
15706    };
15707    if (json.has("note")) {
15708      JsonArray array = json.getAsJsonArray("note");
15709      for (int i = 0; i < array.size(); i++) {
15710        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15711      }
15712    };
15713    if (json.has("relevantHistory")) {
15714      JsonArray array = json.getAsJsonArray("relevantHistory");
15715      for (int i = 0; i < array.size(); i++) {
15716        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
15717      }
15718    };
15719  }
15720
15721  protected ReferralRequest.ReferralRequestRequesterComponent parseReferralRequestReferralRequestRequesterComponent(JsonObject json, ReferralRequest owner) throws IOException, FHIRFormatError {
15722    ReferralRequest.ReferralRequestRequesterComponent res = new ReferralRequest.ReferralRequestRequesterComponent();
15723    parseReferralRequestReferralRequestRequesterComponentProperties(json, owner, res);
15724    return res;
15725  }
15726
15727  protected void parseReferralRequestReferralRequestRequesterComponentProperties(JsonObject json, ReferralRequest owner, ReferralRequest.ReferralRequestRequesterComponent res) throws IOException, FHIRFormatError {
15728    parseBackboneProperties(json, res);
15729    if (json.has("agent"))
15730      res.setAgent(parseReference(json.getAsJsonObject("agent")));
15731    if (json.has("onBehalfOf"))
15732      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
15733  }
15734
15735  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
15736    RelatedPerson res = new RelatedPerson();
15737    parseRelatedPersonProperties(json, res);
15738    return res;
15739  }
15740
15741  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
15742    parseDomainResourceProperties(json, res);
15743    if (json.has("identifier")) {
15744      JsonArray array = json.getAsJsonArray("identifier");
15745      for (int i = 0; i < array.size(); i++) {
15746        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15747      }
15748    };
15749    if (json.has("active"))
15750      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
15751    if (json.has("_active"))
15752      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
15753    if (json.has("patient"))
15754      res.setPatient(parseReference(json.getAsJsonObject("patient")));
15755    if (json.has("relationship"))
15756      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
15757    if (json.has("name")) {
15758      JsonArray array = json.getAsJsonArray("name");
15759      for (int i = 0; i < array.size(); i++) {
15760        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
15761      }
15762    };
15763    if (json.has("telecom")) {
15764      JsonArray array = json.getAsJsonArray("telecom");
15765      for (int i = 0; i < array.size(); i++) {
15766        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
15767      }
15768    };
15769    if (json.has("gender"))
15770      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
15771    if (json.has("_gender"))
15772      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
15773    if (json.has("birthDate"))
15774      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
15775    if (json.has("_birthDate"))
15776      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
15777    if (json.has("address")) {
15778      JsonArray array = json.getAsJsonArray("address");
15779      for (int i = 0; i < array.size(); i++) {
15780        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
15781      }
15782    };
15783    if (json.has("photo")) {
15784      JsonArray array = json.getAsJsonArray("photo");
15785      for (int i = 0; i < array.size(); i++) {
15786        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
15787      }
15788    };
15789    if (json.has("period"))
15790      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
15791  }
15792
15793  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
15794    RequestGroup res = new RequestGroup();
15795    parseRequestGroupProperties(json, res);
15796    return res;
15797  }
15798
15799  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
15800    parseDomainResourceProperties(json, res);
15801    if (json.has("identifier")) {
15802      JsonArray array = json.getAsJsonArray("identifier");
15803      for (int i = 0; i < array.size(); i++) {
15804        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15805      }
15806    };
15807    if (json.has("definition")) {
15808      JsonArray array = json.getAsJsonArray("definition");
15809      for (int i = 0; i < array.size(); i++) {
15810        res.getDefinition().add(parseReference(array.get(i).getAsJsonObject()));
15811      }
15812    };
15813    if (json.has("basedOn")) {
15814      JsonArray array = json.getAsJsonArray("basedOn");
15815      for (int i = 0; i < array.size(); i++) {
15816        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15817      }
15818    };
15819    if (json.has("replaces")) {
15820      JsonArray array = json.getAsJsonArray("replaces");
15821      for (int i = 0; i < array.size(); i++) {
15822        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
15823      }
15824    };
15825    if (json.has("groupIdentifier"))
15826      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
15827    if (json.has("status"))
15828      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
15829    if (json.has("_status"))
15830      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15831    if (json.has("intent"))
15832      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
15833    if (json.has("_intent"))
15834      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15835    if (json.has("priority"))
15836      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
15837    if (json.has("_priority"))
15838      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
15839    if (json.has("subject"))
15840      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15841    if (json.has("context"))
15842      res.setContext(parseReference(json.getAsJsonObject("context")));
15843    if (json.has("authoredOn"))
15844      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15845    if (json.has("_authoredOn"))
15846      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
15847    if (json.has("author"))
15848      res.setAuthor(parseReference(json.getAsJsonObject("author")));
15849    Type reason = parseType("reason", json);
15850    if (reason != null)
15851      res.setReason(reason);
15852    if (json.has("note")) {
15853      JsonArray array = json.getAsJsonArray("note");
15854      for (int i = 0; i < array.size(); i++) {
15855        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15856      }
15857    };
15858    if (json.has("action")) {
15859      JsonArray array = json.getAsJsonArray("action");
15860      for (int i = 0; i < array.size(); i++) {
15861        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
15862      }
15863    };
15864  }
15865
15866  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15867    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
15868    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
15869    return res;
15870  }
15871
15872  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
15873    parseBackboneProperties(json, res);
15874    if (json.has("label"))
15875      res.setLabelElement(parseString(json.get("label").getAsString()));
15876    if (json.has("_label"))
15877      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
15878    if (json.has("title"))
15879      res.setTitleElement(parseString(json.get("title").getAsString()));
15880    if (json.has("_title"))
15881      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
15882    if (json.has("description"))
15883      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15884    if (json.has("_description"))
15885      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15886    if (json.has("textEquivalent"))
15887      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
15888    if (json.has("_textEquivalent"))
15889      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
15890    if (json.has("code")) {
15891      JsonArray array = json.getAsJsonArray("code");
15892      for (int i = 0; i < array.size(); i++) {
15893        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15894      }
15895    };
15896    if (json.has("documentation")) {
15897      JsonArray array = json.getAsJsonArray("documentation");
15898      for (int i = 0; i < array.size(); i++) {
15899        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
15900      }
15901    };
15902    if (json.has("condition")) {
15903      JsonArray array = json.getAsJsonArray("condition");
15904      for (int i = 0; i < array.size(); i++) {
15905        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
15906      }
15907    };
15908    if (json.has("relatedAction")) {
15909      JsonArray array = json.getAsJsonArray("relatedAction");
15910      for (int i = 0; i < array.size(); i++) {
15911        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
15912      }
15913    };
15914    Type timing = parseType("timing", json);
15915    if (timing != null)
15916      res.setTiming(timing);
15917    if (json.has("participant")) {
15918      JsonArray array = json.getAsJsonArray("participant");
15919      for (int i = 0; i < array.size(); i++) {
15920        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
15921      }
15922    };
15923    if (json.has("type"))
15924      res.setType(parseCoding(json.getAsJsonObject("type")));
15925    if (json.has("groupingBehavior"))
15926      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
15927    if (json.has("_groupingBehavior"))
15928      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
15929    if (json.has("selectionBehavior"))
15930      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
15931    if (json.has("_selectionBehavior"))
15932      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
15933    if (json.has("requiredBehavior"))
15934      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
15935    if (json.has("_requiredBehavior"))
15936      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
15937    if (json.has("precheckBehavior"))
15938      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
15939    if (json.has("_precheckBehavior"))
15940      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
15941    if (json.has("cardinalityBehavior"))
15942      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
15943    if (json.has("_cardinalityBehavior"))
15944      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
15945    if (json.has("resource"))
15946      res.setResource(parseReference(json.getAsJsonObject("resource")));
15947    if (json.has("action")) {
15948      JsonArray array = json.getAsJsonArray("action");
15949      for (int i = 0; i < array.size(); i++) {
15950        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
15951      }
15952    };
15953  }
15954
15955  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15956    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
15957    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
15958    return res;
15959  }
15960
15961  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
15962    parseBackboneProperties(json, res);
15963    if (json.has("kind"))
15964      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
15965    if (json.has("_kind"))
15966      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
15967    if (json.has("description"))
15968      res.setDescriptionElement(parseString(json.get("description").getAsString()));
15969    if (json.has("_description"))
15970      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
15971    if (json.has("language"))
15972      res.setLanguageElement(parseString(json.get("language").getAsString()));
15973    if (json.has("_language"))
15974      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
15975    if (json.has("expression"))
15976      res.setExpressionElement(parseString(json.get("expression").getAsString()));
15977    if (json.has("_expression"))
15978      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
15979  }
15980
15981  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
15982    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
15983    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
15984    return res;
15985  }
15986
15987  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
15988    parseBackboneProperties(json, res);
15989    if (json.has("actionId"))
15990      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
15991    if (json.has("_actionId"))
15992      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
15993    if (json.has("relationship"))
15994      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
15995    if (json.has("_relationship"))
15996      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
15997    Type offset = parseType("offset", json);
15998    if (offset != null)
15999      res.setOffset(offset);
16000  }
16001
16002  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
16003    ResearchStudy res = new ResearchStudy();
16004    parseResearchStudyProperties(json, res);
16005    return res;
16006  }
16007
16008  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
16009    parseDomainResourceProperties(json, res);
16010    if (json.has("identifier")) {
16011      JsonArray array = json.getAsJsonArray("identifier");
16012      for (int i = 0; i < array.size(); i++) {
16013        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16014      }
16015    };
16016    if (json.has("title"))
16017      res.setTitleElement(parseString(json.get("title").getAsString()));
16018    if (json.has("_title"))
16019      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16020    if (json.has("protocol")) {
16021      JsonArray array = json.getAsJsonArray("protocol");
16022      for (int i = 0; i < array.size(); i++) {
16023        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
16024      }
16025    };
16026    if (json.has("partOf")) {
16027      JsonArray array = json.getAsJsonArray("partOf");
16028      for (int i = 0; i < array.size(); i++) {
16029        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
16030      }
16031    };
16032    if (json.has("status"))
16033      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
16034    if (json.has("_status"))
16035      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16036    if (json.has("category")) {
16037      JsonArray array = json.getAsJsonArray("category");
16038      for (int i = 0; i < array.size(); i++) {
16039        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16040      }
16041    };
16042    if (json.has("focus")) {
16043      JsonArray array = json.getAsJsonArray("focus");
16044      for (int i = 0; i < array.size(); i++) {
16045        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16046      }
16047    };
16048    if (json.has("contact")) {
16049      JsonArray array = json.getAsJsonArray("contact");
16050      for (int i = 0; i < array.size(); i++) {
16051        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16052      }
16053    };
16054    if (json.has("relatedArtifact")) {
16055      JsonArray array = json.getAsJsonArray("relatedArtifact");
16056      for (int i = 0; i < array.size(); i++) {
16057        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16058      }
16059    };
16060    if (json.has("keyword")) {
16061      JsonArray array = json.getAsJsonArray("keyword");
16062      for (int i = 0; i < array.size(); i++) {
16063        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16064      }
16065    };
16066    if (json.has("jurisdiction")) {
16067      JsonArray array = json.getAsJsonArray("jurisdiction");
16068      for (int i = 0; i < array.size(); i++) {
16069        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16070      }
16071    };
16072    if (json.has("description"))
16073      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16074    if (json.has("_description"))
16075      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16076    if (json.has("enrollment")) {
16077      JsonArray array = json.getAsJsonArray("enrollment");
16078      for (int i = 0; i < array.size(); i++) {
16079        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
16080      }
16081    };
16082    if (json.has("period"))
16083      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16084    if (json.has("sponsor"))
16085      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
16086    if (json.has("principalInvestigator"))
16087      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
16088    if (json.has("site")) {
16089      JsonArray array = json.getAsJsonArray("site");
16090      for (int i = 0; i < array.size(); i++) {
16091        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
16092      }
16093    };
16094    if (json.has("reasonStopped"))
16095      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
16096    if (json.has("note")) {
16097      JsonArray array = json.getAsJsonArray("note");
16098      for (int i = 0; i < array.size(); i++) {
16099        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16100      }
16101    };
16102    if (json.has("arm")) {
16103      JsonArray array = json.getAsJsonArray("arm");
16104      for (int i = 0; i < array.size(); i++) {
16105        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
16106      }
16107    };
16108  }
16109
16110  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
16111    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
16112    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
16113    return res;
16114  }
16115
16116  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
16117    parseBackboneProperties(json, res);
16118    if (json.has("name"))
16119      res.setNameElement(parseString(json.get("name").getAsString()));
16120    if (json.has("_name"))
16121      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16122    if (json.has("code"))
16123      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16124    if (json.has("description"))
16125      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16126    if (json.has("_description"))
16127      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16128  }
16129
16130  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
16131    ResearchSubject res = new ResearchSubject();
16132    parseResearchSubjectProperties(json, res);
16133    return res;
16134  }
16135
16136  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
16137    parseDomainResourceProperties(json, res);
16138    if (json.has("identifier"))
16139      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16140    if (json.has("status"))
16141      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
16142    if (json.has("_status"))
16143      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16144    if (json.has("period"))
16145      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
16146    if (json.has("study"))
16147      res.setStudy(parseReference(json.getAsJsonObject("study")));
16148    if (json.has("individual"))
16149      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
16150    if (json.has("assignedArm"))
16151      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
16152    if (json.has("_assignedArm"))
16153      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
16154    if (json.has("actualArm"))
16155      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
16156    if (json.has("_actualArm"))
16157      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
16158    if (json.has("consent"))
16159      res.setConsent(parseReference(json.getAsJsonObject("consent")));
16160  }
16161
16162  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
16163    RiskAssessment res = new RiskAssessment();
16164    parseRiskAssessmentProperties(json, res);
16165    return res;
16166  }
16167
16168  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
16169    parseDomainResourceProperties(json, res);
16170    if (json.has("identifier"))
16171      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16172    if (json.has("basedOn"))
16173      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
16174    if (json.has("parent"))
16175      res.setParent(parseReference(json.getAsJsonObject("parent")));
16176    if (json.has("status"))
16177      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
16178    if (json.has("_status"))
16179      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16180    if (json.has("method"))
16181      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16182    if (json.has("code"))
16183      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16184    if (json.has("subject"))
16185      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16186    if (json.has("context"))
16187      res.setContext(parseReference(json.getAsJsonObject("context")));
16188    Type occurrence = parseType("occurrence", json);
16189    if (occurrence != null)
16190      res.setOccurrence(occurrence);
16191    if (json.has("condition"))
16192      res.setCondition(parseReference(json.getAsJsonObject("condition")));
16193    if (json.has("performer"))
16194      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16195    Type reason = parseType("reason", json);
16196    if (reason != null)
16197      res.setReason(reason);
16198    if (json.has("basis")) {
16199      JsonArray array = json.getAsJsonArray("basis");
16200      for (int i = 0; i < array.size(); i++) {
16201        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
16202      }
16203    };
16204    if (json.has("prediction")) {
16205      JsonArray array = json.getAsJsonArray("prediction");
16206      for (int i = 0; i < array.size(); i++) {
16207        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
16208      }
16209    };
16210    if (json.has("mitigation"))
16211      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
16212    if (json.has("_mitigation"))
16213      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
16214    if (json.has("comment"))
16215      res.setCommentElement(parseString(json.get("comment").getAsString()));
16216    if (json.has("_comment"))
16217      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16218  }
16219
16220  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
16221    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
16222    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
16223    return res;
16224  }
16225
16226  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
16227    parseBackboneProperties(json, res);
16228    if (json.has("outcome"))
16229      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
16230    Type probability = parseType("probability", json);
16231    if (probability != null)
16232      res.setProbability(probability);
16233    if (json.has("qualitativeRisk"))
16234      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
16235    if (json.has("relativeRisk"))
16236      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
16237    if (json.has("_relativeRisk"))
16238      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
16239    Type when = parseType("when", json);
16240    if (when != null)
16241      res.setWhen(when);
16242    if (json.has("rationale"))
16243      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
16244    if (json.has("_rationale"))
16245      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
16246  }
16247
16248  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
16249    Schedule res = new Schedule();
16250    parseScheduleProperties(json, res);
16251    return res;
16252  }
16253
16254  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
16255    parseDomainResourceProperties(json, res);
16256    if (json.has("identifier")) {
16257      JsonArray array = json.getAsJsonArray("identifier");
16258      for (int i = 0; i < array.size(); i++) {
16259        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16260      }
16261    };
16262    if (json.has("active"))
16263      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
16264    if (json.has("_active"))
16265      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
16266    if (json.has("serviceCategory"))
16267      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
16268    if (json.has("serviceType")) {
16269      JsonArray array = json.getAsJsonArray("serviceType");
16270      for (int i = 0; i < array.size(); i++) {
16271        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16272      }
16273    };
16274    if (json.has("specialty")) {
16275      JsonArray array = json.getAsJsonArray("specialty");
16276      for (int i = 0; i < array.size(); i++) {
16277        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16278      }
16279    };
16280    if (json.has("actor")) {
16281      JsonArray array = json.getAsJsonArray("actor");
16282      for (int i = 0; i < array.size(); i++) {
16283        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
16284      }
16285    };
16286    if (json.has("planningHorizon"))
16287      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
16288    if (json.has("comment"))
16289      res.setCommentElement(parseString(json.get("comment").getAsString()));
16290    if (json.has("_comment"))
16291      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16292  }
16293
16294  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
16295    SearchParameter res = new SearchParameter();
16296    parseSearchParameterProperties(json, res);
16297    return res;
16298  }
16299
16300  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
16301    parseDomainResourceProperties(json, res);
16302    if (json.has("url"))
16303      res.setUrlElement(parseUri(json.get("url").getAsString()));
16304    if (json.has("_url"))
16305      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16306    if (json.has("version"))
16307      res.setVersionElement(parseString(json.get("version").getAsString()));
16308    if (json.has("_version"))
16309      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16310    if (json.has("name"))
16311      res.setNameElement(parseString(json.get("name").getAsString()));
16312    if (json.has("_name"))
16313      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16314    if (json.has("status"))
16315      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16316    if (json.has("_status"))
16317      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16318    if (json.has("experimental"))
16319      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16320    if (json.has("_experimental"))
16321      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16322    if (json.has("date"))
16323      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16324    if (json.has("_date"))
16325      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16326    if (json.has("publisher"))
16327      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16328    if (json.has("_publisher"))
16329      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16330    if (json.has("contact")) {
16331      JsonArray array = json.getAsJsonArray("contact");
16332      for (int i = 0; i < array.size(); i++) {
16333        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16334      }
16335    };
16336    if (json.has("useContext")) {
16337      JsonArray array = json.getAsJsonArray("useContext");
16338      for (int i = 0; i < array.size(); i++) {
16339        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16340      }
16341    };
16342    if (json.has("jurisdiction")) {
16343      JsonArray array = json.getAsJsonArray("jurisdiction");
16344      for (int i = 0; i < array.size(); i++) {
16345        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16346      }
16347    };
16348    if (json.has("purpose"))
16349      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16350    if (json.has("_purpose"))
16351      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16352    if (json.has("code"))
16353      res.setCodeElement(parseCode(json.get("code").getAsString()));
16354    if (json.has("_code"))
16355      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
16356    if (json.has("base")) {
16357      JsonArray array = json.getAsJsonArray("base");
16358      for (int i = 0; i < array.size(); i++) {
16359        res.getBase().add(parseCode(array.get(i).getAsString()));
16360      }
16361    };
16362    if (json.has("_base")) {
16363      JsonArray array = json.getAsJsonArray("_base");
16364      for (int i = 0; i < array.size(); i++) {
16365        if (i == res.getBase().size())
16366          res.getBase().add(parseCode(null));
16367        if (array.get(i) instanceof JsonObject) 
16368          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
16369      }
16370    };
16371    if (json.has("type"))
16372      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
16373    if (json.has("_type"))
16374      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16375    if (json.has("derivedFrom"))
16376      res.setDerivedFromElement(parseUri(json.get("derivedFrom").getAsString()));
16377    if (json.has("_derivedFrom"))
16378      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
16379    if (json.has("description"))
16380      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16381    if (json.has("_description"))
16382      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16383    if (json.has("expression"))
16384      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16385    if (json.has("_expression"))
16386      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
16387    if (json.has("xpath"))
16388      res.setXpathElement(parseString(json.get("xpath").getAsString()));
16389    if (json.has("_xpath"))
16390      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
16391    if (json.has("xpathUsage"))
16392      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
16393    if (json.has("_xpathUsage"))
16394      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
16395    if (json.has("target")) {
16396      JsonArray array = json.getAsJsonArray("target");
16397      for (int i = 0; i < array.size(); i++) {
16398        res.getTarget().add(parseCode(array.get(i).getAsString()));
16399      }
16400    };
16401    if (json.has("_target")) {
16402      JsonArray array = json.getAsJsonArray("_target");
16403      for (int i = 0; i < array.size(); i++) {
16404        if (i == res.getTarget().size())
16405          res.getTarget().add(parseCode(null));
16406        if (array.get(i) instanceof JsonObject) 
16407          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
16408      }
16409    };
16410    if (json.has("comparator")) {
16411      JsonArray array = json.getAsJsonArray("comparator");
16412      for (int i = 0; i < array.size(); i++) {
16413        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16414      }
16415    };
16416    if (json.has("_comparator")) {
16417      JsonArray array = json.getAsJsonArray("_comparator");
16418      for (int i = 0; i < array.size(); i++) {
16419        if (i == res.getComparator().size())
16420          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
16421        if (array.get(i) instanceof JsonObject) 
16422          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
16423      }
16424    };
16425    if (json.has("modifier")) {
16426      JsonArray array = json.getAsJsonArray("modifier");
16427      for (int i = 0; i < array.size(); i++) {
16428        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16429      }
16430    };
16431    if (json.has("_modifier")) {
16432      JsonArray array = json.getAsJsonArray("_modifier");
16433      for (int i = 0; i < array.size(); i++) {
16434        if (i == res.getModifier().size())
16435          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
16436        if (array.get(i) instanceof JsonObject) 
16437          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
16438      }
16439    };
16440    if (json.has("chain")) {
16441      JsonArray array = json.getAsJsonArray("chain");
16442      for (int i = 0; i < array.size(); i++) {
16443        res.getChain().add(parseString(array.get(i).getAsString()));
16444      }
16445    };
16446    if (json.has("_chain")) {
16447      JsonArray array = json.getAsJsonArray("_chain");
16448      for (int i = 0; i < array.size(); i++) {
16449        if (i == res.getChain().size())
16450          res.getChain().add(parseString(null));
16451        if (array.get(i) instanceof JsonObject) 
16452          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
16453      }
16454    };
16455    if (json.has("component")) {
16456      JsonArray array = json.getAsJsonArray("component");
16457      for (int i = 0; i < array.size(); i++) {
16458        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
16459      }
16460    };
16461  }
16462
16463  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
16464    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
16465    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
16466    return res;
16467  }
16468
16469  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
16470    parseBackboneProperties(json, res);
16471    if (json.has("definition"))
16472      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
16473    if (json.has("expression"))
16474      res.setExpressionElement(parseString(json.get("expression").getAsString()));
16475    if (json.has("_expression"))
16476      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
16477  }
16478
16479  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
16480    Sequence res = new Sequence();
16481    parseSequenceProperties(json, res);
16482    return res;
16483  }
16484
16485  protected void parseSequenceProperties(JsonObject json, Sequence res) throws IOException, FHIRFormatError {
16486    parseDomainResourceProperties(json, res);
16487    if (json.has("identifier")) {
16488      JsonArray array = json.getAsJsonArray("identifier");
16489      for (int i = 0; i < array.size(); i++) {
16490        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16491      }
16492    };
16493    if (json.has("type"))
16494      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
16495    if (json.has("_type"))
16496      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16497    if (json.has("coordinateSystem"))
16498      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
16499    if (json.has("_coordinateSystem"))
16500      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
16501    if (json.has("patient"))
16502      res.setPatient(parseReference(json.getAsJsonObject("patient")));
16503    if (json.has("specimen"))
16504      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
16505    if (json.has("device"))
16506      res.setDevice(parseReference(json.getAsJsonObject("device")));
16507    if (json.has("performer"))
16508      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
16509    if (json.has("quantity"))
16510      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16511    if (json.has("referenceSeq"))
16512      res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
16513    if (json.has("variant")) {
16514      JsonArray array = json.getAsJsonArray("variant");
16515      for (int i = 0; i < array.size(); i++) {
16516        res.getVariant().add(parseSequenceSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
16517      }
16518    };
16519    if (json.has("observedSeq"))
16520      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
16521    if (json.has("_observedSeq"))
16522      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
16523    if (json.has("quality")) {
16524      JsonArray array = json.getAsJsonArray("quality");
16525      for (int i = 0; i < array.size(); i++) {
16526        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
16527      }
16528    };
16529    if (json.has("readCoverage"))
16530      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
16531    if (json.has("_readCoverage"))
16532      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
16533    if (json.has("repository")) {
16534      JsonArray array = json.getAsJsonArray("repository");
16535      for (int i = 0; i < array.size(); i++) {
16536        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
16537      }
16538    };
16539    if (json.has("pointer")) {
16540      JsonArray array = json.getAsJsonArray("pointer");
16541      for (int i = 0; i < array.size(); i++) {
16542        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
16543      }
16544    };
16545  }
16546
16547  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16548    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
16549    parseSequenceSequenceReferenceSeqComponentProperties(json, owner, res);
16550    return res;
16551  }
16552
16553  protected void parseSequenceSequenceReferenceSeqComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
16554    parseBackboneProperties(json, res);
16555    if (json.has("chromosome"))
16556      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
16557    if (json.has("genomeBuild"))
16558      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
16559    if (json.has("_genomeBuild"))
16560      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
16561    if (json.has("referenceSeqId"))
16562      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
16563    if (json.has("referenceSeqPointer"))
16564      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
16565    if (json.has("referenceSeqString"))
16566      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
16567    if (json.has("_referenceSeqString"))
16568      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
16569    if (json.has("strand"))
16570      res.setStrandElement(parseInteger(json.get("strand").getAsLong()));
16571    if (json.has("_strand"))
16572      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
16573    if (json.has("windowStart"))
16574      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
16575    if (json.has("_windowStart"))
16576      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
16577    if (json.has("windowEnd"))
16578      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
16579    if (json.has("_windowEnd"))
16580      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
16581  }
16582
16583  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16584    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
16585    parseSequenceSequenceVariantComponentProperties(json, owner, res);
16586    return res;
16587  }
16588
16589  protected void parseSequenceSequenceVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceVariantComponent res) throws IOException, FHIRFormatError {
16590    parseBackboneProperties(json, res);
16591    if (json.has("start"))
16592      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16593    if (json.has("_start"))
16594      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16595    if (json.has("end"))
16596      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16597    if (json.has("_end"))
16598      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16599    if (json.has("observedAllele"))
16600      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
16601    if (json.has("_observedAllele"))
16602      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
16603    if (json.has("referenceAllele"))
16604      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
16605    if (json.has("_referenceAllele"))
16606      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
16607    if (json.has("cigar"))
16608      res.setCigarElement(parseString(json.get("cigar").getAsString()));
16609    if (json.has("_cigar"))
16610      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
16611    if (json.has("variantPointer"))
16612      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
16613  }
16614
16615  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16616    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
16617    parseSequenceSequenceQualityComponentProperties(json, owner, res);
16618    return res;
16619  }
16620
16621  protected void parseSequenceSequenceQualityComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityComponent res) throws IOException, FHIRFormatError {
16622    parseBackboneProperties(json, res);
16623    if (json.has("type"))
16624      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
16625    if (json.has("_type"))
16626      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16627    if (json.has("standardSequence"))
16628      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
16629    if (json.has("start"))
16630      res.setStartElement(parseInteger(json.get("start").getAsLong()));
16631    if (json.has("_start"))
16632      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16633    if (json.has("end"))
16634      res.setEndElement(parseInteger(json.get("end").getAsLong()));
16635    if (json.has("_end"))
16636      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16637    if (json.has("score"))
16638      res.setScore(parseQuantity(json.getAsJsonObject("score")));
16639    if (json.has("method"))
16640      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16641    if (json.has("truthTP"))
16642      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
16643    if (json.has("_truthTP"))
16644      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
16645    if (json.has("queryTP"))
16646      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
16647    if (json.has("_queryTP"))
16648      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
16649    if (json.has("truthFN"))
16650      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
16651    if (json.has("_truthFN"))
16652      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
16653    if (json.has("queryFP"))
16654      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
16655    if (json.has("_queryFP"))
16656      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
16657    if (json.has("gtFP"))
16658      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
16659    if (json.has("_gtFP"))
16660      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
16661    if (json.has("precision"))
16662      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
16663    if (json.has("_precision"))
16664      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
16665    if (json.has("recall"))
16666      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
16667    if (json.has("_recall"))
16668      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
16669    if (json.has("fScore"))
16670      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
16671    if (json.has("_fScore"))
16672      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
16673  }
16674
16675  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
16676    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
16677    parseSequenceSequenceRepositoryComponentProperties(json, owner, res);
16678    return res;
16679  }
16680
16681  protected void parseSequenceSequenceRepositoryComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceRepositoryComponent res) throws IOException, FHIRFormatError {
16682    parseBackboneProperties(json, res);
16683    if (json.has("type"))
16684      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
16685    if (json.has("_type"))
16686      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
16687    if (json.has("url"))
16688      res.setUrlElement(parseUri(json.get("url").getAsString()));
16689    if (json.has("_url"))
16690      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16691    if (json.has("name"))
16692      res.setNameElement(parseString(json.get("name").getAsString()));
16693    if (json.has("_name"))
16694      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16695    if (json.has("datasetId"))
16696      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
16697    if (json.has("_datasetId"))
16698      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
16699    if (json.has("variantsetId"))
16700      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
16701    if (json.has("_variantsetId"))
16702      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
16703    if (json.has("readsetId"))
16704      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
16705    if (json.has("_readsetId"))
16706      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
16707  }
16708
16709  protected ServiceDefinition parseServiceDefinition(JsonObject json) throws IOException, FHIRFormatError {
16710    ServiceDefinition res = new ServiceDefinition();
16711    parseServiceDefinitionProperties(json, res);
16712    return res;
16713  }
16714
16715  protected void parseServiceDefinitionProperties(JsonObject json, ServiceDefinition res) throws IOException, FHIRFormatError {
16716    parseDomainResourceProperties(json, res);
16717    if (json.has("url"))
16718      res.setUrlElement(parseUri(json.get("url").getAsString()));
16719    if (json.has("_url"))
16720      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
16721    if (json.has("identifier")) {
16722      JsonArray array = json.getAsJsonArray("identifier");
16723      for (int i = 0; i < array.size(); i++) {
16724        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16725      }
16726    };
16727    if (json.has("version"))
16728      res.setVersionElement(parseString(json.get("version").getAsString()));
16729    if (json.has("_version"))
16730      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
16731    if (json.has("name"))
16732      res.setNameElement(parseString(json.get("name").getAsString()));
16733    if (json.has("_name"))
16734      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
16735    if (json.has("title"))
16736      res.setTitleElement(parseString(json.get("title").getAsString()));
16737    if (json.has("_title"))
16738      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
16739    if (json.has("status"))
16740      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
16741    if (json.has("_status"))
16742      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16743    if (json.has("experimental"))
16744      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
16745    if (json.has("_experimental"))
16746      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
16747    if (json.has("date"))
16748      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16749    if (json.has("_date"))
16750      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16751    if (json.has("publisher"))
16752      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
16753    if (json.has("_publisher"))
16754      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
16755    if (json.has("description"))
16756      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
16757    if (json.has("_description"))
16758      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16759    if (json.has("purpose"))
16760      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
16761    if (json.has("_purpose"))
16762      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
16763    if (json.has("usage"))
16764      res.setUsageElement(parseString(json.get("usage").getAsString()));
16765    if (json.has("_usage"))
16766      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
16767    if (json.has("approvalDate"))
16768      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
16769    if (json.has("_approvalDate"))
16770      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
16771    if (json.has("lastReviewDate"))
16772      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
16773    if (json.has("_lastReviewDate"))
16774      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
16775    if (json.has("effectivePeriod"))
16776      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
16777    if (json.has("useContext")) {
16778      JsonArray array = json.getAsJsonArray("useContext");
16779      for (int i = 0; i < array.size(); i++) {
16780        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
16781      }
16782    };
16783    if (json.has("jurisdiction")) {
16784      JsonArray array = json.getAsJsonArray("jurisdiction");
16785      for (int i = 0; i < array.size(); i++) {
16786        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16787      }
16788    };
16789    if (json.has("topic")) {
16790      JsonArray array = json.getAsJsonArray("topic");
16791      for (int i = 0; i < array.size(); i++) {
16792        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16793      }
16794    };
16795    if (json.has("contributor")) {
16796      JsonArray array = json.getAsJsonArray("contributor");
16797      for (int i = 0; i < array.size(); i++) {
16798        res.getContributor().add(parseContributor(array.get(i).getAsJsonObject()));
16799      }
16800    };
16801    if (json.has("contact")) {
16802      JsonArray array = json.getAsJsonArray("contact");
16803      for (int i = 0; i < array.size(); i++) {
16804        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
16805      }
16806    };
16807    if (json.has("copyright"))
16808      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
16809    if (json.has("_copyright"))
16810      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
16811    if (json.has("relatedArtifact")) {
16812      JsonArray array = json.getAsJsonArray("relatedArtifact");
16813      for (int i = 0; i < array.size(); i++) {
16814        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
16815      }
16816    };
16817    if (json.has("trigger")) {
16818      JsonArray array = json.getAsJsonArray("trigger");
16819      for (int i = 0; i < array.size(); i++) {
16820        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
16821      }
16822    };
16823    if (json.has("dataRequirement")) {
16824      JsonArray array = json.getAsJsonArray("dataRequirement");
16825      for (int i = 0; i < array.size(); i++) {
16826        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
16827      }
16828    };
16829    if (json.has("operationDefinition"))
16830      res.setOperationDefinition(parseReference(json.getAsJsonObject("operationDefinition")));
16831  }
16832
16833  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
16834    Slot res = new Slot();
16835    parseSlotProperties(json, res);
16836    return res;
16837  }
16838
16839  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
16840    parseDomainResourceProperties(json, res);
16841    if (json.has("identifier")) {
16842      JsonArray array = json.getAsJsonArray("identifier");
16843      for (int i = 0; i < array.size(); i++) {
16844        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16845      }
16846    };
16847    if (json.has("serviceCategory"))
16848      res.setServiceCategory(parseCodeableConcept(json.getAsJsonObject("serviceCategory")));
16849    if (json.has("serviceType")) {
16850      JsonArray array = json.getAsJsonArray("serviceType");
16851      for (int i = 0; i < array.size(); i++) {
16852        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16853      }
16854    };
16855    if (json.has("specialty")) {
16856      JsonArray array = json.getAsJsonArray("specialty");
16857      for (int i = 0; i < array.size(); i++) {
16858        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16859      }
16860    };
16861    if (json.has("appointmentType"))
16862      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
16863    if (json.has("schedule"))
16864      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
16865    if (json.has("status"))
16866      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
16867    if (json.has("_status"))
16868      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16869    if (json.has("start"))
16870      res.setStartElement(parseInstant(json.get("start").getAsString()));
16871    if (json.has("_start"))
16872      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
16873    if (json.has("end"))
16874      res.setEndElement(parseInstant(json.get("end").getAsString()));
16875    if (json.has("_end"))
16876      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
16877    if (json.has("overbooked"))
16878      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
16879    if (json.has("_overbooked"))
16880      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
16881    if (json.has("comment"))
16882      res.setCommentElement(parseString(json.get("comment").getAsString()));
16883    if (json.has("_comment"))
16884      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
16885  }
16886
16887  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
16888    Specimen res = new Specimen();
16889    parseSpecimenProperties(json, res);
16890    return res;
16891  }
16892
16893  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
16894    parseDomainResourceProperties(json, res);
16895    if (json.has("identifier")) {
16896      JsonArray array = json.getAsJsonArray("identifier");
16897      for (int i = 0; i < array.size(); i++) {
16898        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16899      }
16900    };
16901    if (json.has("accessionIdentifier"))
16902      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
16903    if (json.has("status"))
16904      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
16905    if (json.has("_status"))
16906      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
16907    if (json.has("type"))
16908      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16909    if (json.has("subject"))
16910      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16911    if (json.has("receivedTime"))
16912      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
16913    if (json.has("_receivedTime"))
16914      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
16915    if (json.has("parent")) {
16916      JsonArray array = json.getAsJsonArray("parent");
16917      for (int i = 0; i < array.size(); i++) {
16918        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
16919      }
16920    };
16921    if (json.has("request")) {
16922      JsonArray array = json.getAsJsonArray("request");
16923      for (int i = 0; i < array.size(); i++) {
16924        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
16925      }
16926    };
16927    if (json.has("collection"))
16928      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
16929    if (json.has("processing")) {
16930      JsonArray array = json.getAsJsonArray("processing");
16931      for (int i = 0; i < array.size(); i++) {
16932        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
16933      }
16934    };
16935    if (json.has("container")) {
16936      JsonArray array = json.getAsJsonArray("container");
16937      for (int i = 0; i < array.size(); i++) {
16938        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
16939      }
16940    };
16941    if (json.has("note")) {
16942      JsonArray array = json.getAsJsonArray("note");
16943      for (int i = 0; i < array.size(); i++) {
16944        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
16945      }
16946    };
16947  }
16948
16949  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16950    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
16951    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
16952    return res;
16953  }
16954
16955  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
16956    parseBackboneProperties(json, res);
16957    if (json.has("collector"))
16958      res.setCollector(parseReference(json.getAsJsonObject("collector")));
16959    Type collected = parseType("collected", json);
16960    if (collected != null)
16961      res.setCollected(collected);
16962    if (json.has("quantity"))
16963      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
16964    if (json.has("method"))
16965      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
16966    if (json.has("bodySite"))
16967      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
16968  }
16969
16970  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16971    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
16972    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
16973    return res;
16974  }
16975
16976  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
16977    parseBackboneProperties(json, res);
16978    if (json.has("description"))
16979      res.setDescriptionElement(parseString(json.get("description").getAsString()));
16980    if (json.has("_description"))
16981      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
16982    if (json.has("procedure"))
16983      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
16984    if (json.has("additive")) {
16985      JsonArray array = json.getAsJsonArray("additive");
16986      for (int i = 0; i < array.size(); i++) {
16987        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
16988      }
16989    };
16990    Type time = parseType("time", json);
16991    if (time != null)
16992      res.setTime(time);
16993  }
16994
16995  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
16996    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
16997    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
16998    return res;
16999  }
17000
17001  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
17002    parseBackboneProperties(json, res);
17003    if (json.has("identifier")) {
17004      JsonArray array = json.getAsJsonArray("identifier");
17005      for (int i = 0; i < array.size(); i++) {
17006        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17007      }
17008    };
17009    if (json.has("description"))
17010      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17011    if (json.has("_description"))
17012      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17013    if (json.has("type"))
17014      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17015    if (json.has("capacity"))
17016      res.setCapacity(parseSimpleQuantity(json.getAsJsonObject("capacity")));
17017    if (json.has("specimenQuantity"))
17018      res.setSpecimenQuantity(parseSimpleQuantity(json.getAsJsonObject("specimenQuantity")));
17019    Type additive = parseType("additive", json);
17020    if (additive != null)
17021      res.setAdditive(additive);
17022  }
17023
17024  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
17025    StructureDefinition res = new StructureDefinition();
17026    parseStructureDefinitionProperties(json, res);
17027    return res;
17028  }
17029
17030  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
17031    parseDomainResourceProperties(json, res);
17032    if (json.has("url"))
17033      res.setUrlElement(parseUri(json.get("url").getAsString()));
17034    if (json.has("_url"))
17035      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17036    if (json.has("identifier")) {
17037      JsonArray array = json.getAsJsonArray("identifier");
17038      for (int i = 0; i < array.size(); i++) {
17039        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17040      }
17041    };
17042    if (json.has("version"))
17043      res.setVersionElement(parseString(json.get("version").getAsString()));
17044    if (json.has("_version"))
17045      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17046    if (json.has("name"))
17047      res.setNameElement(parseString(json.get("name").getAsString()));
17048    if (json.has("_name"))
17049      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17050    if (json.has("title"))
17051      res.setTitleElement(parseString(json.get("title").getAsString()));
17052    if (json.has("_title"))
17053      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17054    if (json.has("status"))
17055      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17056    if (json.has("_status"))
17057      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17058    if (json.has("experimental"))
17059      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17060    if (json.has("_experimental"))
17061      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17062    if (json.has("date"))
17063      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17064    if (json.has("_date"))
17065      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17066    if (json.has("publisher"))
17067      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17068    if (json.has("_publisher"))
17069      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17070    if (json.has("contact")) {
17071      JsonArray array = json.getAsJsonArray("contact");
17072      for (int i = 0; i < array.size(); i++) {
17073        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17074      }
17075    };
17076    if (json.has("description"))
17077      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17078    if (json.has("_description"))
17079      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17080    if (json.has("useContext")) {
17081      JsonArray array = json.getAsJsonArray("useContext");
17082      for (int i = 0; i < array.size(); i++) {
17083        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17084      }
17085    };
17086    if (json.has("jurisdiction")) {
17087      JsonArray array = json.getAsJsonArray("jurisdiction");
17088      for (int i = 0; i < array.size(); i++) {
17089        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17090      }
17091    };
17092    if (json.has("purpose"))
17093      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17094    if (json.has("_purpose"))
17095      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17096    if (json.has("copyright"))
17097      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17098    if (json.has("_copyright"))
17099      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17100    if (json.has("keyword")) {
17101      JsonArray array = json.getAsJsonArray("keyword");
17102      for (int i = 0; i < array.size(); i++) {
17103        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
17104      }
17105    };
17106    if (json.has("fhirVersion"))
17107      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
17108    if (json.has("_fhirVersion"))
17109      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
17110    if (json.has("mapping")) {
17111      JsonArray array = json.getAsJsonArray("mapping");
17112      for (int i = 0; i < array.size(); i++) {
17113        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
17114      }
17115    };
17116    if (json.has("kind"))
17117      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
17118    if (json.has("_kind"))
17119      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
17120    if (json.has("abstract"))
17121      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
17122    if (json.has("_abstract"))
17123      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
17124    if (json.has("contextType"))
17125      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureDefinition.ExtensionContext.NULL, new StructureDefinition.ExtensionContextEnumFactory()));
17126    if (json.has("_contextType"))
17127      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
17128    if (json.has("context")) {
17129      JsonArray array = json.getAsJsonArray("context");
17130      for (int i = 0; i < array.size(); i++) {
17131        res.getContext().add(parseString(array.get(i).getAsString()));
17132      }
17133    };
17134    if (json.has("_context")) {
17135      JsonArray array = json.getAsJsonArray("_context");
17136      for (int i = 0; i < array.size(); i++) {
17137        if (i == res.getContext().size())
17138          res.getContext().add(parseString(null));
17139        if (array.get(i) instanceof JsonObject) 
17140          parseElementProperties(array.get(i).getAsJsonObject(), res.getContext().get(i));
17141      }
17142    };
17143    if (json.has("contextInvariant")) {
17144      JsonArray array = json.getAsJsonArray("contextInvariant");
17145      for (int i = 0; i < array.size(); i++) {
17146        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
17147      }
17148    };
17149    if (json.has("_contextInvariant")) {
17150      JsonArray array = json.getAsJsonArray("_contextInvariant");
17151      for (int i = 0; i < array.size(); i++) {
17152        if (i == res.getContextInvariant().size())
17153          res.getContextInvariant().add(parseString(null));
17154        if (array.get(i) instanceof JsonObject) 
17155          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
17156      }
17157    };
17158    if (json.has("type"))
17159      res.setTypeElement(parseCode(json.get("type").getAsString()));
17160    if (json.has("_type"))
17161      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17162    if (json.has("baseDefinition"))
17163      res.setBaseDefinitionElement(parseUri(json.get("baseDefinition").getAsString()));
17164    if (json.has("_baseDefinition"))
17165      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
17166    if (json.has("derivation"))
17167      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
17168    if (json.has("_derivation"))
17169      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
17170    if (json.has("snapshot"))
17171      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
17172    if (json.has("differential"))
17173      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
17174  }
17175
17176  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17177    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
17178    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
17179    return res;
17180  }
17181
17182  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
17183    parseBackboneProperties(json, res);
17184    if (json.has("identity"))
17185      res.setIdentityElement(parseId(json.get("identity").getAsString()));
17186    if (json.has("_identity"))
17187      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
17188    if (json.has("uri"))
17189      res.setUriElement(parseUri(json.get("uri").getAsString()));
17190    if (json.has("_uri"))
17191      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
17192    if (json.has("name"))
17193      res.setNameElement(parseString(json.get("name").getAsString()));
17194    if (json.has("_name"))
17195      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17196    if (json.has("comment"))
17197      res.setCommentElement(parseString(json.get("comment").getAsString()));
17198    if (json.has("_comment"))
17199      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
17200  }
17201
17202  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17203    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
17204    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
17205    return res;
17206  }
17207
17208  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
17209    parseBackboneProperties(json, res);
17210    if (json.has("element")) {
17211      JsonArray array = json.getAsJsonArray("element");
17212      for (int i = 0; i < array.size(); i++) {
17213        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17214      }
17215    };
17216  }
17217
17218  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
17219    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
17220    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
17221    return res;
17222  }
17223
17224  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
17225    parseBackboneProperties(json, res);
17226    if (json.has("element")) {
17227      JsonArray array = json.getAsJsonArray("element");
17228      for (int i = 0; i < array.size(); i++) {
17229        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
17230      }
17231    };
17232  }
17233
17234  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
17235    StructureMap res = new StructureMap();
17236    parseStructureMapProperties(json, res);
17237    return res;
17238  }
17239
17240  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
17241    parseDomainResourceProperties(json, res);
17242    if (json.has("url"))
17243      res.setUrlElement(parseUri(json.get("url").getAsString()));
17244    if (json.has("_url"))
17245      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17246    if (json.has("identifier")) {
17247      JsonArray array = json.getAsJsonArray("identifier");
17248      for (int i = 0; i < array.size(); i++) {
17249        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17250      }
17251    };
17252    if (json.has("version"))
17253      res.setVersionElement(parseString(json.get("version").getAsString()));
17254    if (json.has("_version"))
17255      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17256    if (json.has("name"))
17257      res.setNameElement(parseString(json.get("name").getAsString()));
17258    if (json.has("_name"))
17259      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17260    if (json.has("title"))
17261      res.setTitleElement(parseString(json.get("title").getAsString()));
17262    if (json.has("_title"))
17263      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17264    if (json.has("status"))
17265      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17266    if (json.has("_status"))
17267      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17268    if (json.has("experimental"))
17269      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17270    if (json.has("_experimental"))
17271      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17272    if (json.has("date"))
17273      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17274    if (json.has("_date"))
17275      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17276    if (json.has("publisher"))
17277      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17278    if (json.has("_publisher"))
17279      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17280    if (json.has("contact")) {
17281      JsonArray array = json.getAsJsonArray("contact");
17282      for (int i = 0; i < array.size(); i++) {
17283        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17284      }
17285    };
17286    if (json.has("description"))
17287      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17288    if (json.has("_description"))
17289      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17290    if (json.has("useContext")) {
17291      JsonArray array = json.getAsJsonArray("useContext");
17292      for (int i = 0; i < array.size(); i++) {
17293        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17294      }
17295    };
17296    if (json.has("jurisdiction")) {
17297      JsonArray array = json.getAsJsonArray("jurisdiction");
17298      for (int i = 0; i < array.size(); i++) {
17299        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17300      }
17301    };
17302    if (json.has("purpose"))
17303      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17304    if (json.has("_purpose"))
17305      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17306    if (json.has("copyright"))
17307      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17308    if (json.has("_copyright"))
17309      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17310    if (json.has("structure")) {
17311      JsonArray array = json.getAsJsonArray("structure");
17312      for (int i = 0; i < array.size(); i++) {
17313        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
17314      }
17315    };
17316    if (json.has("import")) {
17317      JsonArray array = json.getAsJsonArray("import");
17318      for (int i = 0; i < array.size(); i++) {
17319        res.getImport().add(parseUri(array.get(i).getAsString()));
17320      }
17321    };
17322    if (json.has("_import")) {
17323      JsonArray array = json.getAsJsonArray("_import");
17324      for (int i = 0; i < array.size(); i++) {
17325        if (i == res.getImport().size())
17326          res.getImport().add(parseUri(null));
17327        if (array.get(i) instanceof JsonObject) 
17328          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
17329      }
17330    };
17331    if (json.has("group")) {
17332      JsonArray array = json.getAsJsonArray("group");
17333      for (int i = 0; i < array.size(); i++) {
17334        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
17335      }
17336    };
17337  }
17338
17339  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17340    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
17341    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
17342    return res;
17343  }
17344
17345  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
17346    parseBackboneProperties(json, res);
17347    if (json.has("url"))
17348      res.setUrlElement(parseUri(json.get("url").getAsString()));
17349    if (json.has("_url"))
17350      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17351    if (json.has("mode"))
17352      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
17353    if (json.has("_mode"))
17354      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
17355    if (json.has("alias"))
17356      res.setAliasElement(parseString(json.get("alias").getAsString()));
17357    if (json.has("_alias"))
17358      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
17359    if (json.has("documentation"))
17360      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17361    if (json.has("_documentation"))
17362      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17363  }
17364
17365  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17366    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
17367    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
17368    return res;
17369  }
17370
17371  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
17372    parseBackboneProperties(json, res);
17373    if (json.has("name"))
17374      res.setNameElement(parseId(json.get("name").getAsString()));
17375    if (json.has("_name"))
17376      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17377    if (json.has("extends"))
17378      res.setExtendsElement(parseId(json.get("extends").getAsString()));
17379    if (json.has("_extends"))
17380      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
17381    if (json.has("typeMode"))
17382      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
17383    if (json.has("_typeMode"))
17384      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
17385    if (json.has("documentation"))
17386      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17387    if (json.has("_documentation"))
17388      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17389    if (json.has("input")) {
17390      JsonArray array = json.getAsJsonArray("input");
17391      for (int i = 0; i < array.size(); i++) {
17392        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
17393      }
17394    };
17395    if (json.has("rule")) {
17396      JsonArray array = json.getAsJsonArray("rule");
17397      for (int i = 0; i < array.size(); i++) {
17398        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17399      }
17400    };
17401  }
17402
17403  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17404    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
17405    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
17406    return res;
17407  }
17408
17409  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
17410    parseBackboneProperties(json, res);
17411    if (json.has("name"))
17412      res.setNameElement(parseId(json.get("name").getAsString()));
17413    if (json.has("_name"))
17414      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17415    if (json.has("type"))
17416      res.setTypeElement(parseString(json.get("type").getAsString()));
17417    if (json.has("_type"))
17418      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17419    if (json.has("mode"))
17420      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
17421    if (json.has("_mode"))
17422      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
17423    if (json.has("documentation"))
17424      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17425    if (json.has("_documentation"))
17426      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17427  }
17428
17429  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17430    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
17431    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
17432    return res;
17433  }
17434
17435  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
17436    parseBackboneProperties(json, res);
17437    if (json.has("name"))
17438      res.setNameElement(parseId(json.get("name").getAsString()));
17439    if (json.has("_name"))
17440      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17441    if (json.has("source")) {
17442      JsonArray array = json.getAsJsonArray("source");
17443      for (int i = 0; i < array.size(); i++) {
17444        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
17445      }
17446    };
17447    if (json.has("target")) {
17448      JsonArray array = json.getAsJsonArray("target");
17449      for (int i = 0; i < array.size(); i++) {
17450        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
17451      }
17452    };
17453    if (json.has("rule")) {
17454      JsonArray array = json.getAsJsonArray("rule");
17455      for (int i = 0; i < array.size(); i++) {
17456        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
17457      }
17458    };
17459    if (json.has("dependent")) {
17460      JsonArray array = json.getAsJsonArray("dependent");
17461      for (int i = 0; i < array.size(); i++) {
17462        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
17463      }
17464    };
17465    if (json.has("documentation"))
17466      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
17467    if (json.has("_documentation"))
17468      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
17469  }
17470
17471  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17472    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
17473    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
17474    return res;
17475  }
17476
17477  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
17478    parseBackboneProperties(json, res);
17479    if (json.has("context"))
17480      res.setContextElement(parseId(json.get("context").getAsString()));
17481    if (json.has("_context"))
17482      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
17483    if (json.has("min"))
17484      res.setMinElement(parseInteger(json.get("min").getAsLong()));
17485    if (json.has("_min"))
17486      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
17487    if (json.has("max"))
17488      res.setMaxElement(parseString(json.get("max").getAsString()));
17489    if (json.has("_max"))
17490      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
17491    if (json.has("type"))
17492      res.setTypeElement(parseString(json.get("type").getAsString()));
17493    if (json.has("_type"))
17494      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17495    Type defaultValue = parseType("defaultValue", json);
17496    if (defaultValue != null)
17497      res.setDefaultValue(defaultValue);
17498    if (json.has("element"))
17499      res.setElementElement(parseString(json.get("element").getAsString()));
17500    if (json.has("_element"))
17501      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
17502    if (json.has("listMode"))
17503      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
17504    if (json.has("_listMode"))
17505      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
17506    if (json.has("variable"))
17507      res.setVariableElement(parseId(json.get("variable").getAsString()));
17508    if (json.has("_variable"))
17509      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
17510    if (json.has("condition"))
17511      res.setConditionElement(parseString(json.get("condition").getAsString()));
17512    if (json.has("_condition"))
17513      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
17514    if (json.has("check"))
17515      res.setCheckElement(parseString(json.get("check").getAsString()));
17516    if (json.has("_check"))
17517      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
17518  }
17519
17520  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17521    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
17522    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
17523    return res;
17524  }
17525
17526  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
17527    parseBackboneProperties(json, res);
17528    if (json.has("context"))
17529      res.setContextElement(parseId(json.get("context").getAsString()));
17530    if (json.has("_context"))
17531      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
17532    if (json.has("contextType"))
17533      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
17534    if (json.has("_contextType"))
17535      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
17536    if (json.has("element"))
17537      res.setElementElement(parseString(json.get("element").getAsString()));
17538    if (json.has("_element"))
17539      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
17540    if (json.has("variable"))
17541      res.setVariableElement(parseId(json.get("variable").getAsString()));
17542    if (json.has("_variable"))
17543      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
17544    if (json.has("listMode")) {
17545      JsonArray array = json.getAsJsonArray("listMode");
17546      for (int i = 0; i < array.size(); i++) {
17547        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17548      }
17549    };
17550    if (json.has("_listMode")) {
17551      JsonArray array = json.getAsJsonArray("_listMode");
17552      for (int i = 0; i < array.size(); i++) {
17553        if (i == res.getListMode().size())
17554          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
17555        if (array.get(i) instanceof JsonObject) 
17556          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
17557      }
17558    };
17559    if (json.has("listRuleId"))
17560      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
17561    if (json.has("_listRuleId"))
17562      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
17563    if (json.has("transform"))
17564      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
17565    if (json.has("_transform"))
17566      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
17567    if (json.has("parameter")) {
17568      JsonArray array = json.getAsJsonArray("parameter");
17569      for (int i = 0; i < array.size(); i++) {
17570        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
17571      }
17572    };
17573  }
17574
17575  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17576    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
17577    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
17578    return res;
17579  }
17580
17581  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
17582    parseBackboneProperties(json, res);
17583    Type value = parseType("value", json);
17584    if (value != null)
17585      res.setValue(value);
17586  }
17587
17588  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
17589    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
17590    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
17591    return res;
17592  }
17593
17594  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
17595    parseBackboneProperties(json, res);
17596    if (json.has("name"))
17597      res.setNameElement(parseId(json.get("name").getAsString()));
17598    if (json.has("_name"))
17599      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17600    if (json.has("variable")) {
17601      JsonArray array = json.getAsJsonArray("variable");
17602      for (int i = 0; i < array.size(); i++) {
17603        res.getVariable().add(parseString(array.get(i).getAsString()));
17604      }
17605    };
17606    if (json.has("_variable")) {
17607      JsonArray array = json.getAsJsonArray("_variable");
17608      for (int i = 0; i < array.size(); i++) {
17609        if (i == res.getVariable().size())
17610          res.getVariable().add(parseString(null));
17611        if (array.get(i) instanceof JsonObject) 
17612          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
17613      }
17614    };
17615  }
17616
17617  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
17618    Subscription res = new Subscription();
17619    parseSubscriptionProperties(json, res);
17620    return res;
17621  }
17622
17623  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
17624    parseDomainResourceProperties(json, res);
17625    if (json.has("status"))
17626      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
17627    if (json.has("_status"))
17628      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17629    if (json.has("contact")) {
17630      JsonArray array = json.getAsJsonArray("contact");
17631      for (int i = 0; i < array.size(); i++) {
17632        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
17633      }
17634    };
17635    if (json.has("end"))
17636      res.setEndElement(parseInstant(json.get("end").getAsString()));
17637    if (json.has("_end"))
17638      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
17639    if (json.has("reason"))
17640      res.setReasonElement(parseString(json.get("reason").getAsString()));
17641    if (json.has("_reason"))
17642      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
17643    if (json.has("criteria"))
17644      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
17645    if (json.has("_criteria"))
17646      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
17647    if (json.has("error"))
17648      res.setErrorElement(parseString(json.get("error").getAsString()));
17649    if (json.has("_error"))
17650      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
17651    if (json.has("channel"))
17652      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
17653    if (json.has("tag")) {
17654      JsonArray array = json.getAsJsonArray("tag");
17655      for (int i = 0; i < array.size(); i++) {
17656        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
17657      }
17658    };
17659  }
17660
17661  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
17662    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
17663    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
17664    return res;
17665  }
17666
17667  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
17668    parseBackboneProperties(json, res);
17669    if (json.has("type"))
17670      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
17671    if (json.has("_type"))
17672      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17673    if (json.has("endpoint"))
17674      res.setEndpointElement(parseUri(json.get("endpoint").getAsString()));
17675    if (json.has("_endpoint"))
17676      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
17677    if (json.has("payload"))
17678      res.setPayloadElement(parseString(json.get("payload").getAsString()));
17679    if (json.has("_payload"))
17680      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
17681    if (json.has("header")) {
17682      JsonArray array = json.getAsJsonArray("header");
17683      for (int i = 0; i < array.size(); i++) {
17684        res.getHeader().add(parseString(array.get(i).getAsString()));
17685      }
17686    };
17687    if (json.has("_header")) {
17688      JsonArray array = json.getAsJsonArray("_header");
17689      for (int i = 0; i < array.size(); i++) {
17690        if (i == res.getHeader().size())
17691          res.getHeader().add(parseString(null));
17692        if (array.get(i) instanceof JsonObject) 
17693          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
17694      }
17695    };
17696  }
17697
17698  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
17699    Substance res = new Substance();
17700    parseSubstanceProperties(json, res);
17701    return res;
17702  }
17703
17704  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
17705    parseDomainResourceProperties(json, res);
17706    if (json.has("identifier")) {
17707      JsonArray array = json.getAsJsonArray("identifier");
17708      for (int i = 0; i < array.size(); i++) {
17709        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17710      }
17711    };
17712    if (json.has("status"))
17713      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
17714    if (json.has("_status"))
17715      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17716    if (json.has("category")) {
17717      JsonArray array = json.getAsJsonArray("category");
17718      for (int i = 0; i < array.size(); i++) {
17719        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17720      }
17721    };
17722    if (json.has("code"))
17723      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17724    if (json.has("description"))
17725      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17726    if (json.has("_description"))
17727      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17728    if (json.has("instance")) {
17729      JsonArray array = json.getAsJsonArray("instance");
17730      for (int i = 0; i < array.size(); i++) {
17731        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
17732      }
17733    };
17734    if (json.has("ingredient")) {
17735      JsonArray array = json.getAsJsonArray("ingredient");
17736      for (int i = 0; i < array.size(); i++) {
17737        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
17738      }
17739    };
17740  }
17741
17742  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
17743    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
17744    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
17745    return res;
17746  }
17747
17748  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
17749    parseBackboneProperties(json, res);
17750    if (json.has("identifier"))
17751      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17752    if (json.has("expiry"))
17753      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
17754    if (json.has("_expiry"))
17755      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
17756    if (json.has("quantity"))
17757      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
17758  }
17759
17760  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
17761    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
17762    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
17763    return res;
17764  }
17765
17766  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
17767    parseBackboneProperties(json, res);
17768    if (json.has("quantity"))
17769      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
17770    Type substance = parseType("substance", json);
17771    if (substance != null)
17772      res.setSubstance(substance);
17773  }
17774
17775  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
17776    SupplyDelivery res = new SupplyDelivery();
17777    parseSupplyDeliveryProperties(json, res);
17778    return res;
17779  }
17780
17781  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
17782    parseDomainResourceProperties(json, res);
17783    if (json.has("identifier"))
17784      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17785    if (json.has("basedOn")) {
17786      JsonArray array = json.getAsJsonArray("basedOn");
17787      for (int i = 0; i < array.size(); i++) {
17788        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17789      }
17790    };
17791    if (json.has("partOf")) {
17792      JsonArray array = json.getAsJsonArray("partOf");
17793      for (int i = 0; i < array.size(); i++) {
17794        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17795      }
17796    };
17797    if (json.has("status"))
17798      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
17799    if (json.has("_status"))
17800      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17801    if (json.has("patient"))
17802      res.setPatient(parseReference(json.getAsJsonObject("patient")));
17803    if (json.has("type"))
17804      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17805    if (json.has("suppliedItem"))
17806      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
17807    Type occurrence = parseType("occurrence", json);
17808    if (occurrence != null)
17809      res.setOccurrence(occurrence);
17810    if (json.has("supplier"))
17811      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
17812    if (json.has("destination"))
17813      res.setDestination(parseReference(json.getAsJsonObject("destination")));
17814    if (json.has("receiver")) {
17815      JsonArray array = json.getAsJsonArray("receiver");
17816      for (int i = 0; i < array.size(); i++) {
17817        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
17818      }
17819    };
17820  }
17821
17822  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
17823    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
17824    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
17825    return res;
17826  }
17827
17828  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
17829    parseBackboneProperties(json, res);
17830    if (json.has("quantity"))
17831      res.setQuantity(parseSimpleQuantity(json.getAsJsonObject("quantity")));
17832    Type item = parseType("item", json);
17833    if (item != null)
17834      res.setItem(item);
17835  }
17836
17837  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
17838    SupplyRequest res = new SupplyRequest();
17839    parseSupplyRequestProperties(json, res);
17840    return res;
17841  }
17842
17843  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
17844    parseDomainResourceProperties(json, res);
17845    if (json.has("identifier"))
17846      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17847    if (json.has("status"))
17848      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
17849    if (json.has("_status"))
17850      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17851    if (json.has("category"))
17852      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
17853    if (json.has("priority"))
17854      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
17855    if (json.has("_priority"))
17856      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
17857    if (json.has("orderedItem"))
17858      res.setOrderedItem(parseSupplyRequestSupplyRequestOrderedItemComponent(json.getAsJsonObject("orderedItem"), res));
17859    Type occurrence = parseType("occurrence", json);
17860    if (occurrence != null)
17861      res.setOccurrence(occurrence);
17862    if (json.has("authoredOn"))
17863      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17864    if (json.has("_authoredOn"))
17865      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
17866    if (json.has("requester"))
17867      res.setRequester(parseSupplyRequestSupplyRequestRequesterComponent(json.getAsJsonObject("requester"), res));
17868    if (json.has("supplier")) {
17869      JsonArray array = json.getAsJsonArray("supplier");
17870      for (int i = 0; i < array.size(); i++) {
17871        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
17872      }
17873    };
17874    Type reason = parseType("reason", json);
17875    if (reason != null)
17876      res.setReason(reason);
17877    if (json.has("deliverFrom"))
17878      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
17879    if (json.has("deliverTo"))
17880      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
17881  }
17882
17883  protected SupplyRequest.SupplyRequestOrderedItemComponent parseSupplyRequestSupplyRequestOrderedItemComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
17884    SupplyRequest.SupplyRequestOrderedItemComponent res = new SupplyRequest.SupplyRequestOrderedItemComponent();
17885    parseSupplyRequestSupplyRequestOrderedItemComponentProperties(json, owner, res);
17886    return res;
17887  }
17888
17889  protected void parseSupplyRequestSupplyRequestOrderedItemComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestOrderedItemComponent res) throws IOException, FHIRFormatError {
17890    parseBackboneProperties(json, res);
17891    if (json.has("quantity"))
17892      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17893    Type item = parseType("item", json);
17894    if (item != null)
17895      res.setItem(item);
17896  }
17897
17898  protected SupplyRequest.SupplyRequestRequesterComponent parseSupplyRequestSupplyRequestRequesterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
17899    SupplyRequest.SupplyRequestRequesterComponent res = new SupplyRequest.SupplyRequestRequesterComponent();
17900    parseSupplyRequestSupplyRequestRequesterComponentProperties(json, owner, res);
17901    return res;
17902  }
17903
17904  protected void parseSupplyRequestSupplyRequestRequesterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestRequesterComponent res) throws IOException, FHIRFormatError {
17905    parseBackboneProperties(json, res);
17906    if (json.has("agent"))
17907      res.setAgent(parseReference(json.getAsJsonObject("agent")));
17908    if (json.has("onBehalfOf"))
17909      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
17910  }
17911
17912  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
17913    Task res = new Task();
17914    parseTaskProperties(json, res);
17915    return res;
17916  }
17917
17918  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
17919    parseDomainResourceProperties(json, res);
17920    if (json.has("identifier")) {
17921      JsonArray array = json.getAsJsonArray("identifier");
17922      for (int i = 0; i < array.size(); i++) {
17923        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17924      }
17925    };
17926    Type definition = parseType("definition", json);
17927    if (definition != null)
17928      res.setDefinition(definition);
17929    if (json.has("basedOn")) {
17930      JsonArray array = json.getAsJsonArray("basedOn");
17931      for (int i = 0; i < array.size(); i++) {
17932        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
17933      }
17934    };
17935    if (json.has("groupIdentifier"))
17936      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
17937    if (json.has("partOf")) {
17938      JsonArray array = json.getAsJsonArray("partOf");
17939      for (int i = 0; i < array.size(); i++) {
17940        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
17941      }
17942    };
17943    if (json.has("status"))
17944      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
17945    if (json.has("_status"))
17946      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17947    if (json.has("statusReason"))
17948      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
17949    if (json.has("businessStatus"))
17950      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
17951    if (json.has("intent"))
17952      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
17953    if (json.has("_intent"))
17954      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
17955    if (json.has("priority"))
17956      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
17957    if (json.has("_priority"))
17958      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
17959    if (json.has("code"))
17960      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17961    if (json.has("description"))
17962      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17963    if (json.has("_description"))
17964      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17965    if (json.has("focus"))
17966      res.setFocus(parseReference(json.getAsJsonObject("focus")));
17967    if (json.has("for"))
17968      res.setFor(parseReference(json.getAsJsonObject("for")));
17969    if (json.has("context"))
17970      res.setContext(parseReference(json.getAsJsonObject("context")));
17971    if (json.has("executionPeriod"))
17972      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
17973    if (json.has("authoredOn"))
17974      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
17975    if (json.has("_authoredOn"))
17976      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
17977    if (json.has("lastModified"))
17978      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
17979    if (json.has("_lastModified"))
17980      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
17981    if (json.has("requester"))
17982      res.setRequester(parseTaskTaskRequesterComponent(json.getAsJsonObject("requester"), res));
17983    if (json.has("performerType")) {
17984      JsonArray array = json.getAsJsonArray("performerType");
17985      for (int i = 0; i < array.size(); i++) {
17986        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17987      }
17988    };
17989    if (json.has("owner"))
17990      res.setOwner(parseReference(json.getAsJsonObject("owner")));
17991    if (json.has("reason"))
17992      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
17993    if (json.has("note")) {
17994      JsonArray array = json.getAsJsonArray("note");
17995      for (int i = 0; i < array.size(); i++) {
17996        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17997      }
17998    };
17999    if (json.has("relevantHistory")) {
18000      JsonArray array = json.getAsJsonArray("relevantHistory");
18001      for (int i = 0; i < array.size(); i++) {
18002        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
18003      }
18004    };
18005    if (json.has("restriction"))
18006      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
18007    if (json.has("input")) {
18008      JsonArray array = json.getAsJsonArray("input");
18009      for (int i = 0; i < array.size(); i++) {
18010        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
18011      }
18012    };
18013    if (json.has("output")) {
18014      JsonArray array = json.getAsJsonArray("output");
18015      for (int i = 0; i < array.size(); i++) {
18016        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
18017      }
18018    };
18019  }
18020
18021  protected Task.TaskRequesterComponent parseTaskTaskRequesterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18022    Task.TaskRequesterComponent res = new Task.TaskRequesterComponent();
18023    parseTaskTaskRequesterComponentProperties(json, owner, res);
18024    return res;
18025  }
18026
18027  protected void parseTaskTaskRequesterComponentProperties(JsonObject json, Task owner, Task.TaskRequesterComponent res) throws IOException, FHIRFormatError {
18028    parseBackboneProperties(json, res);
18029    if (json.has("agent"))
18030      res.setAgent(parseReference(json.getAsJsonObject("agent")));
18031    if (json.has("onBehalfOf"))
18032      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
18033  }
18034
18035  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18036    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
18037    parseTaskTaskRestrictionComponentProperties(json, owner, res);
18038    return res;
18039  }
18040
18041  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
18042    parseBackboneProperties(json, res);
18043    if (json.has("repetitions"))
18044      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
18045    if (json.has("_repetitions"))
18046      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
18047    if (json.has("period"))
18048      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18049    if (json.has("recipient")) {
18050      JsonArray array = json.getAsJsonArray("recipient");
18051      for (int i = 0; i < array.size(); i++) {
18052        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
18053      }
18054    };
18055  }
18056
18057  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18058    Task.ParameterComponent res = new Task.ParameterComponent();
18059    parseTaskParameterComponentProperties(json, owner, res);
18060    return res;
18061  }
18062
18063  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
18064    parseBackboneProperties(json, res);
18065    if (json.has("type"))
18066      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18067    Type value = parseType("value", json);
18068    if (value != null)
18069      res.setValue(value);
18070  }
18071
18072  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
18073    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
18074    parseTaskTaskOutputComponentProperties(json, owner, res);
18075    return res;
18076  }
18077
18078  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
18079    parseBackboneProperties(json, res);
18080    if (json.has("type"))
18081      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18082    Type value = parseType("value", json);
18083    if (value != null)
18084      res.setValue(value);
18085  }
18086
18087  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
18088    TestReport res = new TestReport();
18089    parseTestReportProperties(json, res);
18090    return res;
18091  }
18092
18093  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
18094    parseDomainResourceProperties(json, res);
18095    if (json.has("identifier"))
18096      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
18097    if (json.has("name"))
18098      res.setNameElement(parseString(json.get("name").getAsString()));
18099    if (json.has("_name"))
18100      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18101    if (json.has("status"))
18102      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
18103    if (json.has("_status"))
18104      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18105    if (json.has("testScript"))
18106      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
18107    if (json.has("result"))
18108      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
18109    if (json.has("_result"))
18110      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18111    if (json.has("score"))
18112      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
18113    if (json.has("_score"))
18114      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
18115    if (json.has("tester"))
18116      res.setTesterElement(parseString(json.get("tester").getAsString()));
18117    if (json.has("_tester"))
18118      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
18119    if (json.has("issued"))
18120      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
18121    if (json.has("_issued"))
18122      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
18123    if (json.has("participant")) {
18124      JsonArray array = json.getAsJsonArray("participant");
18125      for (int i = 0; i < array.size(); i++) {
18126        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
18127      }
18128    };
18129    if (json.has("setup"))
18130      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
18131    if (json.has("test")) {
18132      JsonArray array = json.getAsJsonArray("test");
18133      for (int i = 0; i < array.size(); i++) {
18134        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
18135      }
18136    };
18137    if (json.has("teardown"))
18138      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
18139  }
18140
18141  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18142    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
18143    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
18144    return res;
18145  }
18146
18147  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
18148    parseBackboneProperties(json, res);
18149    if (json.has("type"))
18150      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
18151    if (json.has("_type"))
18152      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18153    if (json.has("uri"))
18154      res.setUriElement(parseUri(json.get("uri").getAsString()));
18155    if (json.has("_uri"))
18156      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
18157    if (json.has("display"))
18158      res.setDisplayElement(parseString(json.get("display").getAsString()));
18159    if (json.has("_display"))
18160      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
18161  }
18162
18163  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18164    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
18165    parseTestReportTestReportSetupComponentProperties(json, owner, res);
18166    return res;
18167  }
18168
18169  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
18170    parseBackboneProperties(json, res);
18171    if (json.has("action")) {
18172      JsonArray array = json.getAsJsonArray("action");
18173      for (int i = 0; i < array.size(); i++) {
18174        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
18175      }
18176    };
18177  }
18178
18179  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18180    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
18181    parseTestReportSetupActionComponentProperties(json, owner, res);
18182    return res;
18183  }
18184
18185  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
18186    parseBackboneProperties(json, res);
18187    if (json.has("operation"))
18188      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18189    if (json.has("assert"))
18190      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18191  }
18192
18193  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18194    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
18195    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
18196    return res;
18197  }
18198
18199  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
18200    parseBackboneProperties(json, res);
18201    if (json.has("result"))
18202      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18203    if (json.has("_result"))
18204      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18205    if (json.has("message"))
18206      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18207    if (json.has("_message"))
18208      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18209    if (json.has("detail"))
18210      res.setDetailElement(parseUri(json.get("detail").getAsString()));
18211    if (json.has("_detail"))
18212      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
18213  }
18214
18215  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18216    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
18217    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
18218    return res;
18219  }
18220
18221  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
18222    parseBackboneProperties(json, res);
18223    if (json.has("result"))
18224      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
18225    if (json.has("_result"))
18226      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
18227    if (json.has("message"))
18228      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
18229    if (json.has("_message"))
18230      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
18231    if (json.has("detail"))
18232      res.setDetailElement(parseString(json.get("detail").getAsString()));
18233    if (json.has("_detail"))
18234      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
18235  }
18236
18237  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18238    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
18239    parseTestReportTestReportTestComponentProperties(json, owner, res);
18240    return res;
18241  }
18242
18243  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
18244    parseBackboneProperties(json, res);
18245    if (json.has("name"))
18246      res.setNameElement(parseString(json.get("name").getAsString()));
18247    if (json.has("_name"))
18248      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18249    if (json.has("description"))
18250      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18251    if (json.has("_description"))
18252      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18253    if (json.has("action")) {
18254      JsonArray array = json.getAsJsonArray("action");
18255      for (int i = 0; i < array.size(); i++) {
18256        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
18257      }
18258    };
18259  }
18260
18261  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18262    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
18263    parseTestReportTestActionComponentProperties(json, owner, res);
18264    return res;
18265  }
18266
18267  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
18268    parseBackboneProperties(json, res);
18269    if (json.has("operation"))
18270      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18271    if (json.has("assert"))
18272      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18273  }
18274
18275  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18276    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
18277    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
18278    return res;
18279  }
18280
18281  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
18282    parseBackboneProperties(json, res);
18283    if (json.has("action")) {
18284      JsonArray array = json.getAsJsonArray("action");
18285      for (int i = 0; i < array.size(); i++) {
18286        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
18287      }
18288    };
18289  }
18290
18291  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
18292    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
18293    parseTestReportTeardownActionComponentProperties(json, owner, res);
18294    return res;
18295  }
18296
18297  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
18298    parseBackboneProperties(json, res);
18299    if (json.has("operation"))
18300      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18301  }
18302
18303  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
18304    TestScript res = new TestScript();
18305    parseTestScriptProperties(json, res);
18306    return res;
18307  }
18308
18309  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
18310    parseDomainResourceProperties(json, res);
18311    if (json.has("url"))
18312      res.setUrlElement(parseUri(json.get("url").getAsString()));
18313    if (json.has("_url"))
18314      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18315    if (json.has("identifier"))
18316      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
18317    if (json.has("version"))
18318      res.setVersionElement(parseString(json.get("version").getAsString()));
18319    if (json.has("_version"))
18320      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18321    if (json.has("name"))
18322      res.setNameElement(parseString(json.get("name").getAsString()));
18323    if (json.has("_name"))
18324      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18325    if (json.has("title"))
18326      res.setTitleElement(parseString(json.get("title").getAsString()));
18327    if (json.has("_title"))
18328      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18329    if (json.has("status"))
18330      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18331    if (json.has("_status"))
18332      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18333    if (json.has("experimental"))
18334      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18335    if (json.has("_experimental"))
18336      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18337    if (json.has("date"))
18338      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18339    if (json.has("_date"))
18340      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18341    if (json.has("publisher"))
18342      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18343    if (json.has("_publisher"))
18344      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18345    if (json.has("contact")) {
18346      JsonArray array = json.getAsJsonArray("contact");
18347      for (int i = 0; i < array.size(); i++) {
18348        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18349      }
18350    };
18351    if (json.has("description"))
18352      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18353    if (json.has("_description"))
18354      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18355    if (json.has("useContext")) {
18356      JsonArray array = json.getAsJsonArray("useContext");
18357      for (int i = 0; i < array.size(); i++) {
18358        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18359      }
18360    };
18361    if (json.has("jurisdiction")) {
18362      JsonArray array = json.getAsJsonArray("jurisdiction");
18363      for (int i = 0; i < array.size(); i++) {
18364        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18365      }
18366    };
18367    if (json.has("purpose"))
18368      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18369    if (json.has("_purpose"))
18370      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18371    if (json.has("copyright"))
18372      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
18373    if (json.has("_copyright"))
18374      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
18375    if (json.has("origin")) {
18376      JsonArray array = json.getAsJsonArray("origin");
18377      for (int i = 0; i < array.size(); i++) {
18378        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
18379      }
18380    };
18381    if (json.has("destination")) {
18382      JsonArray array = json.getAsJsonArray("destination");
18383      for (int i = 0; i < array.size(); i++) {
18384        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
18385      }
18386    };
18387    if (json.has("metadata"))
18388      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
18389    if (json.has("fixture")) {
18390      JsonArray array = json.getAsJsonArray("fixture");
18391      for (int i = 0; i < array.size(); i++) {
18392        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
18393      }
18394    };
18395    if (json.has("profile")) {
18396      JsonArray array = json.getAsJsonArray("profile");
18397      for (int i = 0; i < array.size(); i++) {
18398        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
18399      }
18400    };
18401    if (json.has("variable")) {
18402      JsonArray array = json.getAsJsonArray("variable");
18403      for (int i = 0; i < array.size(); i++) {
18404        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
18405      }
18406    };
18407    if (json.has("rule")) {
18408      JsonArray array = json.getAsJsonArray("rule");
18409      for (int i = 0; i < array.size(); i++) {
18410        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
18411      }
18412    };
18413    if (json.has("ruleset")) {
18414      JsonArray array = json.getAsJsonArray("ruleset");
18415      for (int i = 0; i < array.size(); i++) {
18416        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
18417      }
18418    };
18419    if (json.has("setup"))
18420      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
18421    if (json.has("test")) {
18422      JsonArray array = json.getAsJsonArray("test");
18423      for (int i = 0; i < array.size(); i++) {
18424        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
18425      }
18426    };
18427    if (json.has("teardown"))
18428      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
18429  }
18430
18431  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18432    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
18433    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
18434    return res;
18435  }
18436
18437  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
18438    parseBackboneProperties(json, res);
18439    if (json.has("index"))
18440      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18441    if (json.has("_index"))
18442      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
18443    if (json.has("profile"))
18444      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
18445  }
18446
18447  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18448    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
18449    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
18450    return res;
18451  }
18452
18453  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
18454    parseBackboneProperties(json, res);
18455    if (json.has("index"))
18456      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
18457    if (json.has("_index"))
18458      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
18459    if (json.has("profile"))
18460      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
18461  }
18462
18463  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18464    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
18465    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
18466    return res;
18467  }
18468
18469  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
18470    parseBackboneProperties(json, res);
18471    if (json.has("link")) {
18472      JsonArray array = json.getAsJsonArray("link");
18473      for (int i = 0; i < array.size(); i++) {
18474        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
18475      }
18476    };
18477    if (json.has("capability")) {
18478      JsonArray array = json.getAsJsonArray("capability");
18479      for (int i = 0; i < array.size(); i++) {
18480        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
18481      }
18482    };
18483  }
18484
18485  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18486    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
18487    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
18488    return res;
18489  }
18490
18491  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
18492    parseBackboneProperties(json, res);
18493    if (json.has("url"))
18494      res.setUrlElement(parseUri(json.get("url").getAsString()));
18495    if (json.has("_url"))
18496      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18497    if (json.has("description"))
18498      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18499    if (json.has("_description"))
18500      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18501  }
18502
18503  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18504    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
18505    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
18506    return res;
18507  }
18508
18509  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
18510    parseBackboneProperties(json, res);
18511    if (json.has("required"))
18512      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
18513    if (json.has("_required"))
18514      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
18515    if (json.has("validated"))
18516      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
18517    if (json.has("_validated"))
18518      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
18519    if (json.has("description"))
18520      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18521    if (json.has("_description"))
18522      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18523    if (json.has("origin")) {
18524      JsonArray array = json.getAsJsonArray("origin");
18525      for (int i = 0; i < array.size(); i++) {
18526        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
18527      }
18528    };
18529    if (json.has("_origin")) {
18530      JsonArray array = json.getAsJsonArray("_origin");
18531      for (int i = 0; i < array.size(); i++) {
18532        if (i == res.getOrigin().size())
18533          res.getOrigin().add(parseInteger(null));
18534        if (array.get(i) instanceof JsonObject) 
18535          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
18536      }
18537    };
18538    if (json.has("destination"))
18539      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
18540    if (json.has("_destination"))
18541      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
18542    if (json.has("link")) {
18543      JsonArray array = json.getAsJsonArray("link");
18544      for (int i = 0; i < array.size(); i++) {
18545        res.getLink().add(parseUri(array.get(i).getAsString()));
18546      }
18547    };
18548    if (json.has("_link")) {
18549      JsonArray array = json.getAsJsonArray("_link");
18550      for (int i = 0; i < array.size(); i++) {
18551        if (i == res.getLink().size())
18552          res.getLink().add(parseUri(null));
18553        if (array.get(i) instanceof JsonObject) 
18554          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
18555      }
18556    };
18557    if (json.has("capabilities"))
18558      res.setCapabilities(parseReference(json.getAsJsonObject("capabilities")));
18559  }
18560
18561  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18562    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
18563    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
18564    return res;
18565  }
18566
18567  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
18568    parseBackboneProperties(json, res);
18569    if (json.has("autocreate"))
18570      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
18571    if (json.has("_autocreate"))
18572      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
18573    if (json.has("autodelete"))
18574      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
18575    if (json.has("_autodelete"))
18576      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
18577    if (json.has("resource"))
18578      res.setResource(parseReference(json.getAsJsonObject("resource")));
18579  }
18580
18581  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18582    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
18583    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
18584    return res;
18585  }
18586
18587  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
18588    parseBackboneProperties(json, res);
18589    if (json.has("name"))
18590      res.setNameElement(parseString(json.get("name").getAsString()));
18591    if (json.has("_name"))
18592      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18593    if (json.has("defaultValue"))
18594      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
18595    if (json.has("_defaultValue"))
18596      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
18597    if (json.has("description"))
18598      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18599    if (json.has("_description"))
18600      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18601    if (json.has("expression"))
18602      res.setExpressionElement(parseString(json.get("expression").getAsString()));
18603    if (json.has("_expression"))
18604      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
18605    if (json.has("headerField"))
18606      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
18607    if (json.has("_headerField"))
18608      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
18609    if (json.has("hint"))
18610      res.setHintElement(parseString(json.get("hint").getAsString()));
18611    if (json.has("_hint"))
18612      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
18613    if (json.has("path"))
18614      res.setPathElement(parseString(json.get("path").getAsString()));
18615    if (json.has("_path"))
18616      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
18617    if (json.has("sourceId"))
18618      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18619    if (json.has("_sourceId"))
18620      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18621  }
18622
18623  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18624    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
18625    parseTestScriptTestScriptRuleComponentProperties(json, owner, res);
18626    return res;
18627  }
18628
18629  protected void parseTestScriptTestScriptRuleComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRuleComponent res) throws IOException, FHIRFormatError {
18630    parseBackboneProperties(json, res);
18631    if (json.has("resource"))
18632      res.setResource(parseReference(json.getAsJsonObject("resource")));
18633    if (json.has("param")) {
18634      JsonArray array = json.getAsJsonArray("param");
18635      for (int i = 0; i < array.size(); i++) {
18636        res.getParam().add(parseTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18637      }
18638    };
18639  }
18640
18641  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18642    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
18643    parseTestScriptRuleParamComponentProperties(json, owner, res);
18644    return res;
18645  }
18646
18647  protected void parseTestScriptRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RuleParamComponent res) throws IOException, FHIRFormatError {
18648    parseBackboneProperties(json, res);
18649    if (json.has("name"))
18650      res.setNameElement(parseString(json.get("name").getAsString()));
18651    if (json.has("_name"))
18652      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18653    if (json.has("value"))
18654      res.setValueElement(parseString(json.get("value").getAsString()));
18655    if (json.has("_value"))
18656      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18657  }
18658
18659  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18660    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
18661    parseTestScriptTestScriptRulesetComponentProperties(json, owner, res);
18662    return res;
18663  }
18664
18665  protected void parseTestScriptTestScriptRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRulesetComponent res) throws IOException, FHIRFormatError {
18666    parseBackboneProperties(json, res);
18667    if (json.has("resource"))
18668      res.setResource(parseReference(json.getAsJsonObject("resource")));
18669    if (json.has("rule")) {
18670      JsonArray array = json.getAsJsonArray("rule");
18671      for (int i = 0; i < array.size(); i++) {
18672        res.getRule().add(parseTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
18673      }
18674    };
18675  }
18676
18677  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18678    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
18679    parseTestScriptRulesetRuleComponentProperties(json, owner, res);
18680    return res;
18681  }
18682
18683  protected void parseTestScriptRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleComponent res) throws IOException, FHIRFormatError {
18684    parseBackboneProperties(json, res);
18685    if (json.has("ruleId"))
18686      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
18687    if (json.has("_ruleId"))
18688      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
18689    if (json.has("param")) {
18690      JsonArray array = json.getAsJsonArray("param");
18691      for (int i = 0; i < array.size(); i++) {
18692        res.getParam().add(parseTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18693      }
18694    };
18695  }
18696
18697  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18698    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
18699    parseTestScriptRulesetRuleParamComponentProperties(json, owner, res);
18700    return res;
18701  }
18702
18703  protected void parseTestScriptRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleParamComponent res) throws IOException, FHIRFormatError {
18704    parseBackboneProperties(json, res);
18705    if (json.has("name"))
18706      res.setNameElement(parseString(json.get("name").getAsString()));
18707    if (json.has("_name"))
18708      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18709    if (json.has("value"))
18710      res.setValueElement(parseString(json.get("value").getAsString()));
18711    if (json.has("_value"))
18712      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18713  }
18714
18715  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18716    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
18717    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
18718    return res;
18719  }
18720
18721  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
18722    parseBackboneProperties(json, res);
18723    if (json.has("action")) {
18724      JsonArray array = json.getAsJsonArray("action");
18725      for (int i = 0; i < array.size(); i++) {
18726        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
18727      }
18728    };
18729  }
18730
18731  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18732    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
18733    parseTestScriptSetupActionComponentProperties(json, owner, res);
18734    return res;
18735  }
18736
18737  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
18738    parseBackboneProperties(json, res);
18739    if (json.has("operation"))
18740      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
18741    if (json.has("assert"))
18742      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
18743  }
18744
18745  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18746    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
18747    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
18748    return res;
18749  }
18750
18751  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
18752    parseBackboneProperties(json, res);
18753    if (json.has("type"))
18754      res.setType(parseCoding(json.getAsJsonObject("type")));
18755    if (json.has("resource"))
18756      res.setResourceElement(parseCode(json.get("resource").getAsString()));
18757    if (json.has("_resource"))
18758      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
18759    if (json.has("label"))
18760      res.setLabelElement(parseString(json.get("label").getAsString()));
18761    if (json.has("_label"))
18762      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
18763    if (json.has("description"))
18764      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18765    if (json.has("_description"))
18766      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18767    if (json.has("accept"))
18768      res.setAcceptElement(parseEnumeration(json.get("accept").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18769    if (json.has("_accept"))
18770      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
18771    if (json.has("contentType"))
18772      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18773    if (json.has("_contentType"))
18774      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
18775    if (json.has("destination"))
18776      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
18777    if (json.has("_destination"))
18778      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
18779    if (json.has("encodeRequestUrl"))
18780      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
18781    if (json.has("_encodeRequestUrl"))
18782      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
18783    if (json.has("origin"))
18784      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
18785    if (json.has("_origin"))
18786      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
18787    if (json.has("params"))
18788      res.setParamsElement(parseString(json.get("params").getAsString()));
18789    if (json.has("_params"))
18790      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
18791    if (json.has("requestHeader")) {
18792      JsonArray array = json.getAsJsonArray("requestHeader");
18793      for (int i = 0; i < array.size(); i++) {
18794        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
18795      }
18796    };
18797    if (json.has("requestId"))
18798      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
18799    if (json.has("_requestId"))
18800      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
18801    if (json.has("responseId"))
18802      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
18803    if (json.has("_responseId"))
18804      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
18805    if (json.has("sourceId"))
18806      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18807    if (json.has("_sourceId"))
18808      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18809    if (json.has("targetId"))
18810      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
18811    if (json.has("_targetId"))
18812      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
18813    if (json.has("url"))
18814      res.setUrlElement(parseString(json.get("url").getAsString()));
18815    if (json.has("_url"))
18816      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18817  }
18818
18819  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18820    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
18821    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
18822    return res;
18823  }
18824
18825  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
18826    parseBackboneProperties(json, res);
18827    if (json.has("field"))
18828      res.setFieldElement(parseString(json.get("field").getAsString()));
18829    if (json.has("_field"))
18830      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
18831    if (json.has("value"))
18832      res.setValueElement(parseString(json.get("value").getAsString()));
18833    if (json.has("_value"))
18834      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18835  }
18836
18837  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18838    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
18839    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
18840    return res;
18841  }
18842
18843  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
18844    parseBackboneProperties(json, res);
18845    if (json.has("label"))
18846      res.setLabelElement(parseString(json.get("label").getAsString()));
18847    if (json.has("_label"))
18848      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
18849    if (json.has("description"))
18850      res.setDescriptionElement(parseString(json.get("description").getAsString()));
18851    if (json.has("_description"))
18852      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18853    if (json.has("direction"))
18854      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
18855    if (json.has("_direction"))
18856      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
18857    if (json.has("compareToSourceId"))
18858      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
18859    if (json.has("_compareToSourceId"))
18860      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
18861    if (json.has("compareToSourceExpression"))
18862      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
18863    if (json.has("_compareToSourceExpression"))
18864      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
18865    if (json.has("compareToSourcePath"))
18866      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
18867    if (json.has("_compareToSourcePath"))
18868      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
18869    if (json.has("contentType"))
18870      res.setContentTypeElement(parseEnumeration(json.get("contentType").getAsString(), TestScript.ContentType.NULL, new TestScript.ContentTypeEnumFactory()));
18871    if (json.has("_contentType"))
18872      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
18873    if (json.has("expression"))
18874      res.setExpressionElement(parseString(json.get("expression").getAsString()));
18875    if (json.has("_expression"))
18876      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
18877    if (json.has("headerField"))
18878      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
18879    if (json.has("_headerField"))
18880      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
18881    if (json.has("minimumId"))
18882      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
18883    if (json.has("_minimumId"))
18884      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
18885    if (json.has("navigationLinks"))
18886      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
18887    if (json.has("_navigationLinks"))
18888      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
18889    if (json.has("operator"))
18890      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
18891    if (json.has("_operator"))
18892      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
18893    if (json.has("path"))
18894      res.setPathElement(parseString(json.get("path").getAsString()));
18895    if (json.has("_path"))
18896      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
18897    if (json.has("requestMethod"))
18898      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
18899    if (json.has("_requestMethod"))
18900      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
18901    if (json.has("requestURL"))
18902      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
18903    if (json.has("_requestURL"))
18904      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
18905    if (json.has("resource"))
18906      res.setResourceElement(parseCode(json.get("resource").getAsString()));
18907    if (json.has("_resource"))
18908      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
18909    if (json.has("response"))
18910      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
18911    if (json.has("_response"))
18912      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
18913    if (json.has("responseCode"))
18914      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
18915    if (json.has("_responseCode"))
18916      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
18917    if (json.has("rule"))
18918      res.setRule(parseTestScriptActionAssertRuleComponent(json.getAsJsonObject("rule"), owner));
18919    if (json.has("ruleset"))
18920      res.setRuleset(parseTestScriptActionAssertRulesetComponent(json.getAsJsonObject("ruleset"), owner));
18921    if (json.has("sourceId"))
18922      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
18923    if (json.has("_sourceId"))
18924      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18925    if (json.has("validateProfileId"))
18926      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
18927    if (json.has("_validateProfileId"))
18928      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
18929    if (json.has("value"))
18930      res.setValueElement(parseString(json.get("value").getAsString()));
18931    if (json.has("_value"))
18932      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18933    if (json.has("warningOnly"))
18934      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
18935    if (json.has("_warningOnly"))
18936      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
18937  }
18938
18939  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18940    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
18941    parseTestScriptActionAssertRuleComponentProperties(json, owner, res);
18942    return res;
18943  }
18944
18945  protected void parseTestScriptActionAssertRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleComponent res) throws IOException, FHIRFormatError {
18946    parseBackboneProperties(json, res);
18947    if (json.has("ruleId"))
18948      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
18949    if (json.has("_ruleId"))
18950      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
18951    if (json.has("param")) {
18952      JsonArray array = json.getAsJsonArray("param");
18953      for (int i = 0; i < array.size(); i++) {
18954        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
18955      }
18956    };
18957  }
18958
18959  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18960    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
18961    parseTestScriptActionAssertRuleParamComponentProperties(json, owner, res);
18962    return res;
18963  }
18964
18965  protected void parseTestScriptActionAssertRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws IOException, FHIRFormatError {
18966    parseBackboneProperties(json, res);
18967    if (json.has("name"))
18968      res.setNameElement(parseString(json.get("name").getAsString()));
18969    if (json.has("_name"))
18970      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18971    if (json.has("value"))
18972      res.setValueElement(parseString(json.get("value").getAsString()));
18973    if (json.has("_value"))
18974      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
18975  }
18976
18977  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18978    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
18979    parseTestScriptActionAssertRulesetComponentProperties(json, owner, res);
18980    return res;
18981  }
18982
18983  protected void parseTestScriptActionAssertRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws IOException, FHIRFormatError {
18984    parseBackboneProperties(json, res);
18985    if (json.has("rulesetId"))
18986      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
18987    if (json.has("_rulesetId"))
18988      parseElementProperties(json.getAsJsonObject("_rulesetId"), res.getRulesetIdElement());
18989    if (json.has("rule")) {
18990      JsonArray array = json.getAsJsonArray("rule");
18991      for (int i = 0; i < array.size(); i++) {
18992        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
18993      }
18994    };
18995  }
18996
18997  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
18998    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
18999    parseTestScriptActionAssertRulesetRuleComponentProperties(json, owner, res);
19000    return res;
19001  }
19002
19003  protected void parseTestScriptActionAssertRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws IOException, FHIRFormatError {
19004    parseBackboneProperties(json, res);
19005    if (json.has("ruleId"))
19006      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
19007    if (json.has("_ruleId"))
19008      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
19009    if (json.has("param")) {
19010      JsonArray array = json.getAsJsonArray("param");
19011      for (int i = 0; i < array.size(); i++) {
19012        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
19013      }
19014    };
19015  }
19016
19017  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19018    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
19019    parseTestScriptActionAssertRulesetRuleParamComponentProperties(json, owner, res);
19020    return res;
19021  }
19022
19023  protected void parseTestScriptActionAssertRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws IOException, FHIRFormatError {
19024    parseBackboneProperties(json, res);
19025    if (json.has("name"))
19026      res.setNameElement(parseString(json.get("name").getAsString()));
19027    if (json.has("_name"))
19028      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19029    if (json.has("value"))
19030      res.setValueElement(parseString(json.get("value").getAsString()));
19031    if (json.has("_value"))
19032      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19033  }
19034
19035  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19036    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
19037    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
19038    return res;
19039  }
19040
19041  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
19042    parseBackboneProperties(json, res);
19043    if (json.has("name"))
19044      res.setNameElement(parseString(json.get("name").getAsString()));
19045    if (json.has("_name"))
19046      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19047    if (json.has("description"))
19048      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19049    if (json.has("_description"))
19050      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19051    if (json.has("action")) {
19052      JsonArray array = json.getAsJsonArray("action");
19053      for (int i = 0; i < array.size(); i++) {
19054        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
19055      }
19056    };
19057  }
19058
19059  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19060    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
19061    parseTestScriptTestActionComponentProperties(json, owner, res);
19062    return res;
19063  }
19064
19065  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
19066    parseBackboneProperties(json, res);
19067    if (json.has("operation"))
19068      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
19069    if (json.has("assert"))
19070      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
19071  }
19072
19073  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19074    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
19075    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
19076    return res;
19077  }
19078
19079  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
19080    parseBackboneProperties(json, res);
19081    if (json.has("action")) {
19082      JsonArray array = json.getAsJsonArray("action");
19083      for (int i = 0; i < array.size(); i++) {
19084        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
19085      }
19086    };
19087  }
19088
19089  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
19090    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
19091    parseTestScriptTeardownActionComponentProperties(json, owner, res);
19092    return res;
19093  }
19094
19095  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
19096    parseBackboneProperties(json, res);
19097    if (json.has("operation"))
19098      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
19099  }
19100
19101  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
19102    ValueSet res = new ValueSet();
19103    parseValueSetProperties(json, res);
19104    return res;
19105  }
19106
19107  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
19108    parseDomainResourceProperties(json, res);
19109    if (json.has("url"))
19110      res.setUrlElement(parseUri(json.get("url").getAsString()));
19111    if (json.has("_url"))
19112      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19113    if (json.has("identifier")) {
19114      JsonArray array = json.getAsJsonArray("identifier");
19115      for (int i = 0; i < array.size(); i++) {
19116        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19117      }
19118    };
19119    if (json.has("version"))
19120      res.setVersionElement(parseString(json.get("version").getAsString()));
19121    if (json.has("_version"))
19122      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19123    if (json.has("name"))
19124      res.setNameElement(parseString(json.get("name").getAsString()));
19125    if (json.has("_name"))
19126      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19127    if (json.has("title"))
19128      res.setTitleElement(parseString(json.get("title").getAsString()));
19129    if (json.has("_title"))
19130      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19131    if (json.has("status"))
19132      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19133    if (json.has("_status"))
19134      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19135    if (json.has("experimental"))
19136      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19137    if (json.has("_experimental"))
19138      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19139    if (json.has("date"))
19140      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19141    if (json.has("_date"))
19142      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19143    if (json.has("publisher"))
19144      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19145    if (json.has("_publisher"))
19146      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19147    if (json.has("contact")) {
19148      JsonArray array = json.getAsJsonArray("contact");
19149      for (int i = 0; i < array.size(); i++) {
19150        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19151      }
19152    };
19153    if (json.has("description"))
19154      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19155    if (json.has("_description"))
19156      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19157    if (json.has("useContext")) {
19158      JsonArray array = json.getAsJsonArray("useContext");
19159      for (int i = 0; i < array.size(); i++) {
19160        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19161      }
19162    };
19163    if (json.has("jurisdiction")) {
19164      JsonArray array = json.getAsJsonArray("jurisdiction");
19165      for (int i = 0; i < array.size(); i++) {
19166        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19167      }
19168    };
19169    if (json.has("immutable"))
19170      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
19171    if (json.has("_immutable"))
19172      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
19173    if (json.has("purpose"))
19174      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19175    if (json.has("_purpose"))
19176      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19177    if (json.has("copyright"))
19178      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19179    if (json.has("_copyright"))
19180      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
19181    if (json.has("extensible"))
19182      res.setExtensibleElement(parseBoolean(json.get("extensible").getAsBoolean()));
19183    if (json.has("_extensible"))
19184      parseElementProperties(json.getAsJsonObject("_extensible"), res.getExtensibleElement());
19185    if (json.has("compose"))
19186      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
19187    if (json.has("expansion"))
19188      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
19189  }
19190
19191  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19192    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
19193    parseValueSetValueSetComposeComponentProperties(json, owner, res);
19194    return res;
19195  }
19196
19197  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
19198    parseBackboneProperties(json, res);
19199    if (json.has("lockedDate"))
19200      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
19201    if (json.has("_lockedDate"))
19202      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
19203    if (json.has("inactive"))
19204      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19205    if (json.has("_inactive"))
19206      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
19207    if (json.has("include")) {
19208      JsonArray array = json.getAsJsonArray("include");
19209      for (int i = 0; i < array.size(); i++) {
19210        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19211      }
19212    };
19213    if (json.has("exclude")) {
19214      JsonArray array = json.getAsJsonArray("exclude");
19215      for (int i = 0; i < array.size(); i++) {
19216        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
19217      }
19218    };
19219  }
19220
19221  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19222    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
19223    parseValueSetConceptSetComponentProperties(json, owner, res);
19224    return res;
19225  }
19226
19227  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
19228    parseBackboneProperties(json, res);
19229    if (json.has("system"))
19230      res.setSystemElement(parseUri(json.get("system").getAsString()));
19231    if (json.has("_system"))
19232      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19233    if (json.has("version"))
19234      res.setVersionElement(parseString(json.get("version").getAsString()));
19235    if (json.has("_version"))
19236      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19237    if (json.has("concept")) {
19238      JsonArray array = json.getAsJsonArray("concept");
19239      for (int i = 0; i < array.size(); i++) {
19240        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
19241      }
19242    };
19243    if (json.has("filter")) {
19244      JsonArray array = json.getAsJsonArray("filter");
19245      for (int i = 0; i < array.size(); i++) {
19246        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
19247      }
19248    };
19249    if (json.has("valueSet")) {
19250      JsonArray array = json.getAsJsonArray("valueSet");
19251      for (int i = 0; i < array.size(); i++) {
19252        res.getValueSet().add(parseUri(array.get(i).getAsString()));
19253      }
19254    };
19255    if (json.has("_valueSet")) {
19256      JsonArray array = json.getAsJsonArray("_valueSet");
19257      for (int i = 0; i < array.size(); i++) {
19258        if (i == res.getValueSet().size())
19259          res.getValueSet().add(parseUri(null));
19260        if (array.get(i) instanceof JsonObject) 
19261          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
19262      }
19263    };
19264  }
19265
19266  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19267    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
19268    parseValueSetConceptReferenceComponentProperties(json, owner, res);
19269    return res;
19270  }
19271
19272  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
19273    parseBackboneProperties(json, res);
19274    if (json.has("code"))
19275      res.setCodeElement(parseCode(json.get("code").getAsString()));
19276    if (json.has("_code"))
19277      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19278    if (json.has("display"))
19279      res.setDisplayElement(parseString(json.get("display").getAsString()));
19280    if (json.has("_display"))
19281      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
19282    if (json.has("designation")) {
19283      JsonArray array = json.getAsJsonArray("designation");
19284      for (int i = 0; i < array.size(); i++) {
19285        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19286      }
19287    };
19288  }
19289
19290  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19291    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
19292    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
19293    return res;
19294  }
19295
19296  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
19297    parseBackboneProperties(json, res);
19298    if (json.has("language"))
19299      res.setLanguageElement(parseCode(json.get("language").getAsString()));
19300    if (json.has("_language"))
19301      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
19302    if (json.has("use"))
19303      res.setUse(parseCoding(json.getAsJsonObject("use")));
19304    if (json.has("value"))
19305      res.setValueElement(parseString(json.get("value").getAsString()));
19306    if (json.has("_value"))
19307      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19308  }
19309
19310  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19311    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
19312    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
19313    return res;
19314  }
19315
19316  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
19317    parseBackboneProperties(json, res);
19318    if (json.has("property"))
19319      res.setPropertyElement(parseCode(json.get("property").getAsString()));
19320    if (json.has("_property"))
19321      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
19322    if (json.has("op"))
19323      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
19324    if (json.has("_op"))
19325      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
19326    if (json.has("value"))
19327      res.setValueElement(parseCode(json.get("value").getAsString()));
19328    if (json.has("_value"))
19329      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
19330  }
19331
19332  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19333    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
19334    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
19335    return res;
19336  }
19337
19338  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
19339    parseBackboneProperties(json, res);
19340    if (json.has("identifier"))
19341      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
19342    if (json.has("_identifier"))
19343      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
19344    if (json.has("timestamp"))
19345      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
19346    if (json.has("_timestamp"))
19347      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
19348    if (json.has("total"))
19349      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
19350    if (json.has("_total"))
19351      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
19352    if (json.has("offset"))
19353      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
19354    if (json.has("_offset"))
19355      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
19356    if (json.has("parameter")) {
19357      JsonArray array = json.getAsJsonArray("parameter");
19358      for (int i = 0; i < array.size(); i++) {
19359        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
19360      }
19361    };
19362    if (json.has("contains")) {
19363      JsonArray array = json.getAsJsonArray("contains");
19364      for (int i = 0; i < array.size(); i++) {
19365        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19366      }
19367    };
19368  }
19369
19370  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19371    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
19372    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
19373    return res;
19374  }
19375
19376  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
19377    parseBackboneProperties(json, res);
19378    if (json.has("name"))
19379      res.setNameElement(parseString(json.get("name").getAsString()));
19380    if (json.has("_name"))
19381      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19382    Type value = parseType("value", json);
19383    if (value != null)
19384      res.setValue(value);
19385  }
19386
19387  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
19388    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
19389    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
19390    return res;
19391  }
19392
19393  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
19394    parseBackboneProperties(json, res);
19395    if (json.has("system"))
19396      res.setSystemElement(parseUri(json.get("system").getAsString()));
19397    if (json.has("_system"))
19398      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
19399    if (json.has("abstract"))
19400      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
19401    if (json.has("_abstract"))
19402      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
19403    if (json.has("inactive"))
19404      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
19405    if (json.has("_inactive"))
19406      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
19407    if (json.has("version"))
19408      res.setVersionElement(parseString(json.get("version").getAsString()));
19409    if (json.has("_version"))
19410      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19411    if (json.has("code"))
19412      res.setCodeElement(parseCode(json.get("code").getAsString()));
19413    if (json.has("_code"))
19414      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
19415    if (json.has("display"))
19416      res.setDisplayElement(parseString(json.get("display").getAsString()));
19417    if (json.has("_display"))
19418      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
19419    if (json.has("designation")) {
19420      JsonArray array = json.getAsJsonArray("designation");
19421      for (int i = 0; i < array.size(); i++) {
19422        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
19423      }
19424    };
19425    if (json.has("contains")) {
19426      JsonArray array = json.getAsJsonArray("contains");
19427      for (int i = 0; i < array.size(); i++) {
19428        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
19429      }
19430    };
19431  }
19432
19433  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
19434    VisionPrescription res = new VisionPrescription();
19435    parseVisionPrescriptionProperties(json, res);
19436    return res;
19437  }
19438
19439  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
19440    parseDomainResourceProperties(json, res);
19441    if (json.has("identifier")) {
19442      JsonArray array = json.getAsJsonArray("identifier");
19443      for (int i = 0; i < array.size(); i++) {
19444        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19445      }
19446    };
19447    if (json.has("status"))
19448      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
19449    if (json.has("_status"))
19450      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19451    if (json.has("patient"))
19452      res.setPatient(parseReference(json.getAsJsonObject("patient")));
19453    if (json.has("encounter"))
19454      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
19455    if (json.has("dateWritten"))
19456      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
19457    if (json.has("_dateWritten"))
19458      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
19459    if (json.has("prescriber"))
19460      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
19461    Type reason = parseType("reason", json);
19462    if (reason != null)
19463      res.setReason(reason);
19464    if (json.has("dispense")) {
19465      JsonArray array = json.getAsJsonArray("dispense");
19466      for (int i = 0; i < array.size(); i++) {
19467        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
19468      }
19469    };
19470  }
19471
19472  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
19473    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
19474    parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(json, owner, res);
19475    return res;
19476  }
19477
19478  protected void parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws IOException, FHIRFormatError {
19479    parseBackboneProperties(json, res);
19480    if (json.has("product"))
19481      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
19482    if (json.has("eye"))
19483      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
19484    if (json.has("_eye"))
19485      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
19486    if (json.has("sphere"))
19487      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
19488    if (json.has("_sphere"))
19489      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
19490    if (json.has("cylinder"))
19491      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
19492    if (json.has("_cylinder"))
19493      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
19494    if (json.has("axis"))
19495      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
19496    if (json.has("_axis"))
19497      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
19498    if (json.has("prism"))
19499      res.setPrismElement(parseDecimal(json.get("prism").getAsBigDecimal()));
19500    if (json.has("_prism"))
19501      parseElementProperties(json.getAsJsonObject("_prism"), res.getPrismElement());
19502    if (json.has("base"))
19503      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
19504    if (json.has("_base"))
19505      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
19506    if (json.has("add"))
19507      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
19508    if (json.has("_add"))
19509      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
19510    if (json.has("power"))
19511      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
19512    if (json.has("_power"))
19513      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
19514    if (json.has("backCurve"))
19515      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
19516    if (json.has("_backCurve"))
19517      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
19518    if (json.has("diameter"))
19519      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
19520    if (json.has("_diameter"))
19521      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
19522    if (json.has("duration"))
19523      res.setDuration(parseSimpleQuantity(json.getAsJsonObject("duration")));
19524    if (json.has("color"))
19525      res.setColorElement(parseString(json.get("color").getAsString()));
19526    if (json.has("_color"))
19527      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
19528    if (json.has("brand"))
19529      res.setBrandElement(parseString(json.get("brand").getAsString()));
19530    if (json.has("_brand"))
19531      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
19532    if (json.has("note")) {
19533      JsonArray array = json.getAsJsonArray("note");
19534      for (int i = 0; i < array.size(); i++) {
19535        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19536      }
19537    };
19538  }
19539
19540  @Override
19541  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
19542    if (!json.has("resourceType")) {
19543      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
19544    }
19545    String t = json.get("resourceType").getAsString();
19546    if (Utilities.noString(t))
19547      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
19548    if (t.equals("Parameters"))
19549      return parseParameters(json);
19550    else if (t.equals("Account"))
19551      return parseAccount(json);
19552    else if (t.equals("ActivityDefinition"))
19553      return parseActivityDefinition(json);
19554    else if (t.equals("AdverseEvent"))
19555      return parseAdverseEvent(json);
19556    else if (t.equals("AllergyIntolerance"))
19557      return parseAllergyIntolerance(json);
19558    else if (t.equals("Appointment"))
19559      return parseAppointment(json);
19560    else if (t.equals("AppointmentResponse"))
19561      return parseAppointmentResponse(json);
19562    else if (t.equals("AuditEvent"))
19563      return parseAuditEvent(json);
19564    else if (t.equals("Basic"))
19565      return parseBasic(json);
19566    else if (t.equals("Binary"))
19567      return parseBinary(json);
19568    else if (t.equals("BodySite"))
19569      return parseBodySite(json);
19570    else if (t.equals("Bundle"))
19571      return parseBundle(json);
19572    else if (t.equals("CapabilityStatement"))
19573      return parseCapabilityStatement(json);
19574    else if (t.equals("CarePlan"))
19575      return parseCarePlan(json);
19576    else if (t.equals("CareTeam"))
19577      return parseCareTeam(json);
19578    else if (t.equals("ChargeItem"))
19579      return parseChargeItem(json);
19580    else if (t.equals("Claim"))
19581      return parseClaim(json);
19582    else if (t.equals("ClaimResponse"))
19583      return parseClaimResponse(json);
19584    else if (t.equals("ClinicalImpression"))
19585      return parseClinicalImpression(json);
19586    else if (t.equals("CodeSystem"))
19587      return parseCodeSystem(json);
19588    else if (t.equals("Communication"))
19589      return parseCommunication(json);
19590    else if (t.equals("CommunicationRequest"))
19591      return parseCommunicationRequest(json);
19592    else if (t.equals("CompartmentDefinition"))
19593      return parseCompartmentDefinition(json);
19594    else if (t.equals("Composition"))
19595      return parseComposition(json);
19596    else if (t.equals("ConceptMap"))
19597      return parseConceptMap(json);
19598    else if (t.equals("Condition"))
19599      return parseCondition(json);
19600    else if (t.equals("Consent"))
19601      return parseConsent(json);
19602    else if (t.equals("Contract"))
19603      return parseContract(json);
19604    else if (t.equals("Coverage"))
19605      return parseCoverage(json);
19606    else if (t.equals("DataElement"))
19607      return parseDataElement(json);
19608    else if (t.equals("DetectedIssue"))
19609      return parseDetectedIssue(json);
19610    else if (t.equals("Device"))
19611      return parseDevice(json);
19612    else if (t.equals("DeviceComponent"))
19613      return parseDeviceComponent(json);
19614    else if (t.equals("DeviceMetric"))
19615      return parseDeviceMetric(json);
19616    else if (t.equals("DeviceRequest"))
19617      return parseDeviceRequest(json);
19618    else if (t.equals("DeviceUseStatement"))
19619      return parseDeviceUseStatement(json);
19620    else if (t.equals("DiagnosticReport"))
19621      return parseDiagnosticReport(json);
19622    else if (t.equals("DocumentManifest"))
19623      return parseDocumentManifest(json);
19624    else if (t.equals("DocumentReference"))
19625      return parseDocumentReference(json);
19626    else if (t.equals("EligibilityRequest"))
19627      return parseEligibilityRequest(json);
19628    else if (t.equals("EligibilityResponse"))
19629      return parseEligibilityResponse(json);
19630    else if (t.equals("Encounter"))
19631      return parseEncounter(json);
19632    else if (t.equals("Endpoint"))
19633      return parseEndpoint(json);
19634    else if (t.equals("EnrollmentRequest"))
19635      return parseEnrollmentRequest(json);
19636    else if (t.equals("EnrollmentResponse"))
19637      return parseEnrollmentResponse(json);
19638    else if (t.equals("EpisodeOfCare"))
19639      return parseEpisodeOfCare(json);
19640    else if (t.equals("ExpansionProfile"))
19641      return parseExpansionProfile(json);
19642    else if (t.equals("ExplanationOfBenefit"))
19643      return parseExplanationOfBenefit(json);
19644    else if (t.equals("FamilyMemberHistory"))
19645      return parseFamilyMemberHistory(json);
19646    else if (t.equals("Flag"))
19647      return parseFlag(json);
19648    else if (t.equals("Goal"))
19649      return parseGoal(json);
19650    else if (t.equals("GraphDefinition"))
19651      return parseGraphDefinition(json);
19652    else if (t.equals("Group"))
19653      return parseGroup(json);
19654    else if (t.equals("GuidanceResponse"))
19655      return parseGuidanceResponse(json);
19656    else if (t.equals("HealthcareService"))
19657      return parseHealthcareService(json);
19658    else if (t.equals("ImagingManifest"))
19659      return parseImagingManifest(json);
19660    else if (t.equals("ImagingStudy"))
19661      return parseImagingStudy(json);
19662    else if (t.equals("Immunization"))
19663      return parseImmunization(json);
19664    else if (t.equals("ImmunizationRecommendation"))
19665      return parseImmunizationRecommendation(json);
19666    else if (t.equals("ImplementationGuide"))
19667      return parseImplementationGuide(json);
19668    else if (t.equals("Library"))
19669      return parseLibrary(json);
19670    else if (t.equals("Linkage"))
19671      return parseLinkage(json);
19672    else if (t.equals("List"))
19673      return parseListResource(json);
19674    else if (t.equals("Location"))
19675      return parseLocation(json);
19676    else if (t.equals("Measure"))
19677      return parseMeasure(json);
19678    else if (t.equals("MeasureReport"))
19679      return parseMeasureReport(json);
19680    else if (t.equals("Media"))
19681      return parseMedia(json);
19682    else if (t.equals("Medication"))
19683      return parseMedication(json);
19684    else if (t.equals("MedicationAdministration"))
19685      return parseMedicationAdministration(json);
19686    else if (t.equals("MedicationDispense"))
19687      return parseMedicationDispense(json);
19688    else if (t.equals("MedicationRequest"))
19689      return parseMedicationRequest(json);
19690    else if (t.equals("MedicationStatement"))
19691      return parseMedicationStatement(json);
19692    else if (t.equals("MessageDefinition"))
19693      return parseMessageDefinition(json);
19694    else if (t.equals("MessageHeader"))
19695      return parseMessageHeader(json);
19696    else if (t.equals("NamingSystem"))
19697      return parseNamingSystem(json);
19698    else if (t.equals("NutritionOrder"))
19699      return parseNutritionOrder(json);
19700    else if (t.equals("Observation"))
19701      return parseObservation(json);
19702    else if (t.equals("OperationDefinition"))
19703      return parseOperationDefinition(json);
19704    else if (t.equals("OperationOutcome"))
19705      return parseOperationOutcome(json);
19706    else if (t.equals("Organization"))
19707      return parseOrganization(json);
19708    else if (t.equals("Patient"))
19709      return parsePatient(json);
19710    else if (t.equals("PaymentNotice"))
19711      return parsePaymentNotice(json);
19712    else if (t.equals("PaymentReconciliation"))
19713      return parsePaymentReconciliation(json);
19714    else if (t.equals("Person"))
19715      return parsePerson(json);
19716    else if (t.equals("PlanDefinition"))
19717      return parsePlanDefinition(json);
19718    else if (t.equals("Practitioner"))
19719      return parsePractitioner(json);
19720    else if (t.equals("PractitionerRole"))
19721      return parsePractitionerRole(json);
19722    else if (t.equals("Procedure"))
19723      return parseProcedure(json);
19724    else if (t.equals("ProcedureRequest"))
19725      return parseProcedureRequest(json);
19726    else if (t.equals("ProcessRequest"))
19727      return parseProcessRequest(json);
19728    else if (t.equals("ProcessResponse"))
19729      return parseProcessResponse(json);
19730    else if (t.equals("Provenance"))
19731      return parseProvenance(json);
19732    else if (t.equals("Questionnaire"))
19733      return parseQuestionnaire(json);
19734    else if (t.equals("QuestionnaireResponse"))
19735      return parseQuestionnaireResponse(json);
19736    else if (t.equals("ReferralRequest"))
19737      return parseReferralRequest(json);
19738    else if (t.equals("RelatedPerson"))
19739      return parseRelatedPerson(json);
19740    else if (t.equals("RequestGroup"))
19741      return parseRequestGroup(json);
19742    else if (t.equals("ResearchStudy"))
19743      return parseResearchStudy(json);
19744    else if (t.equals("ResearchSubject"))
19745      return parseResearchSubject(json);
19746    else if (t.equals("RiskAssessment"))
19747      return parseRiskAssessment(json);
19748    else if (t.equals("Schedule"))
19749      return parseSchedule(json);
19750    else if (t.equals("SearchParameter"))
19751      return parseSearchParameter(json);
19752    else if (t.equals("Sequence"))
19753      return parseSequence(json);
19754    else if (t.equals("ServiceDefinition"))
19755      return parseServiceDefinition(json);
19756    else if (t.equals("Slot"))
19757      return parseSlot(json);
19758    else if (t.equals("Specimen"))
19759      return parseSpecimen(json);
19760    else if (t.equals("StructureDefinition"))
19761      return parseStructureDefinition(json);
19762    else if (t.equals("StructureMap"))
19763      return parseStructureMap(json);
19764    else if (t.equals("Subscription"))
19765      return parseSubscription(json);
19766    else if (t.equals("Substance"))
19767      return parseSubstance(json);
19768    else if (t.equals("SupplyDelivery"))
19769      return parseSupplyDelivery(json);
19770    else if (t.equals("SupplyRequest"))
19771      return parseSupplyRequest(json);
19772    else if (t.equals("Task"))
19773      return parseTask(json);
19774    else if (t.equals("TestReport"))
19775      return parseTestReport(json);
19776    else if (t.equals("TestScript"))
19777      return parseTestScript(json);
19778    else if (t.equals("ValueSet"))
19779      return parseValueSet(json);
19780    else if (t.equals("VisionPrescription"))
19781      return parseVisionPrescription(json);
19782    else if (t.equals("Binary"))
19783      return parseBinary(json);
19784    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
19785  }
19786
19787  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
19788    if (json.has(prefix+"Reference"))
19789      return parseReference(json.getAsJsonObject(prefix+"Reference"));
19790    else if (json.has(prefix+"Quantity"))
19791      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
19792    else if (json.has(prefix+"Period"))
19793      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
19794    else if (json.has(prefix+"Attachment"))
19795      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
19796    else if (json.has(prefix+"Duration"))
19797      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
19798    else if (json.has(prefix+"Count"))
19799      return parseCount(json.getAsJsonObject(prefix+"Count"));
19800    else if (json.has(prefix+"Range"))
19801      return parseRange(json.getAsJsonObject(prefix+"Range"));
19802    else if (json.has(prefix+"Annotation"))
19803      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
19804    else if (json.has(prefix+"Money"))
19805      return parseMoney(json.getAsJsonObject(prefix+"Money"));
19806    else if (json.has(prefix+"Identifier"))
19807      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
19808    else if (json.has(prefix+"Coding"))
19809      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
19810    else if (json.has(prefix+"Signature"))
19811      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
19812    else if (json.has(prefix+"SampledData"))
19813      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
19814    else if (json.has(prefix+"Ratio"))
19815      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
19816    else if (json.has(prefix+"Distance"))
19817      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
19818    else if (json.has(prefix+"Age"))
19819      return parseAge(json.getAsJsonObject(prefix+"Age"));
19820    else if (json.has(prefix+"CodeableConcept"))
19821      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
19822    else if (json.has(prefix+"SimpleQuantity"))
19823      return parseSimpleQuantity(json.getAsJsonObject(prefix+"SimpleQuantity"));
19824    else if (json.has(prefix+"Meta"))
19825      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
19826    else if (json.has(prefix+"Address"))
19827      return parseAddress(json.getAsJsonObject(prefix+"Address"));
19828    else if (json.has(prefix+"TriggerDefinition"))
19829      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
19830    else if (json.has(prefix+"Contributor"))
19831      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
19832    else if (json.has(prefix+"DataRequirement"))
19833      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
19834    else if (json.has(prefix+"Dosage"))
19835      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
19836    else if (json.has(prefix+"RelatedArtifact"))
19837      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
19838    else if (json.has(prefix+"ContactDetail"))
19839      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
19840    else if (json.has(prefix+"HumanName"))
19841      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
19842    else if (json.has(prefix+"ContactPoint"))
19843      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
19844    else if (json.has(prefix+"UsageContext"))
19845      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
19846    else if (json.has(prefix+"Timing"))
19847      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
19848    else if (json.has(prefix+"ElementDefinition"))
19849      return parseElementDefinition(json.getAsJsonObject(prefix+"ElementDefinition"));
19850    else if (json.has(prefix+"ParameterDefinition"))
19851      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
19852    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
19853      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
19854      if (json.has("_"+prefix+"Date"))
19855        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
19856      return t;
19857    }
19858    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
19859      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
19860      if (json.has("_"+prefix+"DateTime"))
19861        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
19862      return t;
19863    }
19864    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
19865      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
19866      if (json.has("_"+prefix+"Code"))
19867        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
19868      return t;
19869    }
19870    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
19871      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
19872      if (json.has("_"+prefix+"String"))
19873        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
19874      return t;
19875    }
19876    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
19877      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
19878      if (json.has("_"+prefix+"Integer"))
19879        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
19880      return t;
19881    }
19882    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
19883      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
19884      if (json.has("_"+prefix+"Oid"))
19885        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
19886      return t;
19887    }
19888    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
19889      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
19890      if (json.has("_"+prefix+"Uri"))
19891        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
19892      return t;
19893    }
19894    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
19895      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
19896      if (json.has("_"+prefix+"Uuid"))
19897        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
19898      return t;
19899    }
19900    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
19901      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
19902      if (json.has("_"+prefix+"Instant"))
19903        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
19904      return t;
19905    }
19906    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
19907      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
19908      if (json.has("_"+prefix+"Boolean"))
19909        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
19910      return t;
19911    }
19912    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
19913      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
19914      if (json.has("_"+prefix+"Base64Binary"))
19915        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
19916      return t;
19917    }
19918    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
19919      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
19920      if (json.has("_"+prefix+"UnsignedInt"))
19921        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
19922      return t;
19923    }
19924    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
19925      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
19926      if (json.has("_"+prefix+"Markdown"))
19927        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
19928      return t;
19929    }
19930    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
19931      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
19932      if (json.has("_"+prefix+"Time"))
19933        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
19934      return t;
19935    }
19936    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
19937      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
19938      if (json.has("_"+prefix+"Id"))
19939        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
19940      return t;
19941    }
19942    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
19943      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
19944      if (json.has("_"+prefix+"PositiveInt"))
19945        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
19946      return t;
19947    }
19948    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
19949      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
19950      if (json.has("_"+prefix+"Decimal"))
19951        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
19952      return t;
19953    }
19954    return null;
19955  }
19956
19957  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
19958    if (type.equals("Reference"))
19959      return parseReference(json);
19960    else if (type.equals("Quantity"))
19961      return parseQuantity(json);
19962    else if (type.equals("Period"))
19963      return parsePeriod(json);
19964    else if (type.equals("Attachment"))
19965      return parseAttachment(json);
19966    else if (type.equals("Duration"))
19967      return parseDuration(json);
19968    else if (type.equals("Count"))
19969      return parseCount(json);
19970    else if (type.equals("Range"))
19971      return parseRange(json);
19972    else if (type.equals("Annotation"))
19973      return parseAnnotation(json);
19974    else if (type.equals("Money"))
19975      return parseMoney(json);
19976    else if (type.equals("Identifier"))
19977      return parseIdentifier(json);
19978    else if (type.equals("Coding"))
19979      return parseCoding(json);
19980    else if (type.equals("Signature"))
19981      return parseSignature(json);
19982    else if (type.equals("SampledData"))
19983      return parseSampledData(json);
19984    else if (type.equals("Ratio"))
19985      return parseRatio(json);
19986    else if (type.equals("Distance"))
19987      return parseDistance(json);
19988    else if (type.equals("Age"))
19989      return parseAge(json);
19990    else if (type.equals("CodeableConcept"))
19991      return parseCodeableConcept(json);
19992    else if (type.equals("SimpleQuantity"))
19993      return parseSimpleQuantity(json);
19994    else if (type.equals("Meta"))
19995      return parseMeta(json);
19996    else if (type.equals("Address"))
19997      return parseAddress(json);
19998    else if (type.equals("TriggerDefinition"))
19999      return parseTriggerDefinition(json);
20000    else if (type.equals("Contributor"))
20001      return parseContributor(json);
20002    else if (type.equals("DataRequirement"))
20003      return parseDataRequirement(json);
20004    else if (type.equals("Dosage"))
20005      return parseDosage(json);
20006    else if (type.equals("RelatedArtifact"))
20007      return parseRelatedArtifact(json);
20008    else if (type.equals("ContactDetail"))
20009      return parseContactDetail(json);
20010    else if (type.equals("HumanName"))
20011      return parseHumanName(json);
20012    else if (type.equals("ContactPoint"))
20013      return parseContactPoint(json);
20014    else if (type.equals("UsageContext"))
20015      return parseUsageContext(json);
20016    else if (type.equals("Timing"))
20017      return parseTiming(json);
20018    else if (type.equals("ElementDefinition"))
20019      return parseElementDefinition(json);
20020    else if (type.equals("ParameterDefinition"))
20021      return parseParameterDefinition(json);
20022    throw new FHIRFormatError("Unknown Type "+type);
20023  }
20024
20025  protected boolean hasTypeName(JsonObject json, String prefix) {
20026        if (json.has(prefix+"Reference"))
20027      return true;
20028    if (json.has(prefix+"Quantity"))
20029      return true;
20030    if (json.has(prefix+"Period"))
20031      return true;
20032    if (json.has(prefix+"Attachment"))
20033      return true;
20034    if (json.has(prefix+"Duration"))
20035      return true;
20036    if (json.has(prefix+"Count"))
20037      return true;
20038    if (json.has(prefix+"Range"))
20039      return true;
20040    if (json.has(prefix+"Annotation"))
20041      return true;
20042    if (json.has(prefix+"Money"))
20043      return true;
20044    if (json.has(prefix+"Identifier"))
20045      return true;
20046    if (json.has(prefix+"Coding"))
20047      return true;
20048    if (json.has(prefix+"Signature"))
20049      return true;
20050    if (json.has(prefix+"SampledData"))
20051      return true;
20052    if (json.has(prefix+"Ratio"))
20053      return true;
20054    if (json.has(prefix+"Distance"))
20055      return true;
20056    if (json.has(prefix+"Age"))
20057      return true;
20058    if (json.has(prefix+"CodeableConcept"))
20059      return true;
20060    if (json.has(prefix+"SimpleQuantity"))
20061      return true;
20062    if (json.has(prefix+"Meta"))
20063      return true;
20064    if (json.has(prefix+"Address"))
20065      return true;
20066    if (json.has(prefix+"TriggerDefinition"))
20067      return true;
20068    if (json.has(prefix+"Contributor"))
20069      return true;
20070    if (json.has(prefix+"DataRequirement"))
20071      return true;
20072    if (json.has(prefix+"Dosage"))
20073      return true;
20074    if (json.has(prefix+"RelatedArtifact"))
20075      return true;
20076    if (json.has(prefix+"ContactDetail"))
20077      return true;
20078    if (json.has(prefix+"HumanName"))
20079      return true;
20080    if (json.has(prefix+"ContactPoint"))
20081      return true;
20082    if (json.has(prefix+"UsageContext"))
20083      return true;
20084    if (json.has(prefix+"Timing"))
20085      return true;
20086    if (json.has(prefix+"ElementDefinition"))
20087      return true;
20088    if (json.has(prefix+"ParameterDefinition"))
20089      return true;
20090    if (json.has(prefix+"Parameters"))
20091      return true;
20092    if (json.has(prefix+"Account"))
20093      return true;
20094    if (json.has(prefix+"ActivityDefinition"))
20095      return true;
20096    if (json.has(prefix+"AdverseEvent"))
20097      return true;
20098    if (json.has(prefix+"AllergyIntolerance"))
20099      return true;
20100    if (json.has(prefix+"Appointment"))
20101      return true;
20102    if (json.has(prefix+"AppointmentResponse"))
20103      return true;
20104    if (json.has(prefix+"AuditEvent"))
20105      return true;
20106    if (json.has(prefix+"Basic"))
20107      return true;
20108    if (json.has(prefix+"Binary"))
20109      return true;
20110    if (json.has(prefix+"BodySite"))
20111      return true;
20112    if (json.has(prefix+"Bundle"))
20113      return true;
20114    if (json.has(prefix+"CapabilityStatement"))
20115      return true;
20116    if (json.has(prefix+"CarePlan"))
20117      return true;
20118    if (json.has(prefix+"CareTeam"))
20119      return true;
20120    if (json.has(prefix+"ChargeItem"))
20121      return true;
20122    if (json.has(prefix+"Claim"))
20123      return true;
20124    if (json.has(prefix+"ClaimResponse"))
20125      return true;
20126    if (json.has(prefix+"ClinicalImpression"))
20127      return true;
20128    if (json.has(prefix+"CodeSystem"))
20129      return true;
20130    if (json.has(prefix+"Communication"))
20131      return true;
20132    if (json.has(prefix+"CommunicationRequest"))
20133      return true;
20134    if (json.has(prefix+"CompartmentDefinition"))
20135      return true;
20136    if (json.has(prefix+"Composition"))
20137      return true;
20138    if (json.has(prefix+"ConceptMap"))
20139      return true;
20140    if (json.has(prefix+"Condition"))
20141      return true;
20142    if (json.has(prefix+"Consent"))
20143      return true;
20144    if (json.has(prefix+"Contract"))
20145      return true;
20146    if (json.has(prefix+"Coverage"))
20147      return true;
20148    if (json.has(prefix+"DataElement"))
20149      return true;
20150    if (json.has(prefix+"DetectedIssue"))
20151      return true;
20152    if (json.has(prefix+"Device"))
20153      return true;
20154    if (json.has(prefix+"DeviceComponent"))
20155      return true;
20156    if (json.has(prefix+"DeviceMetric"))
20157      return true;
20158    if (json.has(prefix+"DeviceRequest"))
20159      return true;
20160    if (json.has(prefix+"DeviceUseStatement"))
20161      return true;
20162    if (json.has(prefix+"DiagnosticReport"))
20163      return true;
20164    if (json.has(prefix+"DocumentManifest"))
20165      return true;
20166    if (json.has(prefix+"DocumentReference"))
20167      return true;
20168    if (json.has(prefix+"EligibilityRequest"))
20169      return true;
20170    if (json.has(prefix+"EligibilityResponse"))
20171      return true;
20172    if (json.has(prefix+"Encounter"))
20173      return true;
20174    if (json.has(prefix+"Endpoint"))
20175      return true;
20176    if (json.has(prefix+"EnrollmentRequest"))
20177      return true;
20178    if (json.has(prefix+"EnrollmentResponse"))
20179      return true;
20180    if (json.has(prefix+"EpisodeOfCare"))
20181      return true;
20182    if (json.has(prefix+"ExpansionProfile"))
20183      return true;
20184    if (json.has(prefix+"ExplanationOfBenefit"))
20185      return true;
20186    if (json.has(prefix+"FamilyMemberHistory"))
20187      return true;
20188    if (json.has(prefix+"Flag"))
20189      return true;
20190    if (json.has(prefix+"Goal"))
20191      return true;
20192    if (json.has(prefix+"GraphDefinition"))
20193      return true;
20194    if (json.has(prefix+"Group"))
20195      return true;
20196    if (json.has(prefix+"GuidanceResponse"))
20197      return true;
20198    if (json.has(prefix+"HealthcareService"))
20199      return true;
20200    if (json.has(prefix+"ImagingManifest"))
20201      return true;
20202    if (json.has(prefix+"ImagingStudy"))
20203      return true;
20204    if (json.has(prefix+"Immunization"))
20205      return true;
20206    if (json.has(prefix+"ImmunizationRecommendation"))
20207      return true;
20208    if (json.has(prefix+"ImplementationGuide"))
20209      return true;
20210    if (json.has(prefix+"Library"))
20211      return true;
20212    if (json.has(prefix+"Linkage"))
20213      return true;
20214    if (json.has(prefix+"List"))
20215      return true;
20216    if (json.has(prefix+"Location"))
20217      return true;
20218    if (json.has(prefix+"Measure"))
20219      return true;
20220    if (json.has(prefix+"MeasureReport"))
20221      return true;
20222    if (json.has(prefix+"Media"))
20223      return true;
20224    if (json.has(prefix+"Medication"))
20225      return true;
20226    if (json.has(prefix+"MedicationAdministration"))
20227      return true;
20228    if (json.has(prefix+"MedicationDispense"))
20229      return true;
20230    if (json.has(prefix+"MedicationRequest"))
20231      return true;
20232    if (json.has(prefix+"MedicationStatement"))
20233      return true;
20234    if (json.has(prefix+"MessageDefinition"))
20235      return true;
20236    if (json.has(prefix+"MessageHeader"))
20237      return true;
20238    if (json.has(prefix+"NamingSystem"))
20239      return true;
20240    if (json.has(prefix+"NutritionOrder"))
20241      return true;
20242    if (json.has(prefix+"Observation"))
20243      return true;
20244    if (json.has(prefix+"OperationDefinition"))
20245      return true;
20246    if (json.has(prefix+"OperationOutcome"))
20247      return true;
20248    if (json.has(prefix+"Organization"))
20249      return true;
20250    if (json.has(prefix+"Patient"))
20251      return true;
20252    if (json.has(prefix+"PaymentNotice"))
20253      return true;
20254    if (json.has(prefix+"PaymentReconciliation"))
20255      return true;
20256    if (json.has(prefix+"Person"))
20257      return true;
20258    if (json.has(prefix+"PlanDefinition"))
20259      return true;
20260    if (json.has(prefix+"Practitioner"))
20261      return true;
20262    if (json.has(prefix+"PractitionerRole"))
20263      return true;
20264    if (json.has(prefix+"Procedure"))
20265      return true;
20266    if (json.has(prefix+"ProcedureRequest"))
20267      return true;
20268    if (json.has(prefix+"ProcessRequest"))
20269      return true;
20270    if (json.has(prefix+"ProcessResponse"))
20271      return true;
20272    if (json.has(prefix+"Provenance"))
20273      return true;
20274    if (json.has(prefix+"Questionnaire"))
20275      return true;
20276    if (json.has(prefix+"QuestionnaireResponse"))
20277      return true;
20278    if (json.has(prefix+"ReferralRequest"))
20279      return true;
20280    if (json.has(prefix+"RelatedPerson"))
20281      return true;
20282    if (json.has(prefix+"RequestGroup"))
20283      return true;
20284    if (json.has(prefix+"ResearchStudy"))
20285      return true;
20286    if (json.has(prefix+"ResearchSubject"))
20287      return true;
20288    if (json.has(prefix+"RiskAssessment"))
20289      return true;
20290    if (json.has(prefix+"Schedule"))
20291      return true;
20292    if (json.has(prefix+"SearchParameter"))
20293      return true;
20294    if (json.has(prefix+"Sequence"))
20295      return true;
20296    if (json.has(prefix+"ServiceDefinition"))
20297      return true;
20298    if (json.has(prefix+"Slot"))
20299      return true;
20300    if (json.has(prefix+"Specimen"))
20301      return true;
20302    if (json.has(prefix+"StructureDefinition"))
20303      return true;
20304    if (json.has(prefix+"StructureMap"))
20305      return true;
20306    if (json.has(prefix+"Subscription"))
20307      return true;
20308    if (json.has(prefix+"Substance"))
20309      return true;
20310    if (json.has(prefix+"SupplyDelivery"))
20311      return true;
20312    if (json.has(prefix+"SupplyRequest"))
20313      return true;
20314    if (json.has(prefix+"Task"))
20315      return true;
20316    if (json.has(prefix+"TestReport"))
20317      return true;
20318    if (json.has(prefix+"TestScript"))
20319      return true;
20320    if (json.has(prefix+"ValueSet"))
20321      return true;
20322    if (json.has(prefix+"VisionPrescription"))
20323      return true;
20324    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
20325      return true;
20326    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
20327      return true;
20328    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
20329      return true;
20330    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
20331      return true;
20332    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
20333      return true;
20334    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
20335      return true;
20336    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
20337      return true;
20338    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
20339      return true;
20340    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
20341      return true;
20342    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
20343      return true;
20344    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
20345      return true;
20346    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
20347      return true;
20348    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
20349      return true;
20350    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
20351      return true;
20352    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
20353      return true;
20354    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
20355      return true;
20356    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
20357      return true;
20358    return false;
20359  }
20360  protected void composeElement(Element element) throws IOException {
20361    if (element.hasId())
20362      prop("id", element.getId());
20363      if (makeComments(element)) {
20364        openArray("fhir_comments");
20365        for (String s : element.getFormatCommentsPre())
20366          prop(null,  s);
20367        for (String s : element.getFormatCommentsPost())
20368          prop(null,  s);
20369         closeArray();
20370      }
20371    if (element.hasExtension()) {
20372      openArray("extension");
20373      for (Extension e : element.getExtension())
20374        composeExtension(null, e);
20375      closeArray();
20376    }
20377  }
20378
20379  protected void composeBackbone(BackboneElement element) throws IOException {
20380    composeElement(element);
20381    if (element.hasModifierExtension()) {
20382      openArray("modifierExtension");
20383      for (Extension e : element.getModifierExtension())
20384        composeExtension(null, e);
20385      closeArray();
20386    }
20387  }
20388
20389  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20390    if (value != null && value.getValue() != null) {
20391      prop(name, e.toCode(value.getValue()));
20392    } else if (inArray)   
20393      writeNull(name);
20394  }    
20395
20396  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
20397    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20398      open(inArray ? null : "_"+name);
20399      composeElement(value);
20400      close();
20401    } else if (inArray)   
20402      writeNull(name);
20403  }    
20404
20405  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
20406    if (value != null && value.hasValue()) {
20407        prop(name, value.asStringValue());
20408    }    
20409    else if (inArray) 
20410      writeNull(name); 
20411  }    
20412
20413  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
20414    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20415      open(inArray ? null : "_"+name);
20416      composeElement(value);
20417      close();
20418    }
20419    else if (inArray) 
20420      writeNull(name); 
20421  }
20422
20423  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
20424    if (value != null && value.hasValue()) {
20425        prop(name, value.asStringValue());
20426    }    
20427    else if (inArray) 
20428      writeNull(name); 
20429  }    
20430
20431  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
20432    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20433      open(inArray ? null : "_"+name);
20434      composeElement(value);
20435      close();
20436    }
20437    else if (inArray) 
20438      writeNull(name); 
20439  }
20440
20441  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
20442    if (value != null && value.hasValue()) {
20443        prop(name, toString(value.getValue()));
20444    }    
20445    else if (inArray) 
20446      writeNull(name); 
20447  }    
20448
20449  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
20450    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20451      open(inArray ? null : "_"+name);
20452      composeElement(value);
20453      close();
20454    }
20455    else if (inArray) 
20456      writeNull(name); 
20457  }
20458
20459  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
20460    if (value != null && value.hasValue()) {
20461        prop(name, toString(value.getValue()));
20462    }    
20463    else if (inArray) 
20464      writeNull(name); 
20465  }    
20466
20467  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
20468    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20469      open(inArray ? null : "_"+name);
20470      composeElement(value);
20471      close();
20472    }
20473    else if (inArray) 
20474      writeNull(name); 
20475  }
20476
20477  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
20478    if (value != null && value.hasValue()) {
20479        prop(name, Integer.valueOf(value.getValue()));
20480    }    
20481    else if (inArray) 
20482      writeNull(name); 
20483  }    
20484
20485  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
20486    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20487      open(inArray ? null : "_"+name);
20488      composeElement(value);
20489      close();
20490    }
20491    else if (inArray) 
20492      writeNull(name); 
20493  }
20494
20495  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
20496    if (value != null && value.hasValue()) {
20497        prop(name, toString(value.getValue()));
20498    }    
20499    else if (inArray) 
20500      writeNull(name); 
20501  }    
20502
20503  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
20504    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20505      open(inArray ? null : "_"+name);
20506      composeElement(value);
20507      close();
20508    }
20509    else if (inArray) 
20510      writeNull(name); 
20511  }
20512
20513  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
20514    if (value != null && value.hasValue()) {
20515        prop(name, toString(value.getValue()));
20516    }    
20517    else if (inArray) 
20518      writeNull(name); 
20519  }    
20520
20521  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
20522    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20523      open(inArray ? null : "_"+name);
20524      composeElement(value);
20525      close();
20526    }
20527    else if (inArray) 
20528      writeNull(name); 
20529  }
20530
20531  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
20532    if (value != null && value.hasValue()) {
20533        prop(name, toString(value.getValue()));
20534    }    
20535    else if (inArray) 
20536      writeNull(name); 
20537  }    
20538
20539  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
20540    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20541      open(inArray ? null : "_"+name);
20542      composeElement(value);
20543      close();
20544    }
20545    else if (inArray) 
20546      writeNull(name); 
20547  }
20548
20549  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
20550    if (value != null && value.hasValue()) {
20551        prop(name, value.asStringValue());
20552    }    
20553    else if (inArray) 
20554      writeNull(name); 
20555  }    
20556
20557  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
20558    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20559      open(inArray ? null : "_"+name);
20560      composeElement(value);
20561      close();
20562    }
20563    else if (inArray) 
20564      writeNull(name); 
20565  }
20566
20567  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
20568    if (value != null && value.hasValue()) {
20569        prop(name, value.getValue());
20570    }    
20571    else if (inArray) 
20572      writeNull(name); 
20573  }    
20574
20575  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
20576    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20577      open(inArray ? null : "_"+name);
20578      composeElement(value);
20579      close();
20580    }
20581    else if (inArray) 
20582      writeNull(name); 
20583  }
20584
20585  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
20586    if (value != null && value.hasValue()) {
20587        prop(name, toString(value.getValue()));
20588    }    
20589    else if (inArray) 
20590      writeNull(name); 
20591  }    
20592
20593  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
20594    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20595      open(inArray ? null : "_"+name);
20596      composeElement(value);
20597      close();
20598    }
20599    else if (inArray) 
20600      writeNull(name); 
20601  }
20602
20603  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
20604    if (value != null && value.hasValue()) {
20605        prop(name, Integer.valueOf(value.getValue()));
20606    }    
20607    else if (inArray) 
20608      writeNull(name); 
20609  }    
20610
20611  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
20612    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20613      open(inArray ? null : "_"+name);
20614      composeElement(value);
20615      close();
20616    }
20617    else if (inArray) 
20618      writeNull(name); 
20619  }
20620
20621  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
20622    if (value != null && value.hasValue()) {
20623        prop(name, toString(value.getValue()));
20624    }    
20625    else if (inArray) 
20626      writeNull(name); 
20627  }    
20628
20629  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
20630    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20631      open(inArray ? null : "_"+name);
20632      composeElement(value);
20633      close();
20634    }
20635    else if (inArray) 
20636      writeNull(name); 
20637  }
20638
20639  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
20640    if (value != null && value.hasValue()) {
20641        prop(name, value.asStringValue());
20642    }    
20643    else if (inArray) 
20644      writeNull(name); 
20645  }    
20646
20647  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
20648    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20649      open(inArray ? null : "_"+name);
20650      composeElement(value);
20651      close();
20652    }
20653    else if (inArray) 
20654      writeNull(name); 
20655  }
20656
20657  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
20658    if (value != null && value.hasValue()) {
20659        prop(name, toString(value.getValue()));
20660    }    
20661    else if (inArray) 
20662      writeNull(name); 
20663  }    
20664
20665  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
20666    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20667      open(inArray ? null : "_"+name);
20668      composeElement(value);
20669      close();
20670    }
20671    else if (inArray) 
20672      writeNull(name); 
20673  }
20674
20675  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
20676    if (value != null && value.hasValue()) {
20677        prop(name, Integer.valueOf(value.getValue()));
20678    }    
20679    else if (inArray) 
20680      writeNull(name); 
20681  }    
20682
20683  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
20684    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20685      open(inArray ? null : "_"+name);
20686      composeElement(value);
20687      close();
20688    }
20689    else if (inArray) 
20690      writeNull(name); 
20691  }
20692
20693  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
20694    if (value != null && value.hasValue()) {
20695        prop(name, value.getValue());
20696    }    
20697    else if (inArray) 
20698      writeNull(name); 
20699  }    
20700
20701  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
20702    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
20703      open(inArray ? null : "_"+name);
20704      composeElement(value);
20705      close();
20706    }
20707    else if (inArray) 
20708      writeNull(name); 
20709  }
20710
20711  protected void composeExtension(String name, Extension element) throws IOException {
20712    if (element != null) {
20713      open(name);
20714      composeExtensionInner(element);
20715      close();
20716    }
20717  }
20718
20719  protected void composeExtensionInner(Extension element) throws IOException {
20720      composeElement(element);
20721      if (element.hasUrlElement()) {
20722        composeUriCore("url", element.getUrlElement(), false);
20723        composeUriExtras("url", element.getUrlElement(), false);
20724      }
20725      if (element.hasValue()) {
20726        composeType("value", element.getValue());
20727      }
20728  }
20729
20730  protected void composeNarrative(String name, Narrative element) throws IOException {
20731    if (element != null) {
20732      open(name);
20733      composeNarrativeInner(element);
20734      close();
20735    }
20736  }
20737
20738  protected void composeNarrativeInner(Narrative element) throws IOException {
20739      composeElement(element);
20740      if (element.hasStatusElement()) {
20741        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
20742        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
20743      }
20744      if (element.hasDiv()) {
20745        XhtmlNode node = element.getDiv();
20746        if (node.getNsDecl() == null) {
20747          node.attribute("xmlns", XHTML_NS);
20748        }
20749        composeXhtml("div", node);
20750      }
20751  }
20752
20753  protected void composeDuration(String name, Duration element) throws IOException {
20754    if (element != null) {
20755      open(name);
20756      composeDurationInner(element);
20757      close();
20758    }
20759  }
20760
20761  protected void composeDurationInner(Duration element) throws IOException {
20762      composeQuantityInner(element);
20763  }
20764
20765  protected void composeCount(String name, Count element) throws IOException {
20766    if (element != null) {
20767      open(name);
20768      composeCountInner(element);
20769      close();
20770    }
20771  }
20772
20773  protected void composeCountInner(Count element) throws IOException {
20774      composeQuantityInner(element);
20775  }
20776
20777  protected void composeMoney(String name, Money element) throws IOException {
20778    if (element != null) {
20779      open(name);
20780      composeMoneyInner(element);
20781      close();
20782    }
20783  }
20784
20785  protected void composeMoneyInner(Money element) throws IOException {
20786      composeQuantityInner(element);
20787  }
20788
20789  protected void composeDistance(String name, Distance element) throws IOException {
20790    if (element != null) {
20791      open(name);
20792      composeDistanceInner(element);
20793      close();
20794    }
20795  }
20796
20797  protected void composeDistanceInner(Distance element) throws IOException {
20798      composeQuantityInner(element);
20799  }
20800
20801  protected void composeAge(String name, Age element) throws IOException {
20802    if (element != null) {
20803      open(name);
20804      composeAgeInner(element);
20805      close();
20806    }
20807  }
20808
20809  protected void composeAgeInner(Age element) throws IOException {
20810      composeQuantityInner(element);
20811  }
20812
20813  protected void composeReference(String name, Reference element) throws IOException {
20814    if (element != null) {
20815      open(name);
20816      composeReferenceInner(element);
20817      close();
20818    }
20819  }
20820
20821  protected void composeReferenceInner(Reference element) throws IOException {
20822      composeElement(element);
20823      if (element.hasReferenceElement()) {
20824        composeStringCore("reference", element.getReferenceElement(), false);
20825        composeStringExtras("reference", element.getReferenceElement(), false);
20826      }
20827      if (element.hasIdentifier()) {
20828        composeIdentifier("identifier", element.getIdentifier());
20829      }
20830      if (element.hasDisplayElement()) {
20831        composeStringCore("display", element.getDisplayElement(), false);
20832        composeStringExtras("display", element.getDisplayElement(), false);
20833      }
20834  }
20835
20836  protected void composeQuantity(String name, Quantity element) throws IOException {
20837    if (element != null) {
20838      open(name);
20839      composeQuantityInner(element);
20840      close();
20841    }
20842  }
20843
20844  protected void composeQuantityInner(Quantity element) throws IOException {
20845      composeElement(element);
20846      if (element.hasValueElement()) {
20847        composeDecimalCore("value", element.getValueElement(), false);
20848        composeDecimalExtras("value", element.getValueElement(), false);
20849      }
20850      if (element.hasComparatorElement()) {
20851        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
20852        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
20853      }
20854      if (element.hasUnitElement()) {
20855        composeStringCore("unit", element.getUnitElement(), false);
20856        composeStringExtras("unit", element.getUnitElement(), false);
20857      }
20858      if (element.hasSystemElement()) {
20859        composeUriCore("system", element.getSystemElement(), false);
20860        composeUriExtras("system", element.getSystemElement(), false);
20861      }
20862      if (element.hasCodeElement()) {
20863        composeCodeCore("code", element.getCodeElement(), false);
20864        composeCodeExtras("code", element.getCodeElement(), false);
20865      }
20866  }
20867
20868  protected void composePeriod(String name, Period element) throws IOException {
20869    if (element != null) {
20870      open(name);
20871      composePeriodInner(element);
20872      close();
20873    }
20874  }
20875
20876  protected void composePeriodInner(Period element) throws IOException {
20877      composeElement(element);
20878      if (element.hasStartElement()) {
20879        composeDateTimeCore("start", element.getStartElement(), false);
20880        composeDateTimeExtras("start", element.getStartElement(), false);
20881      }
20882      if (element.hasEndElement()) {
20883        composeDateTimeCore("end", element.getEndElement(), false);
20884        composeDateTimeExtras("end", element.getEndElement(), false);
20885      }
20886  }
20887
20888  protected void composeAttachment(String name, Attachment element) throws IOException {
20889    if (element != null) {
20890      open(name);
20891      composeAttachmentInner(element);
20892      close();
20893    }
20894  }
20895
20896  protected void composeAttachmentInner(Attachment element) throws IOException {
20897      composeElement(element);
20898      if (element.hasContentTypeElement()) {
20899        composeCodeCore("contentType", element.getContentTypeElement(), false);
20900        composeCodeExtras("contentType", element.getContentTypeElement(), false);
20901      }
20902      if (element.hasLanguageElement()) {
20903        composeCodeCore("language", element.getLanguageElement(), false);
20904        composeCodeExtras("language", element.getLanguageElement(), false);
20905      }
20906      if (element.hasDataElement()) {
20907        composeBase64BinaryCore("data", element.getDataElement(), false);
20908        composeBase64BinaryExtras("data", element.getDataElement(), false);
20909      }
20910      if (element.hasUrlElement()) {
20911        composeUriCore("url", element.getUrlElement(), false);
20912        composeUriExtras("url", element.getUrlElement(), false);
20913      }
20914      if (element.hasSizeElement()) {
20915        composeUnsignedIntCore("size", element.getSizeElement(), false);
20916        composeUnsignedIntExtras("size", element.getSizeElement(), false);
20917      }
20918      if (element.hasHashElement()) {
20919        composeBase64BinaryCore("hash", element.getHashElement(), false);
20920        composeBase64BinaryExtras("hash", element.getHashElement(), false);
20921      }
20922      if (element.hasTitleElement()) {
20923        composeStringCore("title", element.getTitleElement(), false);
20924        composeStringExtras("title", element.getTitleElement(), false);
20925      }
20926      if (element.hasCreationElement()) {
20927        composeDateTimeCore("creation", element.getCreationElement(), false);
20928        composeDateTimeExtras("creation", element.getCreationElement(), false);
20929      }
20930  }
20931
20932  protected void composeRange(String name, Range element) throws IOException {
20933    if (element != null) {
20934      open(name);
20935      composeRangeInner(element);
20936      close();
20937    }
20938  }
20939
20940  protected void composeRangeInner(Range element) throws IOException {
20941      composeElement(element);
20942      if (element.hasLow()) {
20943        composeSimpleQuantity("low", element.getLow());
20944      }
20945      if (element.hasHigh()) {
20946        composeSimpleQuantity("high", element.getHigh());
20947      }
20948  }
20949
20950  protected void composeAnnotation(String name, Annotation element) throws IOException {
20951    if (element != null) {
20952      open(name);
20953      composeAnnotationInner(element);
20954      close();
20955    }
20956  }
20957
20958  protected void composeAnnotationInner(Annotation element) throws IOException {
20959      composeElement(element);
20960      if (element.hasAuthor()) {
20961        composeType("author", element.getAuthor());
20962      }
20963      if (element.hasTimeElement()) {
20964        composeDateTimeCore("time", element.getTimeElement(), false);
20965        composeDateTimeExtras("time", element.getTimeElement(), false);
20966      }
20967      if (element.hasTextElement()) {
20968        composeStringCore("text", element.getTextElement(), false);
20969        composeStringExtras("text", element.getTextElement(), false);
20970      }
20971  }
20972
20973  protected void composeIdentifier(String name, Identifier element) throws IOException {
20974    if (element != null) {
20975      open(name);
20976      composeIdentifierInner(element);
20977      close();
20978    }
20979  }
20980
20981  protected void composeIdentifierInner(Identifier element) throws IOException {
20982      composeElement(element);
20983      if (element.hasUseElement()) {
20984        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
20985        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
20986      }
20987      if (element.hasType()) {
20988        composeCodeableConcept("type", element.getType());
20989      }
20990      if (element.hasSystemElement()) {
20991        composeUriCore("system", element.getSystemElement(), false);
20992        composeUriExtras("system", element.getSystemElement(), false);
20993      }
20994      if (element.hasValueElement()) {
20995        composeStringCore("value", element.getValueElement(), false);
20996        composeStringExtras("value", element.getValueElement(), false);
20997      }
20998      if (element.hasPeriod()) {
20999        composePeriod("period", element.getPeriod());
21000      }
21001      if (element.hasAssigner()) {
21002        composeReference("assigner", element.getAssigner());
21003      }
21004  }
21005
21006  protected void composeCoding(String name, Coding element) throws IOException {
21007    if (element != null) {
21008      open(name);
21009      composeCodingInner(element);
21010      close();
21011    }
21012  }
21013
21014  protected void composeCodingInner(Coding element) throws IOException {
21015      composeElement(element);
21016      if (element.hasSystemElement()) {
21017        composeUriCore("system", element.getSystemElement(), false);
21018        composeUriExtras("system", element.getSystemElement(), false);
21019      }
21020      if (element.hasVersionElement()) {
21021        composeStringCore("version", element.getVersionElement(), false);
21022        composeStringExtras("version", element.getVersionElement(), false);
21023      }
21024      if (element.hasCodeElement()) {
21025        composeCodeCore("code", element.getCodeElement(), false);
21026        composeCodeExtras("code", element.getCodeElement(), false);
21027      }
21028      if (element.hasDisplayElement()) {
21029        composeStringCore("display", element.getDisplayElement(), false);
21030        composeStringExtras("display", element.getDisplayElement(), false);
21031      }
21032      if (element.hasUserSelectedElement()) {
21033        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
21034        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
21035      }
21036  }
21037
21038  protected void composeSignature(String name, Signature element) throws IOException {
21039    if (element != null) {
21040      open(name);
21041      composeSignatureInner(element);
21042      close();
21043    }
21044  }
21045
21046  protected void composeSignatureInner(Signature element) throws IOException {
21047      composeElement(element);
21048      if (element.hasType()) {
21049        openArray("type");
21050        for (Coding e : element.getType()) 
21051          composeCoding(null, e);
21052        closeArray();
21053      };
21054      if (element.hasWhenElement()) {
21055        composeInstantCore("when", element.getWhenElement(), false);
21056        composeInstantExtras("when", element.getWhenElement(), false);
21057      }
21058      if (element.hasWho()) {
21059        composeType("who", element.getWho());
21060      }
21061      if (element.hasOnBehalfOf()) {
21062        composeType("onBehalfOf", element.getOnBehalfOf());
21063      }
21064      if (element.hasContentTypeElement()) {
21065        composeCodeCore("contentType", element.getContentTypeElement(), false);
21066        composeCodeExtras("contentType", element.getContentTypeElement(), false);
21067      }
21068      if (element.hasBlobElement()) {
21069        composeBase64BinaryCore("blob", element.getBlobElement(), false);
21070        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
21071      }
21072  }
21073
21074  protected void composeSampledData(String name, SampledData element) throws IOException {
21075    if (element != null) {
21076      open(name);
21077      composeSampledDataInner(element);
21078      close();
21079    }
21080  }
21081
21082  protected void composeSampledDataInner(SampledData element) throws IOException {
21083      composeElement(element);
21084      if (element.hasOrigin()) {
21085        composeSimpleQuantity("origin", element.getOrigin());
21086      }
21087      if (element.hasPeriodElement()) {
21088        composeDecimalCore("period", element.getPeriodElement(), false);
21089        composeDecimalExtras("period", element.getPeriodElement(), false);
21090      }
21091      if (element.hasFactorElement()) {
21092        composeDecimalCore("factor", element.getFactorElement(), false);
21093        composeDecimalExtras("factor", element.getFactorElement(), false);
21094      }
21095      if (element.hasLowerLimitElement()) {
21096        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
21097        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
21098      }
21099      if (element.hasUpperLimitElement()) {
21100        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
21101        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
21102      }
21103      if (element.hasDimensionsElement()) {
21104        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
21105        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
21106      }
21107      if (element.hasDataElement()) {
21108        composeStringCore("data", element.getDataElement(), false);
21109        composeStringExtras("data", element.getDataElement(), false);
21110      }
21111  }
21112
21113  protected void composeRatio(String name, Ratio element) throws IOException {
21114    if (element != null) {
21115      open(name);
21116      composeRatioInner(element);
21117      close();
21118    }
21119  }
21120
21121  protected void composeRatioInner(Ratio element) throws IOException {
21122      composeElement(element);
21123      if (element.hasNumerator()) {
21124        composeQuantity("numerator", element.getNumerator());
21125      }
21126      if (element.hasDenominator()) {
21127        composeQuantity("denominator", element.getDenominator());
21128      }
21129  }
21130
21131  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
21132    if (element != null) {
21133      open(name);
21134      composeCodeableConceptInner(element);
21135      close();
21136    }
21137  }
21138
21139  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
21140      composeElement(element);
21141      if (element.hasCoding()) {
21142        openArray("coding");
21143        for (Coding e : element.getCoding()) 
21144          composeCoding(null, e);
21145        closeArray();
21146      };
21147      if (element.hasTextElement()) {
21148        composeStringCore("text", element.getTextElement(), false);
21149        composeStringExtras("text", element.getTextElement(), false);
21150      }
21151  }
21152
21153  protected void composeSimpleQuantity(String name, SimpleQuantity element) throws IOException {
21154    if (element != null) {
21155      open(name);
21156      composeSimpleQuantityInner(element);
21157      close();
21158    }
21159  }
21160
21161  protected void composeSimpleQuantityInner(SimpleQuantity element) throws IOException {
21162      composeElement(element);
21163      if (element.hasValueElement()) {
21164        composeDecimalCore("value", element.getValueElement(), false);
21165        composeDecimalExtras("value", element.getValueElement(), false);
21166      }
21167      if (element.hasComparatorElement()) {
21168        composeEnumerationCore("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21169        composeEnumerationExtras("comparator", element.getComparatorElement(), new SimpleQuantity.QuantityComparatorEnumFactory(), false);
21170      }
21171      if (element.hasUnitElement()) {
21172        composeStringCore("unit", element.getUnitElement(), false);
21173        composeStringExtras("unit", element.getUnitElement(), false);
21174      }
21175      if (element.hasSystemElement()) {
21176        composeUriCore("system", element.getSystemElement(), false);
21177        composeUriExtras("system", element.getSystemElement(), false);
21178      }
21179      if (element.hasCodeElement()) {
21180        composeCodeCore("code", element.getCodeElement(), false);
21181        composeCodeExtras("code", element.getCodeElement(), false);
21182      }
21183  }
21184
21185  protected void composeMeta(String name, Meta element) throws IOException {
21186    if (element != null) {
21187      open(name);
21188      composeMetaInner(element);
21189      close();
21190    }
21191  }
21192
21193  protected void composeMetaInner(Meta element) throws IOException {
21194      composeElement(element);
21195      if (element.hasVersionIdElement()) {
21196        composeIdCore("versionId", element.getVersionIdElement(), false);
21197        composeIdExtras("versionId", element.getVersionIdElement(), false);
21198      }
21199      if (element.hasLastUpdatedElement()) {
21200        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
21201        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
21202      }
21203      if (element.hasProfile()) {
21204        openArray("profile");
21205        for (UriType e : element.getProfile()) 
21206          composeUriCore(null, e, true);
21207        closeArray();
21208        if (anyHasExtras(element.getProfile())) {
21209          openArray("_profile");
21210          for (UriType e : element.getProfile()) 
21211            composeUriExtras(null, e, true);
21212          closeArray();
21213        }
21214      };
21215      if (element.hasSecurity()) {
21216        openArray("security");
21217        for (Coding e : element.getSecurity()) 
21218          composeCoding(null, e);
21219        closeArray();
21220      };
21221      if (element.hasTag()) {
21222        openArray("tag");
21223        for (Coding e : element.getTag()) 
21224          composeCoding(null, e);
21225        closeArray();
21226      };
21227  }
21228
21229  protected void composeAddress(String name, Address element) throws IOException {
21230    if (element != null) {
21231      open(name);
21232      composeAddressInner(element);
21233      close();
21234    }
21235  }
21236
21237  protected void composeAddressInner(Address element) throws IOException {
21238      composeElement(element);
21239      if (element.hasUseElement()) {
21240        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21241        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
21242      }
21243      if (element.hasTypeElement()) {
21244        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21245        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
21246      }
21247      if (element.hasTextElement()) {
21248        composeStringCore("text", element.getTextElement(), false);
21249        composeStringExtras("text", element.getTextElement(), false);
21250      }
21251      if (element.hasLine()) {
21252        openArray("line");
21253        for (StringType e : element.getLine()) 
21254          composeStringCore(null, e, true);
21255        closeArray();
21256        if (anyHasExtras(element.getLine())) {
21257          openArray("_line");
21258          for (StringType e : element.getLine()) 
21259            composeStringExtras(null, e, true);
21260          closeArray();
21261        }
21262      };
21263      if (element.hasCityElement()) {
21264        composeStringCore("city", element.getCityElement(), false);
21265        composeStringExtras("city", element.getCityElement(), false);
21266      }
21267      if (element.hasDistrictElement()) {
21268        composeStringCore("district", element.getDistrictElement(), false);
21269        composeStringExtras("district", element.getDistrictElement(), false);
21270      }
21271      if (element.hasStateElement()) {
21272        composeStringCore("state", element.getStateElement(), false);
21273        composeStringExtras("state", element.getStateElement(), false);
21274      }
21275      if (element.hasPostalCodeElement()) {
21276        composeStringCore("postalCode", element.getPostalCodeElement(), false);
21277        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
21278      }
21279      if (element.hasCountryElement()) {
21280        composeStringCore("country", element.getCountryElement(), false);
21281        composeStringExtras("country", element.getCountryElement(), false);
21282      }
21283      if (element.hasPeriod()) {
21284        composePeriod("period", element.getPeriod());
21285      }
21286  }
21287
21288  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
21289    if (element != null) {
21290      open(name);
21291      composeTriggerDefinitionInner(element);
21292      close();
21293    }
21294  }
21295
21296  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
21297      composeElement(element);
21298      if (element.hasTypeElement()) {
21299        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21300        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
21301      }
21302      if (element.hasEventNameElement()) {
21303        composeStringCore("eventName", element.getEventNameElement(), false);
21304        composeStringExtras("eventName", element.getEventNameElement(), false);
21305      }
21306      if (element.hasEventTiming()) {
21307        composeType("eventTiming", element.getEventTiming());
21308      }
21309      if (element.hasEventData()) {
21310        composeDataRequirement("eventData", element.getEventData());
21311      }
21312  }
21313
21314  protected void composeContributor(String name, Contributor element) throws IOException {
21315    if (element != null) {
21316      open(name);
21317      composeContributorInner(element);
21318      close();
21319    }
21320  }
21321
21322  protected void composeContributorInner(Contributor element) throws IOException {
21323      composeElement(element);
21324      if (element.hasTypeElement()) {
21325        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21326        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
21327      }
21328      if (element.hasNameElement()) {
21329        composeStringCore("name", element.getNameElement(), false);
21330        composeStringExtras("name", element.getNameElement(), false);
21331      }
21332      if (element.hasContact()) {
21333        openArray("contact");
21334        for (ContactDetail e : element.getContact()) 
21335          composeContactDetail(null, e);
21336        closeArray();
21337      };
21338  }
21339
21340  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
21341    if (element != null) {
21342      open(name);
21343      composeDataRequirementInner(element);
21344      close();
21345    }
21346  }
21347
21348  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
21349      composeElement(element);
21350      if (element.hasTypeElement()) {
21351        composeCodeCore("type", element.getTypeElement(), false);
21352        composeCodeExtras("type", element.getTypeElement(), false);
21353      }
21354      if (element.hasProfile()) {
21355        openArray("profile");
21356        for (UriType e : element.getProfile()) 
21357          composeUriCore(null, e, true);
21358        closeArray();
21359        if (anyHasExtras(element.getProfile())) {
21360          openArray("_profile");
21361          for (UriType e : element.getProfile()) 
21362            composeUriExtras(null, e, true);
21363          closeArray();
21364        }
21365      };
21366      if (element.hasMustSupport()) {
21367        openArray("mustSupport");
21368        for (StringType e : element.getMustSupport()) 
21369          composeStringCore(null, e, true);
21370        closeArray();
21371        if (anyHasExtras(element.getMustSupport())) {
21372          openArray("_mustSupport");
21373          for (StringType e : element.getMustSupport()) 
21374            composeStringExtras(null, e, true);
21375          closeArray();
21376        }
21377      };
21378      if (element.hasCodeFilter()) {
21379        openArray("codeFilter");
21380        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
21381          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
21382        closeArray();
21383      };
21384      if (element.hasDateFilter()) {
21385        openArray("dateFilter");
21386        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
21387          composeDataRequirementDataRequirementDateFilterComponent(null, e);
21388        closeArray();
21389      };
21390  }
21391
21392  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21393    if (element != null) {
21394      open(name);
21395      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
21396      close();
21397    }
21398  }
21399
21400  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
21401      composeElement(element);
21402      if (element.hasPathElement()) {
21403        composeStringCore("path", element.getPathElement(), false);
21404        composeStringExtras("path", element.getPathElement(), false);
21405      }
21406      if (element.hasValueSet()) {
21407        composeType("valueSet", element.getValueSet());
21408      }
21409      if (element.hasValueCode()) {
21410        openArray("valueCode");
21411        for (CodeType e : element.getValueCode()) 
21412          composeCodeCore(null, e, true);
21413        closeArray();
21414        if (anyHasExtras(element.getValueCode())) {
21415          openArray("_valueCode");
21416          for (CodeType e : element.getValueCode()) 
21417            composeCodeExtras(null, e, true);
21418          closeArray();
21419        }
21420      };
21421      if (element.hasValueCoding()) {
21422        openArray("valueCoding");
21423        for (Coding e : element.getValueCoding()) 
21424          composeCoding(null, e);
21425        closeArray();
21426      };
21427      if (element.hasValueCodeableConcept()) {
21428        openArray("valueCodeableConcept");
21429        for (CodeableConcept e : element.getValueCodeableConcept()) 
21430          composeCodeableConcept(null, e);
21431        closeArray();
21432      };
21433  }
21434
21435  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21436    if (element != null) {
21437      open(name);
21438      composeDataRequirementDataRequirementDateFilterComponentInner(element);
21439      close();
21440    }
21441  }
21442
21443  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
21444      composeElement(element);
21445      if (element.hasPathElement()) {
21446        composeStringCore("path", element.getPathElement(), false);
21447        composeStringExtras("path", element.getPathElement(), false);
21448      }
21449      if (element.hasValue()) {
21450        composeType("value", element.getValue());
21451      }
21452  }
21453
21454  protected void composeDosage(String name, Dosage element) throws IOException {
21455    if (element != null) {
21456      open(name);
21457      composeDosageInner(element);
21458      close();
21459    }
21460  }
21461
21462  protected void composeDosageInner(Dosage element) throws IOException {
21463      composeElement(element);
21464      if (element.hasSequenceElement()) {
21465        composeIntegerCore("sequence", element.getSequenceElement(), false);
21466        composeIntegerExtras("sequence", element.getSequenceElement(), false);
21467      }
21468      if (element.hasTextElement()) {
21469        composeStringCore("text", element.getTextElement(), false);
21470        composeStringExtras("text", element.getTextElement(), false);
21471      }
21472      if (element.hasAdditionalInstruction()) {
21473        openArray("additionalInstruction");
21474        for (CodeableConcept e : element.getAdditionalInstruction()) 
21475          composeCodeableConcept(null, e);
21476        closeArray();
21477      };
21478      if (element.hasPatientInstructionElement()) {
21479        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
21480        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
21481      }
21482      if (element.hasTiming()) {
21483        composeTiming("timing", element.getTiming());
21484      }
21485      if (element.hasAsNeeded()) {
21486        composeType("asNeeded", element.getAsNeeded());
21487      }
21488      if (element.hasSite()) {
21489        composeCodeableConcept("site", element.getSite());
21490      }
21491      if (element.hasRoute()) {
21492        composeCodeableConcept("route", element.getRoute());
21493      }
21494      if (element.hasMethod()) {
21495        composeCodeableConcept("method", element.getMethod());
21496      }
21497      if (element.hasDose()) {
21498        composeType("dose", element.getDose());
21499      }
21500      if (element.hasMaxDosePerPeriod()) {
21501        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
21502      }
21503      if (element.hasMaxDosePerAdministration()) {
21504        composeSimpleQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
21505      }
21506      if (element.hasMaxDosePerLifetime()) {
21507        composeSimpleQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
21508      }
21509      if (element.hasRate()) {
21510        composeType("rate", element.getRate());
21511      }
21512  }
21513
21514  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
21515    if (element != null) {
21516      open(name);
21517      composeRelatedArtifactInner(element);
21518      close();
21519    }
21520  }
21521
21522  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
21523      composeElement(element);
21524      if (element.hasTypeElement()) {
21525        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21526        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
21527      }
21528      if (element.hasDisplayElement()) {
21529        composeStringCore("display", element.getDisplayElement(), false);
21530        composeStringExtras("display", element.getDisplayElement(), false);
21531      }
21532      if (element.hasCitationElement()) {
21533        composeStringCore("citation", element.getCitationElement(), false);
21534        composeStringExtras("citation", element.getCitationElement(), false);
21535      }
21536      if (element.hasUrlElement()) {
21537        composeUriCore("url", element.getUrlElement(), false);
21538        composeUriExtras("url", element.getUrlElement(), false);
21539      }
21540      if (element.hasDocument()) {
21541        composeAttachment("document", element.getDocument());
21542      }
21543      if (element.hasResource()) {
21544        composeReference("resource", element.getResource());
21545      }
21546  }
21547
21548  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
21549    if (element != null) {
21550      open(name);
21551      composeContactDetailInner(element);
21552      close();
21553    }
21554  }
21555
21556  protected void composeContactDetailInner(ContactDetail element) throws IOException {
21557      composeElement(element);
21558      if (element.hasNameElement()) {
21559        composeStringCore("name", element.getNameElement(), false);
21560        composeStringExtras("name", element.getNameElement(), false);
21561      }
21562      if (element.hasTelecom()) {
21563        openArray("telecom");
21564        for (ContactPoint e : element.getTelecom()) 
21565          composeContactPoint(null, e);
21566        closeArray();
21567      };
21568  }
21569
21570  protected void composeHumanName(String name, HumanName element) throws IOException {
21571    if (element != null) {
21572      open(name);
21573      composeHumanNameInner(element);
21574      close();
21575    }
21576  }
21577
21578  protected void composeHumanNameInner(HumanName element) throws IOException {
21579      composeElement(element);
21580      if (element.hasUseElement()) {
21581        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21582        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
21583      }
21584      if (element.hasTextElement()) {
21585        composeStringCore("text", element.getTextElement(), false);
21586        composeStringExtras("text", element.getTextElement(), false);
21587      }
21588      if (element.hasFamilyElement()) {
21589        composeStringCore("family", element.getFamilyElement(), false);
21590        composeStringExtras("family", element.getFamilyElement(), false);
21591      }
21592      if (element.hasGiven()) {
21593        openArray("given");
21594        for (StringType e : element.getGiven()) 
21595          composeStringCore(null, e, true);
21596        closeArray();
21597        if (anyHasExtras(element.getGiven())) {
21598          openArray("_given");
21599          for (StringType e : element.getGiven()) 
21600            composeStringExtras(null, e, true);
21601          closeArray();
21602        }
21603      };
21604      if (element.hasPrefix()) {
21605        openArray("prefix");
21606        for (StringType e : element.getPrefix()) 
21607          composeStringCore(null, e, true);
21608        closeArray();
21609        if (anyHasExtras(element.getPrefix())) {
21610          openArray("_prefix");
21611          for (StringType e : element.getPrefix()) 
21612            composeStringExtras(null, e, true);
21613          closeArray();
21614        }
21615      };
21616      if (element.hasSuffix()) {
21617        openArray("suffix");
21618        for (StringType e : element.getSuffix()) 
21619          composeStringCore(null, e, true);
21620        closeArray();
21621        if (anyHasExtras(element.getSuffix())) {
21622          openArray("_suffix");
21623          for (StringType e : element.getSuffix()) 
21624            composeStringExtras(null, e, true);
21625          closeArray();
21626        }
21627      };
21628      if (element.hasPeriod()) {
21629        composePeriod("period", element.getPeriod());
21630      }
21631  }
21632
21633  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
21634    if (element != null) {
21635      open(name);
21636      composeContactPointInner(element);
21637      close();
21638    }
21639  }
21640
21641  protected void composeContactPointInner(ContactPoint element) throws IOException {
21642      composeElement(element);
21643      if (element.hasSystemElement()) {
21644        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21645        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
21646      }
21647      if (element.hasValueElement()) {
21648        composeStringCore("value", element.getValueElement(), false);
21649        composeStringExtras("value", element.getValueElement(), false);
21650      }
21651      if (element.hasUseElement()) {
21652        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21653        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
21654      }
21655      if (element.hasRankElement()) {
21656        composePositiveIntCore("rank", element.getRankElement(), false);
21657        composePositiveIntExtras("rank", element.getRankElement(), false);
21658      }
21659      if (element.hasPeriod()) {
21660        composePeriod("period", element.getPeriod());
21661      }
21662  }
21663
21664  protected void composeUsageContext(String name, UsageContext element) throws IOException {
21665    if (element != null) {
21666      open(name);
21667      composeUsageContextInner(element);
21668      close();
21669    }
21670  }
21671
21672  protected void composeUsageContextInner(UsageContext element) throws IOException {
21673      composeElement(element);
21674      if (element.hasCode()) {
21675        composeCoding("code", element.getCode());
21676      }
21677      if (element.hasValue()) {
21678        composeType("value", element.getValue());
21679      }
21680  }
21681
21682  protected void composeTiming(String name, Timing element) throws IOException {
21683    if (element != null) {
21684      open(name);
21685      composeTimingInner(element);
21686      close();
21687    }
21688  }
21689
21690  protected void composeTimingInner(Timing element) throws IOException {
21691      composeElement(element);
21692      if (element.hasEvent()) {
21693        openArray("event");
21694        for (DateTimeType e : element.getEvent()) 
21695          composeDateTimeCore(null, e, true);
21696        closeArray();
21697        if (anyHasExtras(element.getEvent())) {
21698          openArray("_event");
21699          for (DateTimeType e : element.getEvent()) 
21700            composeDateTimeExtras(null, e, true);
21701          closeArray();
21702        }
21703      };
21704      if (element.hasRepeat()) {
21705        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
21706      }
21707      if (element.hasCode()) {
21708        composeCodeableConcept("code", element.getCode());
21709      }
21710  }
21711
21712  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
21713    if (element != null) {
21714      open(name);
21715      composeTimingTimingRepeatComponentInner(element);
21716      close();
21717    }
21718  }
21719
21720  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
21721      composeElement(element);
21722      if (element.hasBounds()) {
21723        composeType("bounds", element.getBounds());
21724      }
21725      if (element.hasCountElement()) {
21726        composeIntegerCore("count", element.getCountElement(), false);
21727        composeIntegerExtras("count", element.getCountElement(), false);
21728      }
21729      if (element.hasCountMaxElement()) {
21730        composeIntegerCore("countMax", element.getCountMaxElement(), false);
21731        composeIntegerExtras("countMax", element.getCountMaxElement(), false);
21732      }
21733      if (element.hasDurationElement()) {
21734        composeDecimalCore("duration", element.getDurationElement(), false);
21735        composeDecimalExtras("duration", element.getDurationElement(), false);
21736      }
21737      if (element.hasDurationMaxElement()) {
21738        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
21739        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
21740      }
21741      if (element.hasDurationUnitElement()) {
21742        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21743        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21744      }
21745      if (element.hasFrequencyElement()) {
21746        composeIntegerCore("frequency", element.getFrequencyElement(), false);
21747        composeIntegerExtras("frequency", element.getFrequencyElement(), false);
21748      }
21749      if (element.hasFrequencyMaxElement()) {
21750        composeIntegerCore("frequencyMax", element.getFrequencyMaxElement(), false);
21751        composeIntegerExtras("frequencyMax", element.getFrequencyMaxElement(), false);
21752      }
21753      if (element.hasPeriodElement()) {
21754        composeDecimalCore("period", element.getPeriodElement(), false);
21755        composeDecimalExtras("period", element.getPeriodElement(), false);
21756      }
21757      if (element.hasPeriodMaxElement()) {
21758        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
21759        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
21760      }
21761      if (element.hasPeriodUnitElement()) {
21762        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21763        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
21764      }
21765      if (element.hasDayOfWeek()) {
21766        openArray("dayOfWeek");
21767        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
21768          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
21769        closeArray();
21770        if (anyHasExtras(element.getDayOfWeek())) {
21771          openArray("_dayOfWeek");
21772          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
21773            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
21774          closeArray();
21775        }
21776      };
21777      if (element.hasTimeOfDay()) {
21778        openArray("timeOfDay");
21779        for (TimeType e : element.getTimeOfDay()) 
21780          composeTimeCore(null, e, true);
21781        closeArray();
21782        if (anyHasExtras(element.getTimeOfDay())) {
21783          openArray("_timeOfDay");
21784          for (TimeType e : element.getTimeOfDay()) 
21785            composeTimeExtras(null, e, true);
21786          closeArray();
21787        }
21788      };
21789      if (element.hasWhen()) {
21790        openArray("when");
21791        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
21792          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
21793        closeArray();
21794        if (anyHasExtras(element.getWhen())) {
21795          openArray("_when");
21796          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
21797            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
21798          closeArray();
21799        }
21800      };
21801      if (element.hasOffsetElement()) {
21802        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
21803        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
21804      }
21805  }
21806
21807  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
21808    if (element != null) {
21809      open(name);
21810      composeElementDefinitionInner(element);
21811      close();
21812    }
21813  }
21814
21815  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
21816      composeElement(element);
21817      if (element.hasPathElement()) {
21818        composeStringCore("path", element.getPathElement(), false);
21819        composeStringExtras("path", element.getPathElement(), false);
21820      }
21821      if (element.hasRepresentation()) {
21822        openArray("representation");
21823        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
21824          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
21825        closeArray();
21826        if (anyHasExtras(element.getRepresentation())) {
21827          openArray("_representation");
21828          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
21829            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
21830          closeArray();
21831        }
21832      };
21833      if (element.hasSliceNameElement()) {
21834        composeStringCore("sliceName", element.getSliceNameElement(), false);
21835        composeStringExtras("sliceName", element.getSliceNameElement(), false);
21836      }
21837      if (element.hasLabelElement()) {
21838        composeStringCore("label", element.getLabelElement(), false);
21839        composeStringExtras("label", element.getLabelElement(), false);
21840      }
21841      if (element.hasCode()) {
21842        openArray("code");
21843        for (Coding e : element.getCode()) 
21844          composeCoding(null, e);
21845        closeArray();
21846      };
21847      if (element.hasSlicing()) {
21848        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
21849      }
21850      if (element.hasShortElement()) {
21851        composeStringCore("short", element.getShortElement(), false);
21852        composeStringExtras("short", element.getShortElement(), false);
21853      }
21854      if (element.hasDefinitionElement()) {
21855        composeMarkdownCore("definition", element.getDefinitionElement(), false);
21856        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
21857      }
21858      if (element.hasCommentElement()) {
21859        composeMarkdownCore("comment", element.getCommentElement(), false);
21860        composeMarkdownExtras("comment", element.getCommentElement(), false);
21861      }
21862      if (element.hasRequirementsElement()) {
21863        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
21864        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
21865      }
21866      if (element.hasAlias()) {
21867        openArray("alias");
21868        for (StringType e : element.getAlias()) 
21869          composeStringCore(null, e, true);
21870        closeArray();
21871        if (anyHasExtras(element.getAlias())) {
21872          openArray("_alias");
21873          for (StringType e : element.getAlias()) 
21874            composeStringExtras(null, e, true);
21875          closeArray();
21876        }
21877      };
21878      if (element.hasMinElement()) {
21879        composeUnsignedIntCore("min", element.getMinElement(), false);
21880        composeUnsignedIntExtras("min", element.getMinElement(), false);
21881      }
21882      if (element.hasMaxElement()) {
21883        composeStringCore("max", element.getMaxElement(), false);
21884        composeStringExtras("max", element.getMaxElement(), false);
21885      }
21886      if (element.hasBase()) {
21887        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
21888      }
21889      if (element.hasContentReferenceElement()) {
21890        composeUriCore("contentReference", element.getContentReferenceElement(), false);
21891        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
21892      }
21893      if (element.hasType()) {
21894        openArray("type");
21895        for (ElementDefinition.TypeRefComponent e : element.getType()) 
21896          composeElementDefinitionTypeRefComponent(null, e);
21897        closeArray();
21898      };
21899      if (element.hasDefaultValue()) {
21900        composeType("defaultValue", element.getDefaultValue());
21901      }
21902      if (element.hasMeaningWhenMissingElement()) {
21903        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
21904        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
21905      }
21906      if (element.hasOrderMeaningElement()) {
21907        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
21908        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
21909      }
21910      if (element.hasFixed()) {
21911        composeType("fixed", element.getFixed());
21912      }
21913      if (element.hasPattern()) {
21914        composeType("pattern", element.getPattern());
21915      }
21916      if (element.hasExample()) {
21917        openArray("example");
21918        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
21919          composeElementDefinitionElementDefinitionExampleComponent(null, e);
21920        closeArray();
21921      };
21922      if (element.hasMinValue()) {
21923        composeType("minValue", element.getMinValue());
21924      }
21925      if (element.hasMaxValue()) {
21926        composeType("maxValue", element.getMaxValue());
21927      }
21928      if (element.hasMaxLengthElement()) {
21929        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
21930        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
21931      }
21932      if (element.hasCondition()) {
21933        openArray("condition");
21934        for (IdType e : element.getCondition()) 
21935          composeIdCore(null, e, true);
21936        closeArray();
21937        if (anyHasExtras(element.getCondition())) {
21938          openArray("_condition");
21939          for (IdType e : element.getCondition()) 
21940            composeIdExtras(null, e, true);
21941          closeArray();
21942        }
21943      };
21944      if (element.hasConstraint()) {
21945        openArray("constraint");
21946        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
21947          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
21948        closeArray();
21949      };
21950      if (element.hasMustSupportElement()) {
21951        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
21952        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
21953      }
21954      if (element.hasIsModifierElement()) {
21955        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
21956        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
21957      }
21958      if (element.hasIsSummaryElement()) {
21959        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
21960        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
21961      }
21962      if (element.hasBinding()) {
21963        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
21964      }
21965      if (element.hasMapping()) {
21966        openArray("mapping");
21967        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
21968          composeElementDefinitionElementDefinitionMappingComponent(null, e);
21969        closeArray();
21970      };
21971  }
21972
21973  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
21974    if (element != null) {
21975      open(name);
21976      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
21977      close();
21978    }
21979  }
21980
21981  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
21982      composeElement(element);
21983      if (element.hasDiscriminator()) {
21984        openArray("discriminator");
21985        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
21986          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
21987        closeArray();
21988      };
21989      if (element.hasDescriptionElement()) {
21990        composeStringCore("description", element.getDescriptionElement(), false);
21991        composeStringExtras("description", element.getDescriptionElement(), false);
21992      }
21993      if (element.hasOrderedElement()) {
21994        composeBooleanCore("ordered", element.getOrderedElement(), false);
21995        composeBooleanExtras("ordered", element.getOrderedElement(), false);
21996      }
21997      if (element.hasRulesElement()) {
21998        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
21999        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
22000      }
22001  }
22002
22003  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
22004    if (element != null) {
22005      open(name);
22006      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
22007      close();
22008    }
22009  }
22010
22011  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
22012      composeElement(element);
22013      if (element.hasTypeElement()) {
22014        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
22015        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
22016      }
22017      if (element.hasPathElement()) {
22018        composeStringCore("path", element.getPathElement(), false);
22019        composeStringExtras("path", element.getPathElement(), false);
22020      }
22021  }
22022
22023  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22024    if (element != null) {
22025      open(name);
22026      composeElementDefinitionElementDefinitionBaseComponentInner(element);
22027      close();
22028    }
22029  }
22030
22031  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
22032      composeElement(element);
22033      if (element.hasPathElement()) {
22034        composeStringCore("path", element.getPathElement(), false);
22035        composeStringExtras("path", element.getPathElement(), false);
22036      }
22037      if (element.hasMinElement()) {
22038        composeUnsignedIntCore("min", element.getMinElement(), false);
22039        composeUnsignedIntExtras("min", element.getMinElement(), false);
22040      }
22041      if (element.hasMaxElement()) {
22042        composeStringCore("max", element.getMaxElement(), false);
22043        composeStringExtras("max", element.getMaxElement(), false);
22044      }
22045  }
22046
22047  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
22048    if (element != null) {
22049      open(name);
22050      composeElementDefinitionTypeRefComponentInner(element);
22051      close();
22052    }
22053  }
22054
22055  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
22056      composeElement(element);
22057      if (element.hasCodeElement()) {
22058        composeUriCore("code", element.getCodeElement(), false);
22059        composeUriExtras("code", element.getCodeElement(), false);
22060      }
22061      if (element.hasProfileElement()) {
22062        composeUriCore("profile", element.getProfileElement(), false);
22063        composeUriExtras("profile", element.getProfileElement(), false);
22064      }
22065      if (element.hasTargetProfileElement()) {
22066        composeUriCore("targetProfile", element.getTargetProfileElement(), false);
22067        composeUriExtras("targetProfile", element.getTargetProfileElement(), false);
22068      }
22069      if (element.hasAggregation()) {
22070        openArray("aggregation");
22071        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22072          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22073        closeArray();
22074        if (anyHasExtras(element.getAggregation())) {
22075          openArray("_aggregation");
22076          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
22077            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
22078          closeArray();
22079        }
22080      };
22081      if (element.hasVersioningElement()) {
22082        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22083        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
22084      }
22085  }
22086
22087  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22088    if (element != null) {
22089      open(name);
22090      composeElementDefinitionElementDefinitionExampleComponentInner(element);
22091      close();
22092    }
22093  }
22094
22095  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
22096      composeElement(element);
22097      if (element.hasLabelElement()) {
22098        composeStringCore("label", element.getLabelElement(), false);
22099        composeStringExtras("label", element.getLabelElement(), false);
22100      }
22101      if (element.hasValue()) {
22102        composeType("value", element.getValue());
22103      }
22104  }
22105
22106  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22107    if (element != null) {
22108      open(name);
22109      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
22110      close();
22111    }
22112  }
22113
22114  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
22115      composeElement(element);
22116      if (element.hasKeyElement()) {
22117        composeIdCore("key", element.getKeyElement(), false);
22118        composeIdExtras("key", element.getKeyElement(), false);
22119      }
22120      if (element.hasRequirementsElement()) {
22121        composeStringCore("requirements", element.getRequirementsElement(), false);
22122        composeStringExtras("requirements", element.getRequirementsElement(), false);
22123      }
22124      if (element.hasSeverityElement()) {
22125        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22126        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
22127      }
22128      if (element.hasHumanElement()) {
22129        composeStringCore("human", element.getHumanElement(), false);
22130        composeStringExtras("human", element.getHumanElement(), false);
22131      }
22132      if (element.hasExpressionElement()) {
22133        composeStringCore("expression", element.getExpressionElement(), false);
22134        composeStringExtras("expression", element.getExpressionElement(), false);
22135      }
22136      if (element.hasXpathElement()) {
22137        composeStringCore("xpath", element.getXpathElement(), false);
22138        composeStringExtras("xpath", element.getXpathElement(), false);
22139      }
22140      if (element.hasSourceElement()) {
22141        composeUriCore("source", element.getSourceElement(), false);
22142        composeUriExtras("source", element.getSourceElement(), false);
22143      }
22144  }
22145
22146  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22147    if (element != null) {
22148      open(name);
22149      composeElementDefinitionElementDefinitionBindingComponentInner(element);
22150      close();
22151    }
22152  }
22153
22154  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
22155      composeElement(element);
22156      if (element.hasStrengthElement()) {
22157        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22158        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
22159      }
22160      if (element.hasDescriptionElement()) {
22161        composeStringCore("description", element.getDescriptionElement(), false);
22162        composeStringExtras("description", element.getDescriptionElement(), false);
22163      }
22164      if (element.hasValueSet()) {
22165        composeType("valueSet", element.getValueSet());
22166      }
22167  }
22168
22169  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22170    if (element != null) {
22171      open(name);
22172      composeElementDefinitionElementDefinitionMappingComponentInner(element);
22173      close();
22174    }
22175  }
22176
22177  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
22178      composeElement(element);
22179      if (element.hasIdentityElement()) {
22180        composeIdCore("identity", element.getIdentityElement(), false);
22181        composeIdExtras("identity", element.getIdentityElement(), false);
22182      }
22183      if (element.hasLanguageElement()) {
22184        composeCodeCore("language", element.getLanguageElement(), false);
22185        composeCodeExtras("language", element.getLanguageElement(), false);
22186      }
22187      if (element.hasMapElement()) {
22188        composeStringCore("map", element.getMapElement(), false);
22189        composeStringExtras("map", element.getMapElement(), false);
22190      }
22191      if (element.hasCommentElement()) {
22192        composeStringCore("comment", element.getCommentElement(), false);
22193        composeStringExtras("comment", element.getCommentElement(), false);
22194      }
22195  }
22196
22197  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
22198    if (element != null) {
22199      open(name);
22200      composeParameterDefinitionInner(element);
22201      close();
22202    }
22203  }
22204
22205  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
22206      composeElement(element);
22207      if (element.hasNameElement()) {
22208        composeCodeCore("name", element.getNameElement(), false);
22209        composeCodeExtras("name", element.getNameElement(), false);
22210      }
22211      if (element.hasUseElement()) {
22212        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22213        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
22214      }
22215      if (element.hasMinElement()) {
22216        composeIntegerCore("min", element.getMinElement(), false);
22217        composeIntegerExtras("min", element.getMinElement(), false);
22218      }
22219      if (element.hasMaxElement()) {
22220        composeStringCore("max", element.getMaxElement(), false);
22221        composeStringExtras("max", element.getMaxElement(), false);
22222      }
22223      if (element.hasDocumentationElement()) {
22224        composeStringCore("documentation", element.getDocumentationElement(), false);
22225        composeStringExtras("documentation", element.getDocumentationElement(), false);
22226      }
22227      if (element.hasTypeElement()) {
22228        composeCodeCore("type", element.getTypeElement(), false);
22229        composeCodeExtras("type", element.getTypeElement(), false);
22230      }
22231      if (element.hasProfile()) {
22232        composeReference("profile", element.getProfile());
22233      }
22234  }
22235
22236  protected void composeDomainResourceElements(DomainResource element) throws IOException {
22237      composeResourceElements(element);
22238      if (element.hasText()) {
22239        composeNarrative("text", element.getText());
22240      }
22241      if (element.hasContained()) {
22242        openArray("contained");
22243        for (Resource e : element.getContained()) {
22244          open(null);
22245          composeResource(e);
22246          close();
22247        }
22248        closeArray();
22249      };
22250      if (element.hasExtension()) {
22251        openArray("extension");
22252        for (Extension e : element.getExtension()) 
22253          composeExtension(null, e);
22254        closeArray();
22255      };
22256      if (element.hasModifierExtension()) {
22257        openArray("modifierExtension");
22258        for (Extension e : element.getModifierExtension()) 
22259          composeExtension(null, e);
22260        closeArray();
22261      };
22262  }
22263
22264  protected void composeParameters(String name, Parameters element) throws IOException {
22265    if (element != null) {
22266      prop("resourceType", name);
22267      composeParametersInner(element);
22268    }
22269  }
22270
22271  protected void composeParametersInner(Parameters element) throws IOException {
22272      composeResourceElements(element);
22273      if (element.hasParameter()) {
22274        openArray("parameter");
22275        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
22276          composeParametersParametersParameterComponent(null, e);
22277        closeArray();
22278      };
22279  }
22280
22281  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
22282    if (element != null) {
22283      open(name);
22284      composeParametersParametersParameterComponentInner(element);
22285      close();
22286    }
22287  }
22288
22289  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
22290      composeBackbone(element);
22291      if (element.hasNameElement()) {
22292        composeStringCore("name", element.getNameElement(), false);
22293        composeStringExtras("name", element.getNameElement(), false);
22294      }
22295      if (element.hasValue()) {
22296        composeType("value", element.getValue());
22297      }
22298        if (element.hasResource()) {
22299          open("resource");
22300          composeResource(element.getResource());
22301          close();
22302        }
22303      if (element.hasPart()) {
22304        openArray("part");
22305        for (Parameters.ParametersParameterComponent e : element.getPart()) 
22306          composeParametersParametersParameterComponent(null, e);
22307        closeArray();
22308      };
22309  }
22310
22311  protected void composeResourceElements(Resource element) throws IOException {
22312      if (element.hasIdElement()) {
22313        composeIdCore("id", element.getIdElement(), false);
22314        composeIdExtras("id", element.getIdElement(), false);
22315      }
22316      if (element.hasMeta()) {
22317        composeMeta("meta", element.getMeta());
22318      }
22319      if (element.hasImplicitRulesElement()) {
22320        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
22321        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
22322      }
22323      if (element.hasLanguageElement()) {
22324        composeCodeCore("language", element.getLanguageElement(), false);
22325        composeCodeExtras("language", element.getLanguageElement(), false);
22326      }
22327  }
22328
22329  protected void composeAccount(String name, Account element) throws IOException {
22330    if (element != null) {
22331      prop("resourceType", name);
22332      composeAccountInner(element);
22333    }
22334  }
22335
22336  protected void composeAccountInner(Account element) throws IOException {
22337      composeDomainResourceElements(element);
22338      if (element.hasIdentifier()) {
22339        openArray("identifier");
22340        for (Identifier e : element.getIdentifier()) 
22341          composeIdentifier(null, e);
22342        closeArray();
22343      };
22344      if (element.hasStatusElement()) {
22345        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22346        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
22347      }
22348      if (element.hasType()) {
22349        composeCodeableConcept("type", element.getType());
22350      }
22351      if (element.hasNameElement()) {
22352        composeStringCore("name", element.getNameElement(), false);
22353        composeStringExtras("name", element.getNameElement(), false);
22354      }
22355      if (element.hasSubject()) {
22356        composeReference("subject", element.getSubject());
22357      }
22358      if (element.hasPeriod()) {
22359        composePeriod("period", element.getPeriod());
22360      }
22361      if (element.hasActive()) {
22362        composePeriod("active", element.getActive());
22363      }
22364      if (element.hasBalance()) {
22365        composeMoney("balance", element.getBalance());
22366      }
22367      if (element.hasCoverage()) {
22368        openArray("coverage");
22369        for (Account.CoverageComponent e : element.getCoverage()) 
22370          composeAccountCoverageComponent(null, e);
22371        closeArray();
22372      };
22373      if (element.hasOwner()) {
22374        composeReference("owner", element.getOwner());
22375      }
22376      if (element.hasDescriptionElement()) {
22377        composeStringCore("description", element.getDescriptionElement(), false);
22378        composeStringExtras("description", element.getDescriptionElement(), false);
22379      }
22380      if (element.hasGuarantor()) {
22381        openArray("guarantor");
22382        for (Account.GuarantorComponent e : element.getGuarantor()) 
22383          composeAccountGuarantorComponent(null, e);
22384        closeArray();
22385      };
22386  }
22387
22388  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
22389    if (element != null) {
22390      open(name);
22391      composeAccountCoverageComponentInner(element);
22392      close();
22393    }
22394  }
22395
22396  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
22397      composeBackbone(element);
22398      if (element.hasCoverage()) {
22399        composeReference("coverage", element.getCoverage());
22400      }
22401      if (element.hasPriorityElement()) {
22402        composePositiveIntCore("priority", element.getPriorityElement(), false);
22403        composePositiveIntExtras("priority", element.getPriorityElement(), false);
22404      }
22405  }
22406
22407  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
22408    if (element != null) {
22409      open(name);
22410      composeAccountGuarantorComponentInner(element);
22411      close();
22412    }
22413  }
22414
22415  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
22416      composeBackbone(element);
22417      if (element.hasParty()) {
22418        composeReference("party", element.getParty());
22419      }
22420      if (element.hasOnHoldElement()) {
22421        composeBooleanCore("onHold", element.getOnHoldElement(), false);
22422        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
22423      }
22424      if (element.hasPeriod()) {
22425        composePeriod("period", element.getPeriod());
22426      }
22427  }
22428
22429  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
22430    if (element != null) {
22431      prop("resourceType", name);
22432      composeActivityDefinitionInner(element);
22433    }
22434  }
22435
22436  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
22437      composeDomainResourceElements(element);
22438      if (element.hasUrlElement()) {
22439        composeUriCore("url", element.getUrlElement(), false);
22440        composeUriExtras("url", element.getUrlElement(), false);
22441      }
22442      if (element.hasIdentifier()) {
22443        openArray("identifier");
22444        for (Identifier e : element.getIdentifier()) 
22445          composeIdentifier(null, e);
22446        closeArray();
22447      };
22448      if (element.hasVersionElement()) {
22449        composeStringCore("version", element.getVersionElement(), false);
22450        composeStringExtras("version", element.getVersionElement(), false);
22451      }
22452      if (element.hasNameElement()) {
22453        composeStringCore("name", element.getNameElement(), false);
22454        composeStringExtras("name", element.getNameElement(), false);
22455      }
22456      if (element.hasTitleElement()) {
22457        composeStringCore("title", element.getTitleElement(), false);
22458        composeStringExtras("title", element.getTitleElement(), false);
22459      }
22460      if (element.hasStatusElement()) {
22461        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22462        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
22463      }
22464      if (element.hasExperimentalElement()) {
22465        composeBooleanCore("experimental", element.getExperimentalElement(), false);
22466        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
22467      }
22468      if (element.hasDateElement()) {
22469        composeDateTimeCore("date", element.getDateElement(), false);
22470        composeDateTimeExtras("date", element.getDateElement(), false);
22471      }
22472      if (element.hasPublisherElement()) {
22473        composeStringCore("publisher", element.getPublisherElement(), false);
22474        composeStringExtras("publisher", element.getPublisherElement(), false);
22475      }
22476      if (element.hasDescriptionElement()) {
22477        composeMarkdownCore("description", element.getDescriptionElement(), false);
22478        composeMarkdownExtras("description", element.getDescriptionElement(), false);
22479      }
22480      if (element.hasPurposeElement()) {
22481        composeMarkdownCore("purpose", element.getPurposeElement(), false);
22482        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
22483      }
22484      if (element.hasUsageElement()) {
22485        composeStringCore("usage", element.getUsageElement(), false);
22486        composeStringExtras("usage", element.getUsageElement(), false);
22487      }
22488      if (element.hasApprovalDateElement()) {
22489        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
22490        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
22491      }
22492      if (element.hasLastReviewDateElement()) {
22493        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
22494        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
22495      }
22496      if (element.hasEffectivePeriod()) {
22497        composePeriod("effectivePeriod", element.getEffectivePeriod());
22498      }
22499      if (element.hasUseContext()) {
22500        openArray("useContext");
22501        for (UsageContext e : element.getUseContext()) 
22502          composeUsageContext(null, e);
22503        closeArray();
22504      };
22505      if (element.hasJurisdiction()) {
22506        openArray("jurisdiction");
22507        for (CodeableConcept e : element.getJurisdiction()) 
22508          composeCodeableConcept(null, e);
22509        closeArray();
22510      };
22511      if (element.hasTopic()) {
22512        openArray("topic");
22513        for (CodeableConcept e : element.getTopic()) 
22514          composeCodeableConcept(null, e);
22515        closeArray();
22516      };
22517      if (element.hasContributor()) {
22518        openArray("contributor");
22519        for (Contributor e : element.getContributor()) 
22520          composeContributor(null, e);
22521        closeArray();
22522      };
22523      if (element.hasContact()) {
22524        openArray("contact");
22525        for (ContactDetail e : element.getContact()) 
22526          composeContactDetail(null, e);
22527        closeArray();
22528      };
22529      if (element.hasCopyrightElement()) {
22530        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
22531        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
22532      }
22533      if (element.hasRelatedArtifact()) {
22534        openArray("relatedArtifact");
22535        for (RelatedArtifact e : element.getRelatedArtifact()) 
22536          composeRelatedArtifact(null, e);
22537        closeArray();
22538      };
22539      if (element.hasLibrary()) {
22540        openArray("library");
22541        for (Reference e : element.getLibrary()) 
22542          composeReference(null, e);
22543        closeArray();
22544      };
22545      if (element.hasKindElement()) {
22546        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22547        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
22548      }
22549      if (element.hasCode()) {
22550        composeCodeableConcept("code", element.getCode());
22551      }
22552      if (element.hasTiming()) {
22553        composeType("timing", element.getTiming());
22554      }
22555      if (element.hasLocation()) {
22556        composeReference("location", element.getLocation());
22557      }
22558      if (element.hasParticipant()) {
22559        openArray("participant");
22560        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
22561          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
22562        closeArray();
22563      };
22564      if (element.hasProduct()) {
22565        composeType("product", element.getProduct());
22566      }
22567      if (element.hasQuantity()) {
22568        composeSimpleQuantity("quantity", element.getQuantity());
22569      }
22570      if (element.hasDosage()) {
22571        openArray("dosage");
22572        for (Dosage e : element.getDosage()) 
22573          composeDosage(null, e);
22574        closeArray();
22575      };
22576      if (element.hasBodySite()) {
22577        openArray("bodySite");
22578        for (CodeableConcept e : element.getBodySite()) 
22579          composeCodeableConcept(null, e);
22580        closeArray();
22581      };
22582      if (element.hasTransform()) {
22583        composeReference("transform", element.getTransform());
22584      }
22585      if (element.hasDynamicValue()) {
22586        openArray("dynamicValue");
22587        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
22588          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
22589        closeArray();
22590      };
22591  }
22592
22593  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22594    if (element != null) {
22595      open(name);
22596      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
22597      close();
22598    }
22599  }
22600
22601  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
22602      composeBackbone(element);
22603      if (element.hasTypeElement()) {
22604        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22605        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
22606      }
22607      if (element.hasRole()) {
22608        composeCodeableConcept("role", element.getRole());
22609      }
22610  }
22611
22612  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22613    if (element != null) {
22614      open(name);
22615      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
22616      close();
22617    }
22618  }
22619
22620  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
22621      composeBackbone(element);
22622      if (element.hasDescriptionElement()) {
22623        composeStringCore("description", element.getDescriptionElement(), false);
22624        composeStringExtras("description", element.getDescriptionElement(), false);
22625      }
22626      if (element.hasPathElement()) {
22627        composeStringCore("path", element.getPathElement(), false);
22628        composeStringExtras("path", element.getPathElement(), false);
22629      }
22630      if (element.hasLanguageElement()) {
22631        composeStringCore("language", element.getLanguageElement(), false);
22632        composeStringExtras("language", element.getLanguageElement(), false);
22633      }
22634      if (element.hasExpressionElement()) {
22635        composeStringCore("expression", element.getExpressionElement(), false);
22636        composeStringExtras("expression", element.getExpressionElement(), false);
22637      }
22638  }
22639
22640  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
22641    if (element != null) {
22642      prop("resourceType", name);
22643      composeAdverseEventInner(element);
22644    }
22645  }
22646
22647  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
22648      composeDomainResourceElements(element);
22649      if (element.hasIdentifier()) {
22650        composeIdentifier("identifier", element.getIdentifier());
22651      }
22652      if (element.hasCategoryElement()) {
22653        composeEnumerationCore("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22654        composeEnumerationExtras("category", element.getCategoryElement(), new AdverseEvent.AdverseEventCategoryEnumFactory(), false);
22655      }
22656      if (element.hasType()) {
22657        composeCodeableConcept("type", element.getType());
22658      }
22659      if (element.hasSubject()) {
22660        composeReference("subject", element.getSubject());
22661      }
22662      if (element.hasDateElement()) {
22663        composeDateTimeCore("date", element.getDateElement(), false);
22664        composeDateTimeExtras("date", element.getDateElement(), false);
22665      }
22666      if (element.hasReaction()) {
22667        openArray("reaction");
22668        for (Reference e : element.getReaction()) 
22669          composeReference(null, e);
22670        closeArray();
22671      };
22672      if (element.hasLocation()) {
22673        composeReference("location", element.getLocation());
22674      }
22675      if (element.hasSeriousness()) {
22676        composeCodeableConcept("seriousness", element.getSeriousness());
22677      }
22678      if (element.hasOutcome()) {
22679        composeCodeableConcept("outcome", element.getOutcome());
22680      }
22681      if (element.hasRecorder()) {
22682        composeReference("recorder", element.getRecorder());
22683      }
22684      if (element.hasEventParticipant()) {
22685        composeReference("eventParticipant", element.getEventParticipant());
22686      }
22687      if (element.hasDescriptionElement()) {
22688        composeStringCore("description", element.getDescriptionElement(), false);
22689        composeStringExtras("description", element.getDescriptionElement(), false);
22690      }
22691      if (element.hasSuspectEntity()) {
22692        openArray("suspectEntity");
22693        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
22694          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
22695        closeArray();
22696      };
22697      if (element.hasSubjectMedicalHistory()) {
22698        openArray("subjectMedicalHistory");
22699        for (Reference e : element.getSubjectMedicalHistory()) 
22700          composeReference(null, e);
22701        closeArray();
22702      };
22703      if (element.hasReferenceDocument()) {
22704        openArray("referenceDocument");
22705        for (Reference e : element.getReferenceDocument()) 
22706          composeReference(null, e);
22707        closeArray();
22708      };
22709      if (element.hasStudy()) {
22710        openArray("study");
22711        for (Reference e : element.getStudy()) 
22712          composeReference(null, e);
22713        closeArray();
22714      };
22715  }
22716
22717  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
22718    if (element != null) {
22719      open(name);
22720      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
22721      close();
22722    }
22723  }
22724
22725  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
22726      composeBackbone(element);
22727      if (element.hasInstance()) {
22728        composeReference("instance", element.getInstance());
22729      }
22730      if (element.hasCausalityElement()) {
22731        composeEnumerationCore("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
22732        composeEnumerationExtras("causality", element.getCausalityElement(), new AdverseEvent.AdverseEventCausalityEnumFactory(), false);
22733      }
22734      if (element.hasCausalityAssessment()) {
22735        composeCodeableConcept("causalityAssessment", element.getCausalityAssessment());
22736      }
22737      if (element.hasCausalityProductRelatednessElement()) {
22738        composeStringCore("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
22739        composeStringExtras("causalityProductRelatedness", element.getCausalityProductRelatednessElement(), false);
22740      }
22741      if (element.hasCausalityMethod()) {
22742        composeCodeableConcept("causalityMethod", element.getCausalityMethod());
22743      }
22744      if (element.hasCausalityAuthor()) {
22745        composeReference("causalityAuthor", element.getCausalityAuthor());
22746      }
22747      if (element.hasCausalityResult()) {
22748        composeCodeableConcept("causalityResult", element.getCausalityResult());
22749      }
22750  }
22751
22752  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
22753    if (element != null) {
22754      prop("resourceType", name);
22755      composeAllergyIntoleranceInner(element);
22756    }
22757  }
22758
22759  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
22760      composeDomainResourceElements(element);
22761      if (element.hasIdentifier()) {
22762        openArray("identifier");
22763        for (Identifier e : element.getIdentifier()) 
22764          composeIdentifier(null, e);
22765        closeArray();
22766      };
22767      if (element.hasClinicalStatusElement()) {
22768        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
22769        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
22770      }
22771      if (element.hasVerificationStatusElement()) {
22772        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
22773        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
22774      }
22775      if (element.hasTypeElement()) {
22776        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
22777        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
22778      }
22779      if (element.hasCategory()) {
22780        openArray("category");
22781        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
22782          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
22783        closeArray();
22784        if (anyHasExtras(element.getCategory())) {
22785          openArray("_category");
22786          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
22787            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
22788          closeArray();
22789        }
22790      };
22791      if (element.hasCriticalityElement()) {
22792        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
22793        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
22794      }
22795      if (element.hasCode()) {
22796        composeCodeableConcept("code", element.getCode());
22797      }
22798      if (element.hasPatient()) {
22799        composeReference("patient", element.getPatient());
22800      }
22801      if (element.hasOnset()) {
22802        composeType("onset", element.getOnset());
22803      }
22804      if (element.hasAssertedDateElement()) {
22805        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
22806        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
22807      }
22808      if (element.hasRecorder()) {
22809        composeReference("recorder", element.getRecorder());
22810      }
22811      if (element.hasAsserter()) {
22812        composeReference("asserter", element.getAsserter());
22813      }
22814      if (element.hasLastOccurrenceElement()) {
22815        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
22816        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
22817      }
22818      if (element.hasNote()) {
22819        openArray("note");
22820        for (Annotation e : element.getNote()) 
22821          composeAnnotation(null, e);
22822        closeArray();
22823      };
22824      if (element.hasReaction()) {
22825        openArray("reaction");
22826        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
22827          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
22828        closeArray();
22829      };
22830  }
22831
22832  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
22833    if (element != null) {
22834      open(name);
22835      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
22836      close();
22837    }
22838  }
22839
22840  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
22841      composeBackbone(element);
22842      if (element.hasSubstance()) {
22843        composeCodeableConcept("substance", element.getSubstance());
22844      }
22845      if (element.hasManifestation()) {
22846        openArray("manifestation");
22847        for (CodeableConcept e : element.getManifestation()) 
22848          composeCodeableConcept(null, e);
22849        closeArray();
22850      };
22851      if (element.hasDescriptionElement()) {
22852        composeStringCore("description", element.getDescriptionElement(), false);
22853        composeStringExtras("description", element.getDescriptionElement(), false);
22854      }
22855      if (element.hasOnsetElement()) {
22856        composeDateTimeCore("onset", element.getOnsetElement(), false);
22857        composeDateTimeExtras("onset", element.getOnsetElement(), false);
22858      }
22859      if (element.hasSeverityElement()) {
22860        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
22861        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
22862      }
22863      if (element.hasExposureRoute()) {
22864        composeCodeableConcept("exposureRoute", element.getExposureRoute());
22865      }
22866      if (element.hasNote()) {
22867        openArray("note");
22868        for (Annotation e : element.getNote()) 
22869          composeAnnotation(null, e);
22870        closeArray();
22871      };
22872  }
22873
22874  protected void composeAppointment(String name, Appointment element) throws IOException {
22875    if (element != null) {
22876      prop("resourceType", name);
22877      composeAppointmentInner(element);
22878    }
22879  }
22880
22881  protected void composeAppointmentInner(Appointment element) throws IOException {
22882      composeDomainResourceElements(element);
22883      if (element.hasIdentifier()) {
22884        openArray("identifier");
22885        for (Identifier e : element.getIdentifier()) 
22886          composeIdentifier(null, e);
22887        closeArray();
22888      };
22889      if (element.hasStatusElement()) {
22890        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
22891        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
22892      }
22893      if (element.hasServiceCategory()) {
22894        composeCodeableConcept("serviceCategory", element.getServiceCategory());
22895      }
22896      if (element.hasServiceType()) {
22897        openArray("serviceType");
22898        for (CodeableConcept e : element.getServiceType()) 
22899          composeCodeableConcept(null, e);
22900        closeArray();
22901      };
22902      if (element.hasSpecialty()) {
22903        openArray("specialty");
22904        for (CodeableConcept e : element.getSpecialty()) 
22905          composeCodeableConcept(null, e);
22906        closeArray();
22907      };
22908      if (element.hasAppointmentType()) {
22909        composeCodeableConcept("appointmentType", element.getAppointmentType());
22910      }
22911      if (element.hasReason()) {
22912        openArray("reason");
22913        for (CodeableConcept e : element.getReason()) 
22914          composeCodeableConcept(null, e);
22915        closeArray();
22916      };
22917      if (element.hasIndication()) {
22918        openArray("indication");
22919        for (Reference e : element.getIndication()) 
22920          composeReference(null, e);
22921        closeArray();
22922      };
22923      if (element.hasPriorityElement()) {
22924        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
22925        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
22926      }
22927      if (element.hasDescriptionElement()) {
22928        composeStringCore("description", element.getDescriptionElement(), false);
22929        composeStringExtras("description", element.getDescriptionElement(), false);
22930      }
22931      if (element.hasSupportingInformation()) {
22932        openArray("supportingInformation");
22933        for (Reference e : element.getSupportingInformation()) 
22934          composeReference(null, e);
22935        closeArray();
22936      };
22937      if (element.hasStartElement()) {
22938        composeInstantCore("start", element.getStartElement(), false);
22939        composeInstantExtras("start", element.getStartElement(), false);
22940      }
22941      if (element.hasEndElement()) {
22942        composeInstantCore("end", element.getEndElement(), false);
22943        composeInstantExtras("end", element.getEndElement(), false);
22944      }
22945      if (element.hasMinutesDurationElement()) {
22946        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
22947        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
22948      }
22949      if (element.hasSlot()) {
22950        openArray("slot");
22951        for (Reference e : element.getSlot()) 
22952          composeReference(null, e);
22953        closeArray();
22954      };
22955      if (element.hasCreatedElement()) {
22956        composeDateTimeCore("created", element.getCreatedElement(), false);
22957        composeDateTimeExtras("created", element.getCreatedElement(), false);
22958      }
22959      if (element.hasCommentElement()) {
22960        composeStringCore("comment", element.getCommentElement(), false);
22961        composeStringExtras("comment", element.getCommentElement(), false);
22962      }
22963      if (element.hasIncomingReferral()) {
22964        openArray("incomingReferral");
22965        for (Reference e : element.getIncomingReferral()) 
22966          composeReference(null, e);
22967        closeArray();
22968      };
22969      if (element.hasParticipant()) {
22970        openArray("participant");
22971        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
22972          composeAppointmentAppointmentParticipantComponent(null, e);
22973        closeArray();
22974      };
22975      if (element.hasRequestedPeriod()) {
22976        openArray("requestedPeriod");
22977        for (Period e : element.getRequestedPeriod()) 
22978          composePeriod(null, e);
22979        closeArray();
22980      };
22981  }
22982
22983  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
22984    if (element != null) {
22985      open(name);
22986      composeAppointmentAppointmentParticipantComponentInner(element);
22987      close();
22988    }
22989  }
22990
22991  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
22992      composeBackbone(element);
22993      if (element.hasType()) {
22994        openArray("type");
22995        for (CodeableConcept e : element.getType()) 
22996          composeCodeableConcept(null, e);
22997        closeArray();
22998      };
22999      if (element.hasActor()) {
23000        composeReference("actor", element.getActor());
23001      }
23002      if (element.hasRequiredElement()) {
23003        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
23004        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
23005      }
23006      if (element.hasStatusElement()) {
23007        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
23008        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
23009      }
23010  }
23011
23012  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
23013    if (element != null) {
23014      prop("resourceType", name);
23015      composeAppointmentResponseInner(element);
23016    }
23017  }
23018
23019  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
23020      composeDomainResourceElements(element);
23021      if (element.hasIdentifier()) {
23022        openArray("identifier");
23023        for (Identifier e : element.getIdentifier()) 
23024          composeIdentifier(null, e);
23025        closeArray();
23026      };
23027      if (element.hasAppointment()) {
23028        composeReference("appointment", element.getAppointment());
23029      }
23030      if (element.hasStartElement()) {
23031        composeInstantCore("start", element.getStartElement(), false);
23032        composeInstantExtras("start", element.getStartElement(), false);
23033      }
23034      if (element.hasEndElement()) {
23035        composeInstantCore("end", element.getEndElement(), false);
23036        composeInstantExtras("end", element.getEndElement(), false);
23037      }
23038      if (element.hasParticipantType()) {
23039        openArray("participantType");
23040        for (CodeableConcept e : element.getParticipantType()) 
23041          composeCodeableConcept(null, e);
23042        closeArray();
23043      };
23044      if (element.hasActor()) {
23045        composeReference("actor", element.getActor());
23046      }
23047      if (element.hasParticipantStatusElement()) {
23048        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23049        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
23050      }
23051      if (element.hasCommentElement()) {
23052        composeStringCore("comment", element.getCommentElement(), false);
23053        composeStringExtras("comment", element.getCommentElement(), false);
23054      }
23055  }
23056
23057  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
23058    if (element != null) {
23059      prop("resourceType", name);
23060      composeAuditEventInner(element);
23061    }
23062  }
23063
23064  protected void composeAuditEventInner(AuditEvent element) throws IOException {
23065      composeDomainResourceElements(element);
23066      if (element.hasType()) {
23067        composeCoding("type", element.getType());
23068      }
23069      if (element.hasSubtype()) {
23070        openArray("subtype");
23071        for (Coding e : element.getSubtype()) 
23072          composeCoding(null, e);
23073        closeArray();
23074      };
23075      if (element.hasActionElement()) {
23076        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23077        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
23078      }
23079      if (element.hasRecordedElement()) {
23080        composeInstantCore("recorded", element.getRecordedElement(), false);
23081        composeInstantExtras("recorded", element.getRecordedElement(), false);
23082      }
23083      if (element.hasOutcomeElement()) {
23084        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23085        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
23086      }
23087      if (element.hasOutcomeDescElement()) {
23088        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
23089        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
23090      }
23091      if (element.hasPurposeOfEvent()) {
23092        openArray("purposeOfEvent");
23093        for (CodeableConcept e : element.getPurposeOfEvent()) 
23094          composeCodeableConcept(null, e);
23095        closeArray();
23096      };
23097      if (element.hasAgent()) {
23098        openArray("agent");
23099        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
23100          composeAuditEventAuditEventAgentComponent(null, e);
23101        closeArray();
23102      };
23103      if (element.hasSource()) {
23104        composeAuditEventAuditEventSourceComponent("source", element.getSource());
23105      }
23106      if (element.hasEntity()) {
23107        openArray("entity");
23108        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
23109          composeAuditEventAuditEventEntityComponent(null, e);
23110        closeArray();
23111      };
23112  }
23113
23114  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
23115    if (element != null) {
23116      open(name);
23117      composeAuditEventAuditEventAgentComponentInner(element);
23118      close();
23119    }
23120  }
23121
23122  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
23123      composeBackbone(element);
23124      if (element.hasRole()) {
23125        openArray("role");
23126        for (CodeableConcept e : element.getRole()) 
23127          composeCodeableConcept(null, e);
23128        closeArray();
23129      };
23130      if (element.hasReference()) {
23131        composeReference("reference", element.getReference());
23132      }
23133      if (element.hasUserId()) {
23134        composeIdentifier("userId", element.getUserId());
23135      }
23136      if (element.hasAltIdElement()) {
23137        composeStringCore("altId", element.getAltIdElement(), false);
23138        composeStringExtras("altId", element.getAltIdElement(), false);
23139      }
23140      if (element.hasNameElement()) {
23141        composeStringCore("name", element.getNameElement(), false);
23142        composeStringExtras("name", element.getNameElement(), false);
23143      }
23144      if (element.hasRequestorElement()) {
23145        composeBooleanCore("requestor", element.getRequestorElement(), false);
23146        composeBooleanExtras("requestor", element.getRequestorElement(), false);
23147      }
23148      if (element.hasLocation()) {
23149        composeReference("location", element.getLocation());
23150      }
23151      if (element.hasPolicy()) {
23152        openArray("policy");
23153        for (UriType e : element.getPolicy()) 
23154          composeUriCore(null, e, true);
23155        closeArray();
23156        if (anyHasExtras(element.getPolicy())) {
23157          openArray("_policy");
23158          for (UriType e : element.getPolicy()) 
23159            composeUriExtras(null, e, true);
23160          closeArray();
23161        }
23162      };
23163      if (element.hasMedia()) {
23164        composeCoding("media", element.getMedia());
23165      }
23166      if (element.hasNetwork()) {
23167        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
23168      }
23169      if (element.hasPurposeOfUse()) {
23170        openArray("purposeOfUse");
23171        for (CodeableConcept e : element.getPurposeOfUse()) 
23172          composeCodeableConcept(null, e);
23173        closeArray();
23174      };
23175  }
23176
23177  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23178    if (element != null) {
23179      open(name);
23180      composeAuditEventAuditEventAgentNetworkComponentInner(element);
23181      close();
23182    }
23183  }
23184
23185  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
23186      composeBackbone(element);
23187      if (element.hasAddressElement()) {
23188        composeStringCore("address", element.getAddressElement(), false);
23189        composeStringExtras("address", element.getAddressElement(), false);
23190      }
23191      if (element.hasTypeElement()) {
23192        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23193        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
23194      }
23195  }
23196
23197  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
23198    if (element != null) {
23199      open(name);
23200      composeAuditEventAuditEventSourceComponentInner(element);
23201      close();
23202    }
23203  }
23204
23205  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
23206      composeBackbone(element);
23207      if (element.hasSiteElement()) {
23208        composeStringCore("site", element.getSiteElement(), false);
23209        composeStringExtras("site", element.getSiteElement(), false);
23210      }
23211      if (element.hasIdentifier()) {
23212        composeIdentifier("identifier", element.getIdentifier());
23213      }
23214      if (element.hasType()) {
23215        openArray("type");
23216        for (Coding e : element.getType()) 
23217          composeCoding(null, e);
23218        closeArray();
23219      };
23220  }
23221
23222  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
23223    if (element != null) {
23224      open(name);
23225      composeAuditEventAuditEventEntityComponentInner(element);
23226      close();
23227    }
23228  }
23229
23230  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
23231      composeBackbone(element);
23232      if (element.hasIdentifier()) {
23233        composeIdentifier("identifier", element.getIdentifier());
23234      }
23235      if (element.hasReference()) {
23236        composeReference("reference", element.getReference());
23237      }
23238      if (element.hasType()) {
23239        composeCoding("type", element.getType());
23240      }
23241      if (element.hasRole()) {
23242        composeCoding("role", element.getRole());
23243      }
23244      if (element.hasLifecycle()) {
23245        composeCoding("lifecycle", element.getLifecycle());
23246      }
23247      if (element.hasSecurityLabel()) {
23248        openArray("securityLabel");
23249        for (Coding e : element.getSecurityLabel()) 
23250          composeCoding(null, e);
23251        closeArray();
23252      };
23253      if (element.hasNameElement()) {
23254        composeStringCore("name", element.getNameElement(), false);
23255        composeStringExtras("name", element.getNameElement(), false);
23256      }
23257      if (element.hasDescriptionElement()) {
23258        composeStringCore("description", element.getDescriptionElement(), false);
23259        composeStringExtras("description", element.getDescriptionElement(), false);
23260      }
23261      if (element.hasQueryElement()) {
23262        composeBase64BinaryCore("query", element.getQueryElement(), false);
23263        composeBase64BinaryExtras("query", element.getQueryElement(), false);
23264      }
23265      if (element.hasDetail()) {
23266        openArray("detail");
23267        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
23268          composeAuditEventAuditEventEntityDetailComponent(null, e);
23269        closeArray();
23270      };
23271  }
23272
23273  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23274    if (element != null) {
23275      open(name);
23276      composeAuditEventAuditEventEntityDetailComponentInner(element);
23277      close();
23278    }
23279  }
23280
23281  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
23282      composeBackbone(element);
23283      if (element.hasTypeElement()) {
23284        composeStringCore("type", element.getTypeElement(), false);
23285        composeStringExtras("type", element.getTypeElement(), false);
23286      }
23287      if (element.hasValueElement()) {
23288        composeBase64BinaryCore("value", element.getValueElement(), false);
23289        composeBase64BinaryExtras("value", element.getValueElement(), false);
23290      }
23291  }
23292
23293  protected void composeBasic(String name, Basic element) throws IOException {
23294    if (element != null) {
23295      prop("resourceType", name);
23296      composeBasicInner(element);
23297    }
23298  }
23299
23300  protected void composeBasicInner(Basic element) throws IOException {
23301      composeDomainResourceElements(element);
23302      if (element.hasIdentifier()) {
23303        openArray("identifier");
23304        for (Identifier e : element.getIdentifier()) 
23305          composeIdentifier(null, e);
23306        closeArray();
23307      };
23308      if (element.hasCode()) {
23309        composeCodeableConcept("code", element.getCode());
23310      }
23311      if (element.hasSubject()) {
23312        composeReference("subject", element.getSubject());
23313      }
23314      if (element.hasCreatedElement()) {
23315        composeDateCore("created", element.getCreatedElement(), false);
23316        composeDateExtras("created", element.getCreatedElement(), false);
23317      }
23318      if (element.hasAuthor()) {
23319        composeReference("author", element.getAuthor());
23320      }
23321  }
23322
23323  protected void composeBinary(String name, Binary element) throws IOException {
23324    if (element != null) {
23325      prop("resourceType", name);
23326      composeBinaryInner(element);
23327    }
23328  }
23329
23330  protected void composeBinaryInner(Binary element) throws IOException {
23331      composeResourceElements(element);
23332      if (element.hasContentTypeElement()) {
23333        composeCodeCore("contentType", element.getContentTypeElement(), false);
23334        composeCodeExtras("contentType", element.getContentTypeElement(), false);
23335      }
23336      if (element.hasSecurityContext()) {
23337        composeReference("securityContext", element.getSecurityContext());
23338      }
23339      if (element.hasContentElement()) {
23340        composeBase64BinaryCore("content", element.getContentElement(), false);
23341        composeBase64BinaryExtras("content", element.getContentElement(), false);
23342      }
23343  }
23344
23345  protected void composeBodySite(String name, BodySite element) throws IOException {
23346    if (element != null) {
23347      prop("resourceType", name);
23348      composeBodySiteInner(element);
23349    }
23350  }
23351
23352  protected void composeBodySiteInner(BodySite element) throws IOException {
23353      composeDomainResourceElements(element);
23354      if (element.hasIdentifier()) {
23355        openArray("identifier");
23356        for (Identifier e : element.getIdentifier()) 
23357          composeIdentifier(null, e);
23358        closeArray();
23359      };
23360      if (element.hasActiveElement()) {
23361        composeBooleanCore("active", element.getActiveElement(), false);
23362        composeBooleanExtras("active", element.getActiveElement(), false);
23363      }
23364      if (element.hasCode()) {
23365        composeCodeableConcept("code", element.getCode());
23366      }
23367      if (element.hasQualifier()) {
23368        openArray("qualifier");
23369        for (CodeableConcept e : element.getQualifier()) 
23370          composeCodeableConcept(null, e);
23371        closeArray();
23372      };
23373      if (element.hasDescriptionElement()) {
23374        composeStringCore("description", element.getDescriptionElement(), false);
23375        composeStringExtras("description", element.getDescriptionElement(), false);
23376      }
23377      if (element.hasImage()) {
23378        openArray("image");
23379        for (Attachment e : element.getImage()) 
23380          composeAttachment(null, e);
23381        closeArray();
23382      };
23383      if (element.hasPatient()) {
23384        composeReference("patient", element.getPatient());
23385      }
23386  }
23387
23388  protected void composeBundle(String name, Bundle element) throws IOException {
23389    if (element != null) {
23390      prop("resourceType", name);
23391      composeBundleInner(element);
23392    }
23393  }
23394
23395  protected void composeBundleInner(Bundle element) throws IOException {
23396      composeResourceElements(element);
23397      if (element.hasIdentifier()) {
23398        composeIdentifier("identifier", element.getIdentifier());
23399      }
23400      if (element.hasTypeElement()) {
23401        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23402        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
23403      }
23404      if (element.hasTotalElement()) {
23405        composeUnsignedIntCore("total", element.getTotalElement(), false);
23406        composeUnsignedIntExtras("total", element.getTotalElement(), false);
23407      }
23408      if (element.hasLink()) {
23409        openArray("link");
23410        for (Bundle.BundleLinkComponent e : element.getLink()) 
23411          composeBundleBundleLinkComponent(null, e);
23412        closeArray();
23413      };
23414      if (element.hasEntry()) {
23415        openArray("entry");
23416        for (Bundle.BundleEntryComponent e : element.getEntry()) 
23417          composeBundleBundleEntryComponent(null, e);
23418        closeArray();
23419      };
23420      if (element.hasSignature()) {
23421        composeSignature("signature", element.getSignature());
23422      }
23423  }
23424
23425  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
23426    if (element != null) {
23427      open(name);
23428      composeBundleBundleLinkComponentInner(element);
23429      close();
23430    }
23431  }
23432
23433  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
23434      composeBackbone(element);
23435      if (element.hasRelationElement()) {
23436        composeStringCore("relation", element.getRelationElement(), false);
23437        composeStringExtras("relation", element.getRelationElement(), false);
23438      }
23439      if (element.hasUrlElement()) {
23440        composeUriCore("url", element.getUrlElement(), false);
23441        composeUriExtras("url", element.getUrlElement(), false);
23442      }
23443  }
23444
23445  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
23446    if (element != null) {
23447      open(name);
23448      composeBundleBundleEntryComponentInner(element);
23449      close();
23450    }
23451  }
23452
23453  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
23454      composeBackbone(element);
23455      if (element.hasLink()) {
23456        openArray("link");
23457        for (Bundle.BundleLinkComponent e : element.getLink()) 
23458          composeBundleBundleLinkComponent(null, e);
23459        closeArray();
23460      };
23461      if (element.hasFullUrlElement()) {
23462        composeUriCore("fullUrl", element.getFullUrlElement(), false);
23463        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
23464      }
23465        if (element.hasResource()) {
23466          open("resource");
23467          composeResource(element.getResource());
23468          close();
23469        }
23470      if (element.hasSearch()) {
23471        composeBundleBundleEntrySearchComponent("search", element.getSearch());
23472      }
23473      if (element.hasRequest()) {
23474        composeBundleBundleEntryRequestComponent("request", element.getRequest());
23475      }
23476      if (element.hasResponse()) {
23477        composeBundleBundleEntryResponseComponent("response", element.getResponse());
23478      }
23479  }
23480
23481  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
23482    if (element != null) {
23483      open(name);
23484      composeBundleBundleEntrySearchComponentInner(element);
23485      close();
23486    }
23487  }
23488
23489  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
23490      composeBackbone(element);
23491      if (element.hasModeElement()) {
23492        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23493        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
23494      }
23495      if (element.hasScoreElement()) {
23496        composeDecimalCore("score", element.getScoreElement(), false);
23497        composeDecimalExtras("score", element.getScoreElement(), false);
23498      }
23499  }
23500
23501  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
23502    if (element != null) {
23503      open(name);
23504      composeBundleBundleEntryRequestComponentInner(element);
23505      close();
23506    }
23507  }
23508
23509  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
23510      composeBackbone(element);
23511      if (element.hasMethodElement()) {
23512        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23513        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
23514      }
23515      if (element.hasUrlElement()) {
23516        composeUriCore("url", element.getUrlElement(), false);
23517        composeUriExtras("url", element.getUrlElement(), false);
23518      }
23519      if (element.hasIfNoneMatchElement()) {
23520        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
23521        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
23522      }
23523      if (element.hasIfModifiedSinceElement()) {
23524        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23525        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
23526      }
23527      if (element.hasIfMatchElement()) {
23528        composeStringCore("ifMatch", element.getIfMatchElement(), false);
23529        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
23530      }
23531      if (element.hasIfNoneExistElement()) {
23532        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
23533        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
23534      }
23535  }
23536
23537  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
23538    if (element != null) {
23539      open(name);
23540      composeBundleBundleEntryResponseComponentInner(element);
23541      close();
23542    }
23543  }
23544
23545  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
23546      composeBackbone(element);
23547      if (element.hasStatusElement()) {
23548        composeStringCore("status", element.getStatusElement(), false);
23549        composeStringExtras("status", element.getStatusElement(), false);
23550      }
23551      if (element.hasLocationElement()) {
23552        composeUriCore("location", element.getLocationElement(), false);
23553        composeUriExtras("location", element.getLocationElement(), false);
23554      }
23555      if (element.hasEtagElement()) {
23556        composeStringCore("etag", element.getEtagElement(), false);
23557        composeStringExtras("etag", element.getEtagElement(), false);
23558      }
23559      if (element.hasLastModifiedElement()) {
23560        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
23561        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
23562      }
23563        if (element.hasOutcome()) {
23564          open("outcome");
23565          composeResource(element.getOutcome());
23566          close();
23567        }
23568  }
23569
23570  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
23571    if (element != null) {
23572      prop("resourceType", name);
23573      composeCapabilityStatementInner(element);
23574    }
23575  }
23576
23577  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
23578      composeDomainResourceElements(element);
23579      if (element.hasUrlElement()) {
23580        composeUriCore("url", element.getUrlElement(), false);
23581        composeUriExtras("url", element.getUrlElement(), false);
23582      }
23583      if (element.hasVersionElement()) {
23584        composeStringCore("version", element.getVersionElement(), false);
23585        composeStringExtras("version", element.getVersionElement(), false);
23586      }
23587      if (element.hasNameElement()) {
23588        composeStringCore("name", element.getNameElement(), false);
23589        composeStringExtras("name", element.getNameElement(), false);
23590      }
23591      if (element.hasTitleElement()) {
23592        composeStringCore("title", element.getTitleElement(), false);
23593        composeStringExtras("title", element.getTitleElement(), false);
23594      }
23595      if (element.hasStatusElement()) {
23596        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23597        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
23598      }
23599      if (element.hasExperimentalElement()) {
23600        composeBooleanCore("experimental", element.getExperimentalElement(), false);
23601        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
23602      }
23603      if (element.hasDateElement()) {
23604        composeDateTimeCore("date", element.getDateElement(), false);
23605        composeDateTimeExtras("date", element.getDateElement(), false);
23606      }
23607      if (element.hasPublisherElement()) {
23608        composeStringCore("publisher", element.getPublisherElement(), false);
23609        composeStringExtras("publisher", element.getPublisherElement(), false);
23610      }
23611      if (element.hasContact()) {
23612        openArray("contact");
23613        for (ContactDetail e : element.getContact()) 
23614          composeContactDetail(null, e);
23615        closeArray();
23616      };
23617      if (element.hasDescriptionElement()) {
23618        composeMarkdownCore("description", element.getDescriptionElement(), false);
23619        composeMarkdownExtras("description", element.getDescriptionElement(), false);
23620      }
23621      if (element.hasUseContext()) {
23622        openArray("useContext");
23623        for (UsageContext e : element.getUseContext()) 
23624          composeUsageContext(null, e);
23625        closeArray();
23626      };
23627      if (element.hasJurisdiction()) {
23628        openArray("jurisdiction");
23629        for (CodeableConcept e : element.getJurisdiction()) 
23630          composeCodeableConcept(null, e);
23631        closeArray();
23632      };
23633      if (element.hasPurposeElement()) {
23634        composeMarkdownCore("purpose", element.getPurposeElement(), false);
23635        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
23636      }
23637      if (element.hasCopyrightElement()) {
23638        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
23639        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
23640      }
23641      if (element.hasKindElement()) {
23642        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23643        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
23644      }
23645      if (element.hasInstantiates()) {
23646        openArray("instantiates");
23647        for (UriType e : element.getInstantiates()) 
23648          composeUriCore(null, e, true);
23649        closeArray();
23650        if (anyHasExtras(element.getInstantiates())) {
23651          openArray("_instantiates");
23652          for (UriType e : element.getInstantiates()) 
23653            composeUriExtras(null, e, true);
23654          closeArray();
23655        }
23656      };
23657      if (element.hasSoftware()) {
23658        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
23659      }
23660      if (element.hasImplementation()) {
23661        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
23662      }
23663      if (element.hasFhirVersionElement()) {
23664        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
23665        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
23666      }
23667      if (element.hasAcceptUnknownElement()) {
23668        composeEnumerationCore("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
23669        composeEnumerationExtras("acceptUnknown", element.getAcceptUnknownElement(), new CapabilityStatement.UnknownContentCodeEnumFactory(), false);
23670      }
23671      if (element.hasFormat()) {
23672        openArray("format");
23673        for (CodeType e : element.getFormat()) 
23674          composeCodeCore(null, e, true);
23675        closeArray();
23676        if (anyHasExtras(element.getFormat())) {
23677          openArray("_format");
23678          for (CodeType e : element.getFormat()) 
23679            composeCodeExtras(null, e, true);
23680          closeArray();
23681        }
23682      };
23683      if (element.hasPatchFormat()) {
23684        openArray("patchFormat");
23685        for (CodeType e : element.getPatchFormat()) 
23686          composeCodeCore(null, e, true);
23687        closeArray();
23688        if (anyHasExtras(element.getPatchFormat())) {
23689          openArray("_patchFormat");
23690          for (CodeType e : element.getPatchFormat()) 
23691            composeCodeExtras(null, e, true);
23692          closeArray();
23693        }
23694      };
23695      if (element.hasImplementationGuide()) {
23696        openArray("implementationGuide");
23697        for (UriType e : element.getImplementationGuide()) 
23698          composeUriCore(null, e, true);
23699        closeArray();
23700        if (anyHasExtras(element.getImplementationGuide())) {
23701          openArray("_implementationGuide");
23702          for (UriType e : element.getImplementationGuide()) 
23703            composeUriExtras(null, e, true);
23704          closeArray();
23705        }
23706      };
23707      if (element.hasProfile()) {
23708        openArray("profile");
23709        for (Reference e : element.getProfile()) 
23710          composeReference(null, e);
23711        closeArray();
23712      };
23713      if (element.hasRest()) {
23714        openArray("rest");
23715        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
23716          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
23717        closeArray();
23718      };
23719      if (element.hasMessaging()) {
23720        openArray("messaging");
23721        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
23722          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
23723        closeArray();
23724      };
23725      if (element.hasDocument()) {
23726        openArray("document");
23727        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
23728          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
23729        closeArray();
23730      };
23731  }
23732
23733  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
23734    if (element != null) {
23735      open(name);
23736      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
23737      close();
23738    }
23739  }
23740
23741  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
23742      composeBackbone(element);
23743      if (element.hasNameElement()) {
23744        composeStringCore("name", element.getNameElement(), false);
23745        composeStringExtras("name", element.getNameElement(), false);
23746      }
23747      if (element.hasVersionElement()) {
23748        composeStringCore("version", element.getVersionElement(), false);
23749        composeStringExtras("version", element.getVersionElement(), false);
23750      }
23751      if (element.hasReleaseDateElement()) {
23752        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
23753        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
23754      }
23755  }
23756
23757  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
23758    if (element != null) {
23759      open(name);
23760      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
23761      close();
23762    }
23763  }
23764
23765  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
23766      composeBackbone(element);
23767      if (element.hasDescriptionElement()) {
23768        composeStringCore("description", element.getDescriptionElement(), false);
23769        composeStringExtras("description", element.getDescriptionElement(), false);
23770      }
23771      if (element.hasUrlElement()) {
23772        composeUriCore("url", element.getUrlElement(), false);
23773        composeUriExtras("url", element.getUrlElement(), false);
23774      }
23775  }
23776
23777  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
23778    if (element != null) {
23779      open(name);
23780      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
23781      close();
23782    }
23783  }
23784
23785  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
23786      composeBackbone(element);
23787      if (element.hasModeElement()) {
23788        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
23789        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
23790      }
23791      if (element.hasDocumentationElement()) {
23792        composeStringCore("documentation", element.getDocumentationElement(), false);
23793        composeStringExtras("documentation", element.getDocumentationElement(), false);
23794      }
23795      if (element.hasSecurity()) {
23796        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
23797      }
23798      if (element.hasResource()) {
23799        openArray("resource");
23800        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
23801          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
23802        closeArray();
23803      };
23804      if (element.hasInteraction()) {
23805        openArray("interaction");
23806        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
23807          composeCapabilityStatementSystemInteractionComponent(null, e);
23808        closeArray();
23809      };
23810      if (element.hasSearchParam()) {
23811        openArray("searchParam");
23812        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
23813          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
23814        closeArray();
23815      };
23816      if (element.hasOperation()) {
23817        openArray("operation");
23818        for (CapabilityStatement.CapabilityStatementRestOperationComponent e : element.getOperation()) 
23819          composeCapabilityStatementCapabilityStatementRestOperationComponent(null, e);
23820        closeArray();
23821      };
23822      if (element.hasCompartment()) {
23823        openArray("compartment");
23824        for (UriType e : element.getCompartment()) 
23825          composeUriCore(null, e, true);
23826        closeArray();
23827        if (anyHasExtras(element.getCompartment())) {
23828          openArray("_compartment");
23829          for (UriType e : element.getCompartment()) 
23830            composeUriExtras(null, e, true);
23831          closeArray();
23832        }
23833      };
23834  }
23835
23836  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
23837    if (element != null) {
23838      open(name);
23839      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
23840      close();
23841    }
23842  }
23843
23844  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
23845      composeBackbone(element);
23846      if (element.hasCorsElement()) {
23847        composeBooleanCore("cors", element.getCorsElement(), false);
23848        composeBooleanExtras("cors", element.getCorsElement(), false);
23849      }
23850      if (element.hasService()) {
23851        openArray("service");
23852        for (CodeableConcept e : element.getService()) 
23853          composeCodeableConcept(null, e);
23854        closeArray();
23855      };
23856      if (element.hasDescriptionElement()) {
23857        composeStringCore("description", element.getDescriptionElement(), false);
23858        composeStringExtras("description", element.getDescriptionElement(), false);
23859      }
23860      if (element.hasCertificate()) {
23861        openArray("certificate");
23862        for (CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent e : element.getCertificate()) 
23863          composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(null, e);
23864        closeArray();
23865      };
23866  }
23867
23868  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
23869    if (element != null) {
23870      open(name);
23871      composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(element);
23872      close();
23873    }
23874  }
23875
23876  protected void composeCapabilityStatementCapabilityStatementRestSecurityCertificateComponentInner(CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent element) throws IOException {
23877      composeBackbone(element);
23878      if (element.hasTypeElement()) {
23879        composeCodeCore("type", element.getTypeElement(), false);
23880        composeCodeExtras("type", element.getTypeElement(), false);
23881      }
23882      if (element.hasBlobElement()) {
23883        composeBase64BinaryCore("blob", element.getBlobElement(), false);
23884        composeBase64BinaryExtras("blob", element.getBlobElement(), false);
23885      }
23886  }
23887
23888  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
23889    if (element != null) {
23890      open(name);
23891      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
23892      close();
23893    }
23894  }
23895
23896  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
23897      composeBackbone(element);
23898      if (element.hasTypeElement()) {
23899        composeCodeCore("type", element.getTypeElement(), false);
23900        composeCodeExtras("type", element.getTypeElement(), false);
23901      }
23902      if (element.hasProfile()) {
23903        composeReference("profile", element.getProfile());
23904      }
23905      if (element.hasDocumentationElement()) {
23906        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
23907        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
23908      }
23909      if (element.hasInteraction()) {
23910        openArray("interaction");
23911        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
23912          composeCapabilityStatementResourceInteractionComponent(null, e);
23913        closeArray();
23914      };
23915      if (element.hasVersioningElement()) {
23916        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
23917        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
23918      }
23919      if (element.hasReadHistoryElement()) {
23920        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
23921        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
23922      }
23923      if (element.hasUpdateCreateElement()) {
23924        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
23925        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
23926      }
23927      if (element.hasConditionalCreateElement()) {
23928        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
23929        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
23930      }
23931      if (element.hasConditionalReadElement()) {
23932        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
23933        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
23934      }
23935      if (element.hasConditionalUpdateElement()) {
23936        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
23937        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
23938      }
23939      if (element.hasConditionalDeleteElement()) {
23940        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
23941        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
23942      }
23943      if (element.hasReferencePolicy()) {
23944        openArray("referencePolicy");
23945        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
23946          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
23947        closeArray();
23948        if (anyHasExtras(element.getReferencePolicy())) {
23949          openArray("_referencePolicy");
23950          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
23951            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
23952          closeArray();
23953        }
23954      };
23955      if (element.hasSearchInclude()) {
23956        openArray("searchInclude");
23957        for (StringType e : element.getSearchInclude()) 
23958          composeStringCore(null, e, true);
23959        closeArray();
23960        if (anyHasExtras(element.getSearchInclude())) {
23961          openArray("_searchInclude");
23962          for (StringType e : element.getSearchInclude()) 
23963            composeStringExtras(null, e, true);
23964          closeArray();
23965        }
23966      };
23967      if (element.hasSearchRevInclude()) {
23968        openArray("searchRevInclude");
23969        for (StringType e : element.getSearchRevInclude()) 
23970          composeStringCore(null, e, true);
23971        closeArray();
23972        if (anyHasExtras(element.getSearchRevInclude())) {
23973          openArray("_searchRevInclude");
23974          for (StringType e : element.getSearchRevInclude()) 
23975            composeStringExtras(null, e, true);
23976          closeArray();
23977        }
23978      };
23979      if (element.hasSearchParam()) {
23980        openArray("searchParam");
23981        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
23982          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
23983        closeArray();
23984      };
23985  }
23986
23987  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
23988    if (element != null) {
23989      open(name);
23990      composeCapabilityStatementResourceInteractionComponentInner(element);
23991      close();
23992    }
23993  }
23994
23995  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
23996      composeBackbone(element);
23997      if (element.hasCodeElement()) {
23998        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
23999        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
24000      }
24001      if (element.hasDocumentationElement()) {
24002        composeStringCore("documentation", element.getDocumentationElement(), false);
24003        composeStringExtras("documentation", element.getDocumentationElement(), false);
24004      }
24005  }
24006
24007  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
24008    if (element != null) {
24009      open(name);
24010      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
24011      close();
24012    }
24013  }
24014
24015  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
24016      composeBackbone(element);
24017      if (element.hasNameElement()) {
24018        composeStringCore("name", element.getNameElement(), false);
24019        composeStringExtras("name", element.getNameElement(), false);
24020      }
24021      if (element.hasDefinitionElement()) {
24022        composeUriCore("definition", element.getDefinitionElement(), false);
24023        composeUriExtras("definition", element.getDefinitionElement(), false);
24024      }
24025      if (element.hasTypeElement()) {
24026        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24027        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
24028      }
24029      if (element.hasDocumentationElement()) {
24030        composeStringCore("documentation", element.getDocumentationElement(), false);
24031        composeStringExtras("documentation", element.getDocumentationElement(), false);
24032      }
24033  }
24034
24035  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
24036    if (element != null) {
24037      open(name);
24038      composeCapabilityStatementSystemInteractionComponentInner(element);
24039      close();
24040    }
24041  }
24042
24043  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
24044      composeBackbone(element);
24045      if (element.hasCodeElement()) {
24046        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24047        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
24048      }
24049      if (element.hasDocumentationElement()) {
24050        composeStringCore("documentation", element.getDocumentationElement(), false);
24051        composeStringExtras("documentation", element.getDocumentationElement(), false);
24052      }
24053  }
24054
24055  protected void composeCapabilityStatementCapabilityStatementRestOperationComponent(String name, CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24056    if (element != null) {
24057      open(name);
24058      composeCapabilityStatementCapabilityStatementRestOperationComponentInner(element);
24059      close();
24060    }
24061  }
24062
24063  protected void composeCapabilityStatementCapabilityStatementRestOperationComponentInner(CapabilityStatement.CapabilityStatementRestOperationComponent element) throws IOException {
24064      composeBackbone(element);
24065      if (element.hasNameElement()) {
24066        composeStringCore("name", element.getNameElement(), false);
24067        composeStringExtras("name", element.getNameElement(), false);
24068      }
24069      if (element.hasDefinition()) {
24070        composeReference("definition", element.getDefinition());
24071      }
24072  }
24073
24074  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24075    if (element != null) {
24076      open(name);
24077      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
24078      close();
24079    }
24080  }
24081
24082  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
24083      composeBackbone(element);
24084      if (element.hasEndpoint()) {
24085        openArray("endpoint");
24086        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
24087          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
24088        closeArray();
24089      };
24090      if (element.hasReliableCacheElement()) {
24091        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
24092        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
24093      }
24094      if (element.hasDocumentationElement()) {
24095        composeStringCore("documentation", element.getDocumentationElement(), false);
24096        composeStringExtras("documentation", element.getDocumentationElement(), false);
24097      }
24098      if (element.hasSupportedMessage()) {
24099        openArray("supportedMessage");
24100        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
24101          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
24102        closeArray();
24103      };
24104      if (element.hasEvent()) {
24105        openArray("event");
24106        for (CapabilityStatement.CapabilityStatementMessagingEventComponent e : element.getEvent()) 
24107          composeCapabilityStatementCapabilityStatementMessagingEventComponent(null, e);
24108        closeArray();
24109      };
24110  }
24111
24112  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24113    if (element != null) {
24114      open(name);
24115      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
24116      close();
24117    }
24118  }
24119
24120  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
24121      composeBackbone(element);
24122      if (element.hasProtocol()) {
24123        composeCoding("protocol", element.getProtocol());
24124      }
24125      if (element.hasAddressElement()) {
24126        composeUriCore("address", element.getAddressElement(), false);
24127        composeUriExtras("address", element.getAddressElement(), false);
24128      }
24129  }
24130
24131  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24132    if (element != null) {
24133      open(name);
24134      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
24135      close();
24136    }
24137  }
24138
24139  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
24140      composeBackbone(element);
24141      if (element.hasModeElement()) {
24142        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24143        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24144      }
24145      if (element.hasDefinition()) {
24146        composeReference("definition", element.getDefinition());
24147      }
24148  }
24149
24150  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponent(String name, CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24151    if (element != null) {
24152      open(name);
24153      composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(element);
24154      close();
24155    }
24156  }
24157
24158  protected void composeCapabilityStatementCapabilityStatementMessagingEventComponentInner(CapabilityStatement.CapabilityStatementMessagingEventComponent element) throws IOException {
24159      composeBackbone(element);
24160      if (element.hasCode()) {
24161        composeCoding("code", element.getCode());
24162      }
24163      if (element.hasCategoryElement()) {
24164        composeEnumerationCore("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24165        composeEnumerationExtras("category", element.getCategoryElement(), new CapabilityStatement.MessageSignificanceCategoryEnumFactory(), false);
24166      }
24167      if (element.hasModeElement()) {
24168        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24169        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
24170      }
24171      if (element.hasFocusElement()) {
24172        composeCodeCore("focus", element.getFocusElement(), false);
24173        composeCodeExtras("focus", element.getFocusElement(), false);
24174      }
24175      if (element.hasRequest()) {
24176        composeReference("request", element.getRequest());
24177      }
24178      if (element.hasResponse()) {
24179        composeReference("response", element.getResponse());
24180      }
24181      if (element.hasDocumentationElement()) {
24182        composeStringCore("documentation", element.getDocumentationElement(), false);
24183        composeStringExtras("documentation", element.getDocumentationElement(), false);
24184      }
24185  }
24186
24187  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24188    if (element != null) {
24189      open(name);
24190      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
24191      close();
24192    }
24193  }
24194
24195  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
24196      composeBackbone(element);
24197      if (element.hasModeElement()) {
24198        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24199        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
24200      }
24201      if (element.hasDocumentationElement()) {
24202        composeStringCore("documentation", element.getDocumentationElement(), false);
24203        composeStringExtras("documentation", element.getDocumentationElement(), false);
24204      }
24205      if (element.hasProfile()) {
24206        composeReference("profile", element.getProfile());
24207      }
24208  }
24209
24210  protected void composeCarePlan(String name, CarePlan element) throws IOException {
24211    if (element != null) {
24212      prop("resourceType", name);
24213      composeCarePlanInner(element);
24214    }
24215  }
24216
24217  protected void composeCarePlanInner(CarePlan element) throws IOException {
24218      composeDomainResourceElements(element);
24219      if (element.hasIdentifier()) {
24220        openArray("identifier");
24221        for (Identifier e : element.getIdentifier()) 
24222          composeIdentifier(null, e);
24223        closeArray();
24224      };
24225      if (element.hasDefinition()) {
24226        openArray("definition");
24227        for (Reference e : element.getDefinition()) 
24228          composeReference(null, e);
24229        closeArray();
24230      };
24231      if (element.hasBasedOn()) {
24232        openArray("basedOn");
24233        for (Reference e : element.getBasedOn()) 
24234          composeReference(null, e);
24235        closeArray();
24236      };
24237      if (element.hasReplaces()) {
24238        openArray("replaces");
24239        for (Reference e : element.getReplaces()) 
24240          composeReference(null, e);
24241        closeArray();
24242      };
24243      if (element.hasPartOf()) {
24244        openArray("partOf");
24245        for (Reference e : element.getPartOf()) 
24246          composeReference(null, e);
24247        closeArray();
24248      };
24249      if (element.hasStatusElement()) {
24250        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24251        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
24252      }
24253      if (element.hasIntentElement()) {
24254        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24255        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
24256      }
24257      if (element.hasCategory()) {
24258        openArray("category");
24259        for (CodeableConcept e : element.getCategory()) 
24260          composeCodeableConcept(null, e);
24261        closeArray();
24262      };
24263      if (element.hasTitleElement()) {
24264        composeStringCore("title", element.getTitleElement(), false);
24265        composeStringExtras("title", element.getTitleElement(), false);
24266      }
24267      if (element.hasDescriptionElement()) {
24268        composeStringCore("description", element.getDescriptionElement(), false);
24269        composeStringExtras("description", element.getDescriptionElement(), false);
24270      }
24271      if (element.hasSubject()) {
24272        composeReference("subject", element.getSubject());
24273      }
24274      if (element.hasContext()) {
24275        composeReference("context", element.getContext());
24276      }
24277      if (element.hasPeriod()) {
24278        composePeriod("period", element.getPeriod());
24279      }
24280      if (element.hasAuthor()) {
24281        openArray("author");
24282        for (Reference e : element.getAuthor()) 
24283          composeReference(null, e);
24284        closeArray();
24285      };
24286      if (element.hasCareTeam()) {
24287        openArray("careTeam");
24288        for (Reference e : element.getCareTeam()) 
24289          composeReference(null, e);
24290        closeArray();
24291      };
24292      if (element.hasAddresses()) {
24293        openArray("addresses");
24294        for (Reference e : element.getAddresses()) 
24295          composeReference(null, e);
24296        closeArray();
24297      };
24298      if (element.hasSupportingInfo()) {
24299        openArray("supportingInfo");
24300        for (Reference e : element.getSupportingInfo()) 
24301          composeReference(null, e);
24302        closeArray();
24303      };
24304      if (element.hasGoal()) {
24305        openArray("goal");
24306        for (Reference e : element.getGoal()) 
24307          composeReference(null, e);
24308        closeArray();
24309      };
24310      if (element.hasActivity()) {
24311        openArray("activity");
24312        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
24313          composeCarePlanCarePlanActivityComponent(null, e);
24314        closeArray();
24315      };
24316      if (element.hasNote()) {
24317        openArray("note");
24318        for (Annotation e : element.getNote()) 
24319          composeAnnotation(null, e);
24320        closeArray();
24321      };
24322  }
24323
24324  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
24325    if (element != null) {
24326      open(name);
24327      composeCarePlanCarePlanActivityComponentInner(element);
24328      close();
24329    }
24330  }
24331
24332  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
24333      composeBackbone(element);
24334      if (element.hasOutcomeCodeableConcept()) {
24335        openArray("outcomeCodeableConcept");
24336        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
24337          composeCodeableConcept(null, e);
24338        closeArray();
24339      };
24340      if (element.hasOutcomeReference()) {
24341        openArray("outcomeReference");
24342        for (Reference e : element.getOutcomeReference()) 
24343          composeReference(null, e);
24344        closeArray();
24345      };
24346      if (element.hasProgress()) {
24347        openArray("progress");
24348        for (Annotation e : element.getProgress()) 
24349          composeAnnotation(null, e);
24350        closeArray();
24351      };
24352      if (element.hasReference()) {
24353        composeReference("reference", element.getReference());
24354      }
24355      if (element.hasDetail()) {
24356        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
24357      }
24358  }
24359
24360  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24361    if (element != null) {
24362      open(name);
24363      composeCarePlanCarePlanActivityDetailComponentInner(element);
24364      close();
24365    }
24366  }
24367
24368  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
24369      composeBackbone(element);
24370      if (element.hasCategory()) {
24371        composeCodeableConcept("category", element.getCategory());
24372      }
24373      if (element.hasDefinition()) {
24374        composeReference("definition", element.getDefinition());
24375      }
24376      if (element.hasCode()) {
24377        composeCodeableConcept("code", element.getCode());
24378      }
24379      if (element.hasReasonCode()) {
24380        openArray("reasonCode");
24381        for (CodeableConcept e : element.getReasonCode()) 
24382          composeCodeableConcept(null, e);
24383        closeArray();
24384      };
24385      if (element.hasReasonReference()) {
24386        openArray("reasonReference");
24387        for (Reference e : element.getReasonReference()) 
24388          composeReference(null, e);
24389        closeArray();
24390      };
24391      if (element.hasGoal()) {
24392        openArray("goal");
24393        for (Reference e : element.getGoal()) 
24394          composeReference(null, e);
24395        closeArray();
24396      };
24397      if (element.hasStatusElement()) {
24398        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24399        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
24400      }
24401      if (element.hasStatusReasonElement()) {
24402        composeStringCore("statusReason", element.getStatusReasonElement(), false);
24403        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
24404      }
24405      if (element.hasProhibitedElement()) {
24406        composeBooleanCore("prohibited", element.getProhibitedElement(), false);
24407        composeBooleanExtras("prohibited", element.getProhibitedElement(), false);
24408      }
24409      if (element.hasScheduled()) {
24410        composeType("scheduled", element.getScheduled());
24411      }
24412      if (element.hasLocation()) {
24413        composeReference("location", element.getLocation());
24414      }
24415      if (element.hasPerformer()) {
24416        openArray("performer");
24417        for (Reference e : element.getPerformer()) 
24418          composeReference(null, e);
24419        closeArray();
24420      };
24421      if (element.hasProduct()) {
24422        composeType("product", element.getProduct());
24423      }
24424      if (element.hasDailyAmount()) {
24425        composeSimpleQuantity("dailyAmount", element.getDailyAmount());
24426      }
24427      if (element.hasQuantity()) {
24428        composeSimpleQuantity("quantity", element.getQuantity());
24429      }
24430      if (element.hasDescriptionElement()) {
24431        composeStringCore("description", element.getDescriptionElement(), false);
24432        composeStringExtras("description", element.getDescriptionElement(), false);
24433      }
24434  }
24435
24436  protected void composeCareTeam(String name, CareTeam element) throws IOException {
24437    if (element != null) {
24438      prop("resourceType", name);
24439      composeCareTeamInner(element);
24440    }
24441  }
24442
24443  protected void composeCareTeamInner(CareTeam element) throws IOException {
24444      composeDomainResourceElements(element);
24445      if (element.hasIdentifier()) {
24446        openArray("identifier");
24447        for (Identifier e : element.getIdentifier()) 
24448          composeIdentifier(null, e);
24449        closeArray();
24450      };
24451      if (element.hasStatusElement()) {
24452        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24453        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
24454      }
24455      if (element.hasCategory()) {
24456        openArray("category");
24457        for (CodeableConcept e : element.getCategory()) 
24458          composeCodeableConcept(null, e);
24459        closeArray();
24460      };
24461      if (element.hasNameElement()) {
24462        composeStringCore("name", element.getNameElement(), false);
24463        composeStringExtras("name", element.getNameElement(), false);
24464      }
24465      if (element.hasSubject()) {
24466        composeReference("subject", element.getSubject());
24467      }
24468      if (element.hasContext()) {
24469        composeReference("context", element.getContext());
24470      }
24471      if (element.hasPeriod()) {
24472        composePeriod("period", element.getPeriod());
24473      }
24474      if (element.hasParticipant()) {
24475        openArray("participant");
24476        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
24477          composeCareTeamCareTeamParticipantComponent(null, e);
24478        closeArray();
24479      };
24480      if (element.hasReasonCode()) {
24481        openArray("reasonCode");
24482        for (CodeableConcept e : element.getReasonCode()) 
24483          composeCodeableConcept(null, e);
24484        closeArray();
24485      };
24486      if (element.hasReasonReference()) {
24487        openArray("reasonReference");
24488        for (Reference e : element.getReasonReference()) 
24489          composeReference(null, e);
24490        closeArray();
24491      };
24492      if (element.hasManagingOrganization()) {
24493        openArray("managingOrganization");
24494        for (Reference e : element.getManagingOrganization()) 
24495          composeReference(null, e);
24496        closeArray();
24497      };
24498      if (element.hasNote()) {
24499        openArray("note");
24500        for (Annotation e : element.getNote()) 
24501          composeAnnotation(null, e);
24502        closeArray();
24503      };
24504  }
24505
24506  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
24507    if (element != null) {
24508      open(name);
24509      composeCareTeamCareTeamParticipantComponentInner(element);
24510      close();
24511    }
24512  }
24513
24514  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
24515      composeBackbone(element);
24516      if (element.hasRole()) {
24517        composeCodeableConcept("role", element.getRole());
24518      }
24519      if (element.hasMember()) {
24520        composeReference("member", element.getMember());
24521      }
24522      if (element.hasOnBehalfOf()) {
24523        composeReference("onBehalfOf", element.getOnBehalfOf());
24524      }
24525      if (element.hasPeriod()) {
24526        composePeriod("period", element.getPeriod());
24527      }
24528  }
24529
24530  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
24531    if (element != null) {
24532      prop("resourceType", name);
24533      composeChargeItemInner(element);
24534    }
24535  }
24536
24537  protected void composeChargeItemInner(ChargeItem element) throws IOException {
24538      composeDomainResourceElements(element);
24539      if (element.hasIdentifier()) {
24540        composeIdentifier("identifier", element.getIdentifier());
24541      }
24542      if (element.hasDefinition()) {
24543        openArray("definition");
24544        for (UriType e : element.getDefinition()) 
24545          composeUriCore(null, e, true);
24546        closeArray();
24547        if (anyHasExtras(element.getDefinition())) {
24548          openArray("_definition");
24549          for (UriType e : element.getDefinition()) 
24550            composeUriExtras(null, e, true);
24551          closeArray();
24552        }
24553      };
24554      if (element.hasStatusElement()) {
24555        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24556        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
24557      }
24558      if (element.hasPartOf()) {
24559        openArray("partOf");
24560        for (Reference e : element.getPartOf()) 
24561          composeReference(null, e);
24562        closeArray();
24563      };
24564      if (element.hasCode()) {
24565        composeCodeableConcept("code", element.getCode());
24566      }
24567      if (element.hasSubject()) {
24568        composeReference("subject", element.getSubject());
24569      }
24570      if (element.hasContext()) {
24571        composeReference("context", element.getContext());
24572      }
24573      if (element.hasOccurrence()) {
24574        composeType("occurrence", element.getOccurrence());
24575      }
24576      if (element.hasParticipant()) {
24577        openArray("participant");
24578        for (ChargeItem.ChargeItemParticipantComponent e : element.getParticipant()) 
24579          composeChargeItemChargeItemParticipantComponent(null, e);
24580        closeArray();
24581      };
24582      if (element.hasPerformingOrganization()) {
24583        composeReference("performingOrganization", element.getPerformingOrganization());
24584      }
24585      if (element.hasRequestingOrganization()) {
24586        composeReference("requestingOrganization", element.getRequestingOrganization());
24587      }
24588      if (element.hasQuantity()) {
24589        composeQuantity("quantity", element.getQuantity());
24590      }
24591      if (element.hasBodysite()) {
24592        openArray("bodysite");
24593        for (CodeableConcept e : element.getBodysite()) 
24594          composeCodeableConcept(null, e);
24595        closeArray();
24596      };
24597      if (element.hasFactorOverrideElement()) {
24598        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
24599        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
24600      }
24601      if (element.hasPriceOverride()) {
24602        composeMoney("priceOverride", element.getPriceOverride());
24603      }
24604      if (element.hasOverrideReasonElement()) {
24605        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
24606        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
24607      }
24608      if (element.hasEnterer()) {
24609        composeReference("enterer", element.getEnterer());
24610      }
24611      if (element.hasEnteredDateElement()) {
24612        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
24613        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
24614      }
24615      if (element.hasReason()) {
24616        openArray("reason");
24617        for (CodeableConcept e : element.getReason()) 
24618          composeCodeableConcept(null, e);
24619        closeArray();
24620      };
24621      if (element.hasService()) {
24622        openArray("service");
24623        for (Reference e : element.getService()) 
24624          composeReference(null, e);
24625        closeArray();
24626      };
24627      if (element.hasAccount()) {
24628        openArray("account");
24629        for (Reference e : element.getAccount()) 
24630          composeReference(null, e);
24631        closeArray();
24632      };
24633      if (element.hasNote()) {
24634        openArray("note");
24635        for (Annotation e : element.getNote()) 
24636          composeAnnotation(null, e);
24637        closeArray();
24638      };
24639      if (element.hasSupportingInformation()) {
24640        openArray("supportingInformation");
24641        for (Reference e : element.getSupportingInformation()) 
24642          composeReference(null, e);
24643        closeArray();
24644      };
24645  }
24646
24647  protected void composeChargeItemChargeItemParticipantComponent(String name, ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24648    if (element != null) {
24649      open(name);
24650      composeChargeItemChargeItemParticipantComponentInner(element);
24651      close();
24652    }
24653  }
24654
24655  protected void composeChargeItemChargeItemParticipantComponentInner(ChargeItem.ChargeItemParticipantComponent element) throws IOException {
24656      composeBackbone(element);
24657      if (element.hasRole()) {
24658        composeCodeableConcept("role", element.getRole());
24659      }
24660      if (element.hasActor()) {
24661        composeReference("actor", element.getActor());
24662      }
24663  }
24664
24665  protected void composeClaim(String name, Claim element) throws IOException {
24666    if (element != null) {
24667      prop("resourceType", name);
24668      composeClaimInner(element);
24669    }
24670  }
24671
24672  protected void composeClaimInner(Claim element) throws IOException {
24673      composeDomainResourceElements(element);
24674      if (element.hasIdentifier()) {
24675        openArray("identifier");
24676        for (Identifier e : element.getIdentifier()) 
24677          composeIdentifier(null, e);
24678        closeArray();
24679      };
24680      if (element.hasStatusElement()) {
24681        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
24682        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
24683      }
24684      if (element.hasType()) {
24685        composeCodeableConcept("type", element.getType());
24686      }
24687      if (element.hasSubType()) {
24688        openArray("subType");
24689        for (CodeableConcept e : element.getSubType()) 
24690          composeCodeableConcept(null, e);
24691        closeArray();
24692      };
24693      if (element.hasUseElement()) {
24694        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
24695        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
24696      }
24697      if (element.hasPatient()) {
24698        composeReference("patient", element.getPatient());
24699      }
24700      if (element.hasBillablePeriod()) {
24701        composePeriod("billablePeriod", element.getBillablePeriod());
24702      }
24703      if (element.hasCreatedElement()) {
24704        composeDateTimeCore("created", element.getCreatedElement(), false);
24705        composeDateTimeExtras("created", element.getCreatedElement(), false);
24706      }
24707      if (element.hasEnterer()) {
24708        composeReference("enterer", element.getEnterer());
24709      }
24710      if (element.hasInsurer()) {
24711        composeReference("insurer", element.getInsurer());
24712      }
24713      if (element.hasProvider()) {
24714        composeReference("provider", element.getProvider());
24715      }
24716      if (element.hasOrganization()) {
24717        composeReference("organization", element.getOrganization());
24718      }
24719      if (element.hasPriority()) {
24720        composeCodeableConcept("priority", element.getPriority());
24721      }
24722      if (element.hasFundsReserve()) {
24723        composeCodeableConcept("fundsReserve", element.getFundsReserve());
24724      }
24725      if (element.hasRelated()) {
24726        openArray("related");
24727        for (Claim.RelatedClaimComponent e : element.getRelated()) 
24728          composeClaimRelatedClaimComponent(null, e);
24729        closeArray();
24730      };
24731      if (element.hasPrescription()) {
24732        composeReference("prescription", element.getPrescription());
24733      }
24734      if (element.hasOriginalPrescription()) {
24735        composeReference("originalPrescription", element.getOriginalPrescription());
24736      }
24737      if (element.hasPayee()) {
24738        composeClaimPayeeComponent("payee", element.getPayee());
24739      }
24740      if (element.hasReferral()) {
24741        composeReference("referral", element.getReferral());
24742      }
24743      if (element.hasFacility()) {
24744        composeReference("facility", element.getFacility());
24745      }
24746      if (element.hasCareTeam()) {
24747        openArray("careTeam");
24748        for (Claim.CareTeamComponent e : element.getCareTeam()) 
24749          composeClaimCareTeamComponent(null, e);
24750        closeArray();
24751      };
24752      if (element.hasInformation()) {
24753        openArray("information");
24754        for (Claim.SpecialConditionComponent e : element.getInformation()) 
24755          composeClaimSpecialConditionComponent(null, e);
24756        closeArray();
24757      };
24758      if (element.hasDiagnosis()) {
24759        openArray("diagnosis");
24760        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
24761          composeClaimDiagnosisComponent(null, e);
24762        closeArray();
24763      };
24764      if (element.hasProcedure()) {
24765        openArray("procedure");
24766        for (Claim.ProcedureComponent e : element.getProcedure()) 
24767          composeClaimProcedureComponent(null, e);
24768        closeArray();
24769      };
24770      if (element.hasInsurance()) {
24771        openArray("insurance");
24772        for (Claim.InsuranceComponent e : element.getInsurance()) 
24773          composeClaimInsuranceComponent(null, e);
24774        closeArray();
24775      };
24776      if (element.hasAccident()) {
24777        composeClaimAccidentComponent("accident", element.getAccident());
24778      }
24779      if (element.hasEmploymentImpacted()) {
24780        composePeriod("employmentImpacted", element.getEmploymentImpacted());
24781      }
24782      if (element.hasHospitalization()) {
24783        composePeriod("hospitalization", element.getHospitalization());
24784      }
24785      if (element.hasItem()) {
24786        openArray("item");
24787        for (Claim.ItemComponent e : element.getItem()) 
24788          composeClaimItemComponent(null, e);
24789        closeArray();
24790      };
24791      if (element.hasTotal()) {
24792        composeMoney("total", element.getTotal());
24793      }
24794  }
24795
24796  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
24797    if (element != null) {
24798      open(name);
24799      composeClaimRelatedClaimComponentInner(element);
24800      close();
24801    }
24802  }
24803
24804  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
24805      composeBackbone(element);
24806      if (element.hasClaim()) {
24807        composeReference("claim", element.getClaim());
24808      }
24809      if (element.hasRelationship()) {
24810        composeCodeableConcept("relationship", element.getRelationship());
24811      }
24812      if (element.hasReference()) {
24813        composeIdentifier("reference", element.getReference());
24814      }
24815  }
24816
24817  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
24818    if (element != null) {
24819      open(name);
24820      composeClaimPayeeComponentInner(element);
24821      close();
24822    }
24823  }
24824
24825  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
24826      composeBackbone(element);
24827      if (element.hasType()) {
24828        composeCodeableConcept("type", element.getType());
24829      }
24830      if (element.hasResourceType()) {
24831        composeCoding("resourceType", element.getResourceType());
24832      }
24833      if (element.hasParty()) {
24834        composeReference("party", element.getParty());
24835      }
24836  }
24837
24838  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
24839    if (element != null) {
24840      open(name);
24841      composeClaimCareTeamComponentInner(element);
24842      close();
24843    }
24844  }
24845
24846  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
24847      composeBackbone(element);
24848      if (element.hasSequenceElement()) {
24849        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24850        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24851      }
24852      if (element.hasProvider()) {
24853        composeReference("provider", element.getProvider());
24854      }
24855      if (element.hasResponsibleElement()) {
24856        composeBooleanCore("responsible", element.getResponsibleElement(), false);
24857        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
24858      }
24859      if (element.hasRole()) {
24860        composeCodeableConcept("role", element.getRole());
24861      }
24862      if (element.hasQualification()) {
24863        composeCodeableConcept("qualification", element.getQualification());
24864      }
24865  }
24866
24867  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
24868    if (element != null) {
24869      open(name);
24870      composeClaimSpecialConditionComponentInner(element);
24871      close();
24872    }
24873  }
24874
24875  protected void composeClaimSpecialConditionComponentInner(Claim.SpecialConditionComponent element) throws IOException {
24876      composeBackbone(element);
24877      if (element.hasSequenceElement()) {
24878        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24879        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24880      }
24881      if (element.hasCategory()) {
24882        composeCodeableConcept("category", element.getCategory());
24883      }
24884      if (element.hasCode()) {
24885        composeCodeableConcept("code", element.getCode());
24886      }
24887      if (element.hasTiming()) {
24888        composeType("timing", element.getTiming());
24889      }
24890      if (element.hasValue()) {
24891        composeType("value", element.getValue());
24892      }
24893      if (element.hasReason()) {
24894        composeCodeableConcept("reason", element.getReason());
24895      }
24896  }
24897
24898  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
24899    if (element != null) {
24900      open(name);
24901      composeClaimDiagnosisComponentInner(element);
24902      close();
24903    }
24904  }
24905
24906  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
24907      composeBackbone(element);
24908      if (element.hasSequenceElement()) {
24909        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24910        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24911      }
24912      if (element.hasDiagnosis()) {
24913        composeType("diagnosis", element.getDiagnosis());
24914      }
24915      if (element.hasType()) {
24916        openArray("type");
24917        for (CodeableConcept e : element.getType()) 
24918          composeCodeableConcept(null, e);
24919        closeArray();
24920      };
24921      if (element.hasPackageCode()) {
24922        composeCodeableConcept("packageCode", element.getPackageCode());
24923      }
24924  }
24925
24926  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
24927    if (element != null) {
24928      open(name);
24929      composeClaimProcedureComponentInner(element);
24930      close();
24931    }
24932  }
24933
24934  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
24935      composeBackbone(element);
24936      if (element.hasSequenceElement()) {
24937        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24938        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24939      }
24940      if (element.hasDateElement()) {
24941        composeDateTimeCore("date", element.getDateElement(), false);
24942        composeDateTimeExtras("date", element.getDateElement(), false);
24943      }
24944      if (element.hasProcedure()) {
24945        composeType("procedure", element.getProcedure());
24946      }
24947  }
24948
24949  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
24950    if (element != null) {
24951      open(name);
24952      composeClaimInsuranceComponentInner(element);
24953      close();
24954    }
24955  }
24956
24957  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
24958      composeBackbone(element);
24959      if (element.hasSequenceElement()) {
24960        composePositiveIntCore("sequence", element.getSequenceElement(), false);
24961        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
24962      }
24963      if (element.hasFocalElement()) {
24964        composeBooleanCore("focal", element.getFocalElement(), false);
24965        composeBooleanExtras("focal", element.getFocalElement(), false);
24966      }
24967      if (element.hasCoverage()) {
24968        composeReference("coverage", element.getCoverage());
24969      }
24970      if (element.hasBusinessArrangementElement()) {
24971        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
24972        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
24973      }
24974      if (element.hasPreAuthRef()) {
24975        openArray("preAuthRef");
24976        for (StringType e : element.getPreAuthRef()) 
24977          composeStringCore(null, e, true);
24978        closeArray();
24979        if (anyHasExtras(element.getPreAuthRef())) {
24980          openArray("_preAuthRef");
24981          for (StringType e : element.getPreAuthRef()) 
24982            composeStringExtras(null, e, true);
24983          closeArray();
24984        }
24985      };
24986      if (element.hasClaimResponse()) {
24987        composeReference("claimResponse", element.getClaimResponse());
24988      }
24989  }
24990
24991  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
24992    if (element != null) {
24993      open(name);
24994      composeClaimAccidentComponentInner(element);
24995      close();
24996    }
24997  }
24998
24999  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
25000      composeBackbone(element);
25001      if (element.hasDateElement()) {
25002        composeDateCore("date", element.getDateElement(), false);
25003        composeDateExtras("date", element.getDateElement(), false);
25004      }
25005      if (element.hasType()) {
25006        composeCodeableConcept("type", element.getType());
25007      }
25008      if (element.hasLocation()) {
25009        composeType("location", element.getLocation());
25010      }
25011  }
25012
25013  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
25014    if (element != null) {
25015      open(name);
25016      composeClaimItemComponentInner(element);
25017      close();
25018    }
25019  }
25020
25021  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
25022      composeBackbone(element);
25023      if (element.hasSequenceElement()) {
25024        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25025        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25026      }
25027      if (element.hasCareTeamLinkId()) {
25028        openArray("careTeamLinkId");
25029        for (PositiveIntType e : element.getCareTeamLinkId()) 
25030          composePositiveIntCore(null, e, true);
25031        closeArray();
25032        if (anyHasExtras(element.getCareTeamLinkId())) {
25033          openArray("_careTeamLinkId");
25034          for (PositiveIntType e : element.getCareTeamLinkId()) 
25035            composePositiveIntExtras(null, e, true);
25036          closeArray();
25037        }
25038      };
25039      if (element.hasDiagnosisLinkId()) {
25040        openArray("diagnosisLinkId");
25041        for (PositiveIntType e : element.getDiagnosisLinkId()) 
25042          composePositiveIntCore(null, e, true);
25043        closeArray();
25044        if (anyHasExtras(element.getDiagnosisLinkId())) {
25045          openArray("_diagnosisLinkId");
25046          for (PositiveIntType e : element.getDiagnosisLinkId()) 
25047            composePositiveIntExtras(null, e, true);
25048          closeArray();
25049        }
25050      };
25051      if (element.hasProcedureLinkId()) {
25052        openArray("procedureLinkId");
25053        for (PositiveIntType e : element.getProcedureLinkId()) 
25054          composePositiveIntCore(null, e, true);
25055        closeArray();
25056        if (anyHasExtras(element.getProcedureLinkId())) {
25057          openArray("_procedureLinkId");
25058          for (PositiveIntType e : element.getProcedureLinkId()) 
25059            composePositiveIntExtras(null, e, true);
25060          closeArray();
25061        }
25062      };
25063      if (element.hasInformationLinkId()) {
25064        openArray("informationLinkId");
25065        for (PositiveIntType e : element.getInformationLinkId()) 
25066          composePositiveIntCore(null, e, true);
25067        closeArray();
25068        if (anyHasExtras(element.getInformationLinkId())) {
25069          openArray("_informationLinkId");
25070          for (PositiveIntType e : element.getInformationLinkId()) 
25071            composePositiveIntExtras(null, e, true);
25072          closeArray();
25073        }
25074      };
25075      if (element.hasRevenue()) {
25076        composeCodeableConcept("revenue", element.getRevenue());
25077      }
25078      if (element.hasCategory()) {
25079        composeCodeableConcept("category", element.getCategory());
25080      }
25081      if (element.hasService()) {
25082        composeCodeableConcept("service", element.getService());
25083      }
25084      if (element.hasModifier()) {
25085        openArray("modifier");
25086        for (CodeableConcept e : element.getModifier()) 
25087          composeCodeableConcept(null, e);
25088        closeArray();
25089      };
25090      if (element.hasProgramCode()) {
25091        openArray("programCode");
25092        for (CodeableConcept e : element.getProgramCode()) 
25093          composeCodeableConcept(null, e);
25094        closeArray();
25095      };
25096      if (element.hasServiced()) {
25097        composeType("serviced", element.getServiced());
25098      }
25099      if (element.hasLocation()) {
25100        composeType("location", element.getLocation());
25101      }
25102      if (element.hasQuantity()) {
25103        composeSimpleQuantity("quantity", element.getQuantity());
25104      }
25105      if (element.hasUnitPrice()) {
25106        composeMoney("unitPrice", element.getUnitPrice());
25107      }
25108      if (element.hasFactorElement()) {
25109        composeDecimalCore("factor", element.getFactorElement(), false);
25110        composeDecimalExtras("factor", element.getFactorElement(), false);
25111      }
25112      if (element.hasNet()) {
25113        composeMoney("net", element.getNet());
25114      }
25115      if (element.hasUdi()) {
25116        openArray("udi");
25117        for (Reference e : element.getUdi()) 
25118          composeReference(null, e);
25119        closeArray();
25120      };
25121      if (element.hasBodySite()) {
25122        composeCodeableConcept("bodySite", element.getBodySite());
25123      }
25124      if (element.hasSubSite()) {
25125        openArray("subSite");
25126        for (CodeableConcept e : element.getSubSite()) 
25127          composeCodeableConcept(null, e);
25128        closeArray();
25129      };
25130      if (element.hasEncounter()) {
25131        openArray("encounter");
25132        for (Reference e : element.getEncounter()) 
25133          composeReference(null, e);
25134        closeArray();
25135      };
25136      if (element.hasDetail()) {
25137        openArray("detail");
25138        for (Claim.DetailComponent e : element.getDetail()) 
25139          composeClaimDetailComponent(null, e);
25140        closeArray();
25141      };
25142  }
25143
25144  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
25145    if (element != null) {
25146      open(name);
25147      composeClaimDetailComponentInner(element);
25148      close();
25149    }
25150  }
25151
25152  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
25153      composeBackbone(element);
25154      if (element.hasSequenceElement()) {
25155        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25156        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25157      }
25158      if (element.hasRevenue()) {
25159        composeCodeableConcept("revenue", element.getRevenue());
25160      }
25161      if (element.hasCategory()) {
25162        composeCodeableConcept("category", element.getCategory());
25163      }
25164      if (element.hasService()) {
25165        composeCodeableConcept("service", element.getService());
25166      }
25167      if (element.hasModifier()) {
25168        openArray("modifier");
25169        for (CodeableConcept e : element.getModifier()) 
25170          composeCodeableConcept(null, e);
25171        closeArray();
25172      };
25173      if (element.hasProgramCode()) {
25174        openArray("programCode");
25175        for (CodeableConcept e : element.getProgramCode()) 
25176          composeCodeableConcept(null, e);
25177        closeArray();
25178      };
25179      if (element.hasQuantity()) {
25180        composeSimpleQuantity("quantity", element.getQuantity());
25181      }
25182      if (element.hasUnitPrice()) {
25183        composeMoney("unitPrice", element.getUnitPrice());
25184      }
25185      if (element.hasFactorElement()) {
25186        composeDecimalCore("factor", element.getFactorElement(), false);
25187        composeDecimalExtras("factor", element.getFactorElement(), false);
25188      }
25189      if (element.hasNet()) {
25190        composeMoney("net", element.getNet());
25191      }
25192      if (element.hasUdi()) {
25193        openArray("udi");
25194        for (Reference e : element.getUdi()) 
25195          composeReference(null, e);
25196        closeArray();
25197      };
25198      if (element.hasSubDetail()) {
25199        openArray("subDetail");
25200        for (Claim.SubDetailComponent e : element.getSubDetail()) 
25201          composeClaimSubDetailComponent(null, e);
25202        closeArray();
25203      };
25204  }
25205
25206  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
25207    if (element != null) {
25208      open(name);
25209      composeClaimSubDetailComponentInner(element);
25210      close();
25211    }
25212  }
25213
25214  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
25215      composeBackbone(element);
25216      if (element.hasSequenceElement()) {
25217        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25218        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25219      }
25220      if (element.hasRevenue()) {
25221        composeCodeableConcept("revenue", element.getRevenue());
25222      }
25223      if (element.hasCategory()) {
25224        composeCodeableConcept("category", element.getCategory());
25225      }
25226      if (element.hasService()) {
25227        composeCodeableConcept("service", element.getService());
25228      }
25229      if (element.hasModifier()) {
25230        openArray("modifier");
25231        for (CodeableConcept e : element.getModifier()) 
25232          composeCodeableConcept(null, e);
25233        closeArray();
25234      };
25235      if (element.hasProgramCode()) {
25236        openArray("programCode");
25237        for (CodeableConcept e : element.getProgramCode()) 
25238          composeCodeableConcept(null, e);
25239        closeArray();
25240      };
25241      if (element.hasQuantity()) {
25242        composeSimpleQuantity("quantity", element.getQuantity());
25243      }
25244      if (element.hasUnitPrice()) {
25245        composeMoney("unitPrice", element.getUnitPrice());
25246      }
25247      if (element.hasFactorElement()) {
25248        composeDecimalCore("factor", element.getFactorElement(), false);
25249        composeDecimalExtras("factor", element.getFactorElement(), false);
25250      }
25251      if (element.hasNet()) {
25252        composeMoney("net", element.getNet());
25253      }
25254      if (element.hasUdi()) {
25255        openArray("udi");
25256        for (Reference e : element.getUdi()) 
25257          composeReference(null, e);
25258        closeArray();
25259      };
25260  }
25261
25262  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
25263    if (element != null) {
25264      prop("resourceType", name);
25265      composeClaimResponseInner(element);
25266    }
25267  }
25268
25269  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
25270      composeDomainResourceElements(element);
25271      if (element.hasIdentifier()) {
25272        openArray("identifier");
25273        for (Identifier e : element.getIdentifier()) 
25274          composeIdentifier(null, e);
25275        closeArray();
25276      };
25277      if (element.hasStatusElement()) {
25278        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25279        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
25280      }
25281      if (element.hasPatient()) {
25282        composeReference("patient", element.getPatient());
25283      }
25284      if (element.hasCreatedElement()) {
25285        composeDateTimeCore("created", element.getCreatedElement(), false);
25286        composeDateTimeExtras("created", element.getCreatedElement(), false);
25287      }
25288      if (element.hasInsurer()) {
25289        composeReference("insurer", element.getInsurer());
25290      }
25291      if (element.hasRequestProvider()) {
25292        composeReference("requestProvider", element.getRequestProvider());
25293      }
25294      if (element.hasRequestOrganization()) {
25295        composeReference("requestOrganization", element.getRequestOrganization());
25296      }
25297      if (element.hasRequest()) {
25298        composeReference("request", element.getRequest());
25299      }
25300      if (element.hasOutcome()) {
25301        composeCodeableConcept("outcome", element.getOutcome());
25302      }
25303      if (element.hasDispositionElement()) {
25304        composeStringCore("disposition", element.getDispositionElement(), false);
25305        composeStringExtras("disposition", element.getDispositionElement(), false);
25306      }
25307      if (element.hasPayeeType()) {
25308        composeCodeableConcept("payeeType", element.getPayeeType());
25309      }
25310      if (element.hasItem()) {
25311        openArray("item");
25312        for (ClaimResponse.ItemComponent e : element.getItem()) 
25313          composeClaimResponseItemComponent(null, e);
25314        closeArray();
25315      };
25316      if (element.hasAddItem()) {
25317        openArray("addItem");
25318        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
25319          composeClaimResponseAddedItemComponent(null, e);
25320        closeArray();
25321      };
25322      if (element.hasError()) {
25323        openArray("error");
25324        for (ClaimResponse.ErrorComponent e : element.getError()) 
25325          composeClaimResponseErrorComponent(null, e);
25326        closeArray();
25327      };
25328      if (element.hasTotalCost()) {
25329        composeMoney("totalCost", element.getTotalCost());
25330      }
25331      if (element.hasUnallocDeductable()) {
25332        composeMoney("unallocDeductable", element.getUnallocDeductable());
25333      }
25334      if (element.hasTotalBenefit()) {
25335        composeMoney("totalBenefit", element.getTotalBenefit());
25336      }
25337      if (element.hasPayment()) {
25338        composeClaimResponsePaymentComponent("payment", element.getPayment());
25339      }
25340      if (element.hasReserved()) {
25341        composeCoding("reserved", element.getReserved());
25342      }
25343      if (element.hasForm()) {
25344        composeCodeableConcept("form", element.getForm());
25345      }
25346      if (element.hasProcessNote()) {
25347        openArray("processNote");
25348        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
25349          composeClaimResponseNoteComponent(null, e);
25350        closeArray();
25351      };
25352      if (element.hasCommunicationRequest()) {
25353        openArray("communicationRequest");
25354        for (Reference e : element.getCommunicationRequest()) 
25355          composeReference(null, e);
25356        closeArray();
25357      };
25358      if (element.hasInsurance()) {
25359        openArray("insurance");
25360        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
25361          composeClaimResponseInsuranceComponent(null, e);
25362        closeArray();
25363      };
25364  }
25365
25366  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
25367    if (element != null) {
25368      open(name);
25369      composeClaimResponseItemComponentInner(element);
25370      close();
25371    }
25372  }
25373
25374  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
25375      composeBackbone(element);
25376      if (element.hasSequenceLinkIdElement()) {
25377        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25378        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25379      }
25380      if (element.hasNoteNumber()) {
25381        openArray("noteNumber");
25382        for (PositiveIntType e : element.getNoteNumber()) 
25383          composePositiveIntCore(null, e, true);
25384        closeArray();
25385        if (anyHasExtras(element.getNoteNumber())) {
25386          openArray("_noteNumber");
25387          for (PositiveIntType e : element.getNoteNumber()) 
25388            composePositiveIntExtras(null, e, true);
25389          closeArray();
25390        }
25391      };
25392      if (element.hasAdjudication()) {
25393        openArray("adjudication");
25394        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25395          composeClaimResponseAdjudicationComponent(null, e);
25396        closeArray();
25397      };
25398      if (element.hasDetail()) {
25399        openArray("detail");
25400        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
25401          composeClaimResponseItemDetailComponent(null, e);
25402        closeArray();
25403      };
25404  }
25405
25406  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
25407    if (element != null) {
25408      open(name);
25409      composeClaimResponseAdjudicationComponentInner(element);
25410      close();
25411    }
25412  }
25413
25414  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
25415      composeBackbone(element);
25416      if (element.hasCategory()) {
25417        composeCodeableConcept("category", element.getCategory());
25418      }
25419      if (element.hasReason()) {
25420        composeCodeableConcept("reason", element.getReason());
25421      }
25422      if (element.hasAmount()) {
25423        composeMoney("amount", element.getAmount());
25424      }
25425      if (element.hasValueElement()) {
25426        composeDecimalCore("value", element.getValueElement(), false);
25427        composeDecimalExtras("value", element.getValueElement(), false);
25428      }
25429  }
25430
25431  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
25432    if (element != null) {
25433      open(name);
25434      composeClaimResponseItemDetailComponentInner(element);
25435      close();
25436    }
25437  }
25438
25439  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
25440      composeBackbone(element);
25441      if (element.hasSequenceLinkIdElement()) {
25442        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25443        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25444      }
25445      if (element.hasNoteNumber()) {
25446        openArray("noteNumber");
25447        for (PositiveIntType e : element.getNoteNumber()) 
25448          composePositiveIntCore(null, e, true);
25449        closeArray();
25450        if (anyHasExtras(element.getNoteNumber())) {
25451          openArray("_noteNumber");
25452          for (PositiveIntType e : element.getNoteNumber()) 
25453            composePositiveIntExtras(null, e, true);
25454          closeArray();
25455        }
25456      };
25457      if (element.hasAdjudication()) {
25458        openArray("adjudication");
25459        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25460          composeClaimResponseAdjudicationComponent(null, e);
25461        closeArray();
25462      };
25463      if (element.hasSubDetail()) {
25464        openArray("subDetail");
25465        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
25466          composeClaimResponseSubDetailComponent(null, e);
25467        closeArray();
25468      };
25469  }
25470
25471  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
25472    if (element != null) {
25473      open(name);
25474      composeClaimResponseSubDetailComponentInner(element);
25475      close();
25476    }
25477  }
25478
25479  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
25480      composeBackbone(element);
25481      if (element.hasSequenceLinkIdElement()) {
25482        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25483        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25484      }
25485      if (element.hasNoteNumber()) {
25486        openArray("noteNumber");
25487        for (PositiveIntType e : element.getNoteNumber()) 
25488          composePositiveIntCore(null, e, true);
25489        closeArray();
25490        if (anyHasExtras(element.getNoteNumber())) {
25491          openArray("_noteNumber");
25492          for (PositiveIntType e : element.getNoteNumber()) 
25493            composePositiveIntExtras(null, e, true);
25494          closeArray();
25495        }
25496      };
25497      if (element.hasAdjudication()) {
25498        openArray("adjudication");
25499        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25500          composeClaimResponseAdjudicationComponent(null, e);
25501        closeArray();
25502      };
25503  }
25504
25505  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
25506    if (element != null) {
25507      open(name);
25508      composeClaimResponseAddedItemComponentInner(element);
25509      close();
25510    }
25511  }
25512
25513  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
25514      composeBackbone(element);
25515      if (element.hasSequenceLinkId()) {
25516        openArray("sequenceLinkId");
25517        for (PositiveIntType e : element.getSequenceLinkId()) 
25518          composePositiveIntCore(null, e, true);
25519        closeArray();
25520        if (anyHasExtras(element.getSequenceLinkId())) {
25521          openArray("_sequenceLinkId");
25522          for (PositiveIntType e : element.getSequenceLinkId()) 
25523            composePositiveIntExtras(null, e, true);
25524          closeArray();
25525        }
25526      };
25527      if (element.hasRevenue()) {
25528        composeCodeableConcept("revenue", element.getRevenue());
25529      }
25530      if (element.hasCategory()) {
25531        composeCodeableConcept("category", element.getCategory());
25532      }
25533      if (element.hasService()) {
25534        composeCodeableConcept("service", element.getService());
25535      }
25536      if (element.hasModifier()) {
25537        openArray("modifier");
25538        for (CodeableConcept e : element.getModifier()) 
25539          composeCodeableConcept(null, e);
25540        closeArray();
25541      };
25542      if (element.hasFee()) {
25543        composeMoney("fee", element.getFee());
25544      }
25545      if (element.hasNoteNumber()) {
25546        openArray("noteNumber");
25547        for (PositiveIntType e : element.getNoteNumber()) 
25548          composePositiveIntCore(null, e, true);
25549        closeArray();
25550        if (anyHasExtras(element.getNoteNumber())) {
25551          openArray("_noteNumber");
25552          for (PositiveIntType e : element.getNoteNumber()) 
25553            composePositiveIntExtras(null, e, true);
25554          closeArray();
25555        }
25556      };
25557      if (element.hasAdjudication()) {
25558        openArray("adjudication");
25559        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25560          composeClaimResponseAdjudicationComponent(null, e);
25561        closeArray();
25562      };
25563      if (element.hasDetail()) {
25564        openArray("detail");
25565        for (ClaimResponse.AddedItemsDetailComponent e : element.getDetail()) 
25566          composeClaimResponseAddedItemsDetailComponent(null, e);
25567        closeArray();
25568      };
25569  }
25570
25571  protected void composeClaimResponseAddedItemsDetailComponent(String name, ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25572    if (element != null) {
25573      open(name);
25574      composeClaimResponseAddedItemsDetailComponentInner(element);
25575      close();
25576    }
25577  }
25578
25579  protected void composeClaimResponseAddedItemsDetailComponentInner(ClaimResponse.AddedItemsDetailComponent element) throws IOException {
25580      composeBackbone(element);
25581      if (element.hasRevenue()) {
25582        composeCodeableConcept("revenue", element.getRevenue());
25583      }
25584      if (element.hasCategory()) {
25585        composeCodeableConcept("category", element.getCategory());
25586      }
25587      if (element.hasService()) {
25588        composeCodeableConcept("service", element.getService());
25589      }
25590      if (element.hasModifier()) {
25591        openArray("modifier");
25592        for (CodeableConcept e : element.getModifier()) 
25593          composeCodeableConcept(null, e);
25594        closeArray();
25595      };
25596      if (element.hasFee()) {
25597        composeMoney("fee", element.getFee());
25598      }
25599      if (element.hasNoteNumber()) {
25600        openArray("noteNumber");
25601        for (PositiveIntType e : element.getNoteNumber()) 
25602          composePositiveIntCore(null, e, true);
25603        closeArray();
25604        if (anyHasExtras(element.getNoteNumber())) {
25605          openArray("_noteNumber");
25606          for (PositiveIntType e : element.getNoteNumber()) 
25607            composePositiveIntExtras(null, e, true);
25608          closeArray();
25609        }
25610      };
25611      if (element.hasAdjudication()) {
25612        openArray("adjudication");
25613        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
25614          composeClaimResponseAdjudicationComponent(null, e);
25615        closeArray();
25616      };
25617  }
25618
25619  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
25620    if (element != null) {
25621      open(name);
25622      composeClaimResponseErrorComponentInner(element);
25623      close();
25624    }
25625  }
25626
25627  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
25628      composeBackbone(element);
25629      if (element.hasSequenceLinkIdElement()) {
25630        composePositiveIntCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25631        composePositiveIntExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
25632      }
25633      if (element.hasDetailSequenceLinkIdElement()) {
25634        composePositiveIntCore("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25635        composePositiveIntExtras("detailSequenceLinkId", element.getDetailSequenceLinkIdElement(), false);
25636      }
25637      if (element.hasSubdetailSequenceLinkIdElement()) {
25638        composePositiveIntCore("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25639        composePositiveIntExtras("subdetailSequenceLinkId", element.getSubdetailSequenceLinkIdElement(), false);
25640      }
25641      if (element.hasCode()) {
25642        composeCodeableConcept("code", element.getCode());
25643      }
25644  }
25645
25646  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
25647    if (element != null) {
25648      open(name);
25649      composeClaimResponsePaymentComponentInner(element);
25650      close();
25651    }
25652  }
25653
25654  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
25655      composeBackbone(element);
25656      if (element.hasType()) {
25657        composeCodeableConcept("type", element.getType());
25658      }
25659      if (element.hasAdjustment()) {
25660        composeMoney("adjustment", element.getAdjustment());
25661      }
25662      if (element.hasAdjustmentReason()) {
25663        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
25664      }
25665      if (element.hasDateElement()) {
25666        composeDateCore("date", element.getDateElement(), false);
25667        composeDateExtras("date", element.getDateElement(), false);
25668      }
25669      if (element.hasAmount()) {
25670        composeMoney("amount", element.getAmount());
25671      }
25672      if (element.hasIdentifier()) {
25673        composeIdentifier("identifier", element.getIdentifier());
25674      }
25675  }
25676
25677  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
25678    if (element != null) {
25679      open(name);
25680      composeClaimResponseNoteComponentInner(element);
25681      close();
25682    }
25683  }
25684
25685  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
25686      composeBackbone(element);
25687      if (element.hasNumberElement()) {
25688        composePositiveIntCore("number", element.getNumberElement(), false);
25689        composePositiveIntExtras("number", element.getNumberElement(), false);
25690      }
25691      if (element.hasType()) {
25692        composeCodeableConcept("type", element.getType());
25693      }
25694      if (element.hasTextElement()) {
25695        composeStringCore("text", element.getTextElement(), false);
25696        composeStringExtras("text", element.getTextElement(), false);
25697      }
25698      if (element.hasLanguage()) {
25699        composeCodeableConcept("language", element.getLanguage());
25700      }
25701  }
25702
25703  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
25704    if (element != null) {
25705      open(name);
25706      composeClaimResponseInsuranceComponentInner(element);
25707      close();
25708    }
25709  }
25710
25711  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
25712      composeBackbone(element);
25713      if (element.hasSequenceElement()) {
25714        composePositiveIntCore("sequence", element.getSequenceElement(), false);
25715        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
25716      }
25717      if (element.hasFocalElement()) {
25718        composeBooleanCore("focal", element.getFocalElement(), false);
25719        composeBooleanExtras("focal", element.getFocalElement(), false);
25720      }
25721      if (element.hasCoverage()) {
25722        composeReference("coverage", element.getCoverage());
25723      }
25724      if (element.hasBusinessArrangementElement()) {
25725        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
25726        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
25727      }
25728      if (element.hasPreAuthRef()) {
25729        openArray("preAuthRef");
25730        for (StringType e : element.getPreAuthRef()) 
25731          composeStringCore(null, e, true);
25732        closeArray();
25733        if (anyHasExtras(element.getPreAuthRef())) {
25734          openArray("_preAuthRef");
25735          for (StringType e : element.getPreAuthRef()) 
25736            composeStringExtras(null, e, true);
25737          closeArray();
25738        }
25739      };
25740      if (element.hasClaimResponse()) {
25741        composeReference("claimResponse", element.getClaimResponse());
25742      }
25743  }
25744
25745  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
25746    if (element != null) {
25747      prop("resourceType", name);
25748      composeClinicalImpressionInner(element);
25749    }
25750  }
25751
25752  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
25753      composeDomainResourceElements(element);
25754      if (element.hasIdentifier()) {
25755        openArray("identifier");
25756        for (Identifier e : element.getIdentifier()) 
25757          composeIdentifier(null, e);
25758        closeArray();
25759      };
25760      if (element.hasStatusElement()) {
25761        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
25762        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
25763      }
25764      if (element.hasCode()) {
25765        composeCodeableConcept("code", element.getCode());
25766      }
25767      if (element.hasDescriptionElement()) {
25768        composeStringCore("description", element.getDescriptionElement(), false);
25769        composeStringExtras("description", element.getDescriptionElement(), false);
25770      }
25771      if (element.hasSubject()) {
25772        composeReference("subject", element.getSubject());
25773      }
25774      if (element.hasContext()) {
25775        composeReference("context", element.getContext());
25776      }
25777      if (element.hasEffective()) {
25778        composeType("effective", element.getEffective());
25779      }
25780      if (element.hasDateElement()) {
25781        composeDateTimeCore("date", element.getDateElement(), false);
25782        composeDateTimeExtras("date", element.getDateElement(), false);
25783      }
25784      if (element.hasAssessor()) {
25785        composeReference("assessor", element.getAssessor());
25786      }
25787      if (element.hasPrevious()) {
25788        composeReference("previous", element.getPrevious());
25789      }
25790      if (element.hasProblem()) {
25791        openArray("problem");
25792        for (Reference e : element.getProblem()) 
25793          composeReference(null, e);
25794        closeArray();
25795      };
25796      if (element.hasInvestigation()) {
25797        openArray("investigation");
25798        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
25799          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
25800        closeArray();
25801      };
25802      if (element.hasProtocol()) {
25803        openArray("protocol");
25804        for (UriType e : element.getProtocol()) 
25805          composeUriCore(null, e, true);
25806        closeArray();
25807        if (anyHasExtras(element.getProtocol())) {
25808          openArray("_protocol");
25809          for (UriType e : element.getProtocol()) 
25810            composeUriExtras(null, e, true);
25811          closeArray();
25812        }
25813      };
25814      if (element.hasSummaryElement()) {
25815        composeStringCore("summary", element.getSummaryElement(), false);
25816        composeStringExtras("summary", element.getSummaryElement(), false);
25817      }
25818      if (element.hasFinding()) {
25819        openArray("finding");
25820        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
25821          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
25822        closeArray();
25823      };
25824      if (element.hasPrognosisCodeableConcept()) {
25825        openArray("prognosisCodeableConcept");
25826        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
25827          composeCodeableConcept(null, e);
25828        closeArray();
25829      };
25830      if (element.hasPrognosisReference()) {
25831        openArray("prognosisReference");
25832        for (Reference e : element.getPrognosisReference()) 
25833          composeReference(null, e);
25834        closeArray();
25835      };
25836      if (element.hasAction()) {
25837        openArray("action");
25838        for (Reference e : element.getAction()) 
25839          composeReference(null, e);
25840        closeArray();
25841      };
25842      if (element.hasNote()) {
25843        openArray("note");
25844        for (Annotation e : element.getNote()) 
25845          composeAnnotation(null, e);
25846        closeArray();
25847      };
25848  }
25849
25850  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
25851    if (element != null) {
25852      open(name);
25853      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
25854      close();
25855    }
25856  }
25857
25858  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
25859      composeBackbone(element);
25860      if (element.hasCode()) {
25861        composeCodeableConcept("code", element.getCode());
25862      }
25863      if (element.hasItem()) {
25864        openArray("item");
25865        for (Reference e : element.getItem()) 
25866          composeReference(null, e);
25867        closeArray();
25868      };
25869  }
25870
25871  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
25872    if (element != null) {
25873      open(name);
25874      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
25875      close();
25876    }
25877  }
25878
25879  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
25880      composeBackbone(element);
25881      if (element.hasItem()) {
25882        composeType("item", element.getItem());
25883      }
25884      if (element.hasBasisElement()) {
25885        composeStringCore("basis", element.getBasisElement(), false);
25886        composeStringExtras("basis", element.getBasisElement(), false);
25887      }
25888  }
25889
25890  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
25891    if (element != null) {
25892      prop("resourceType", name);
25893      composeCodeSystemInner(element);
25894    }
25895  }
25896
25897  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
25898      composeDomainResourceElements(element);
25899      if (element.hasUrlElement()) {
25900        composeUriCore("url", element.getUrlElement(), false);
25901        composeUriExtras("url", element.getUrlElement(), false);
25902      }
25903      if (element.hasIdentifier()) {
25904        composeIdentifier("identifier", element.getIdentifier());
25905      }
25906      if (element.hasVersionElement()) {
25907        composeStringCore("version", element.getVersionElement(), false);
25908        composeStringExtras("version", element.getVersionElement(), false);
25909      }
25910      if (element.hasNameElement()) {
25911        composeStringCore("name", element.getNameElement(), false);
25912        composeStringExtras("name", element.getNameElement(), false);
25913      }
25914      if (element.hasTitleElement()) {
25915        composeStringCore("title", element.getTitleElement(), false);
25916        composeStringExtras("title", element.getTitleElement(), false);
25917      }
25918      if (element.hasStatusElement()) {
25919        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
25920        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
25921      }
25922      if (element.hasExperimentalElement()) {
25923        composeBooleanCore("experimental", element.getExperimentalElement(), false);
25924        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
25925      }
25926      if (element.hasDateElement()) {
25927        composeDateTimeCore("date", element.getDateElement(), false);
25928        composeDateTimeExtras("date", element.getDateElement(), false);
25929      }
25930      if (element.hasPublisherElement()) {
25931        composeStringCore("publisher", element.getPublisherElement(), false);
25932        composeStringExtras("publisher", element.getPublisherElement(), false);
25933      }
25934      if (element.hasContact()) {
25935        openArray("contact");
25936        for (ContactDetail e : element.getContact()) 
25937          composeContactDetail(null, e);
25938        closeArray();
25939      };
25940      if (element.hasDescriptionElement()) {
25941        composeMarkdownCore("description", element.getDescriptionElement(), false);
25942        composeMarkdownExtras("description", element.getDescriptionElement(), false);
25943      }
25944      if (element.hasUseContext()) {
25945        openArray("useContext");
25946        for (UsageContext e : element.getUseContext()) 
25947          composeUsageContext(null, e);
25948        closeArray();
25949      };
25950      if (element.hasJurisdiction()) {
25951        openArray("jurisdiction");
25952        for (CodeableConcept e : element.getJurisdiction()) 
25953          composeCodeableConcept(null, e);
25954        closeArray();
25955      };
25956      if (element.hasPurposeElement()) {
25957        composeMarkdownCore("purpose", element.getPurposeElement(), false);
25958        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
25959      }
25960      if (element.hasCopyrightElement()) {
25961        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
25962        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
25963      }
25964      if (element.hasCaseSensitiveElement()) {
25965        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
25966        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
25967      }
25968      if (element.hasValueSetElement()) {
25969        composeUriCore("valueSet", element.getValueSetElement(), false);
25970        composeUriExtras("valueSet", element.getValueSetElement(), false);
25971      }
25972      if (element.hasHierarchyMeaningElement()) {
25973        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
25974        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
25975      }
25976      if (element.hasCompositionalElement()) {
25977        composeBooleanCore("compositional", element.getCompositionalElement(), false);
25978        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
25979      }
25980      if (element.hasVersionNeededElement()) {
25981        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
25982        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
25983      }
25984      if (element.hasContentElement()) {
25985        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
25986        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
25987      }
25988      if (element.hasCountElement()) {
25989        composeUnsignedIntCore("count", element.getCountElement(), false);
25990        composeUnsignedIntExtras("count", element.getCountElement(), false);
25991      }
25992      if (element.hasFilter()) {
25993        openArray("filter");
25994        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
25995          composeCodeSystemCodeSystemFilterComponent(null, e);
25996        closeArray();
25997      };
25998      if (element.hasProperty()) {
25999        openArray("property");
26000        for (CodeSystem.PropertyComponent e : element.getProperty()) 
26001          composeCodeSystemPropertyComponent(null, e);
26002        closeArray();
26003      };
26004      if (element.hasConcept()) {
26005        openArray("concept");
26006        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
26007          composeCodeSystemConceptDefinitionComponent(null, e);
26008        closeArray();
26009      };
26010  }
26011
26012  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
26013    if (element != null) {
26014      open(name);
26015      composeCodeSystemCodeSystemFilterComponentInner(element);
26016      close();
26017    }
26018  }
26019
26020  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
26021      composeBackbone(element);
26022      if (element.hasCodeElement()) {
26023        composeCodeCore("code", element.getCodeElement(), false);
26024        composeCodeExtras("code", element.getCodeElement(), false);
26025      }
26026      if (element.hasDescriptionElement()) {
26027        composeStringCore("description", element.getDescriptionElement(), false);
26028        composeStringExtras("description", element.getDescriptionElement(), false);
26029      }
26030      if (element.hasOperator()) {
26031        openArray("operator");
26032        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26033          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26034        closeArray();
26035        if (anyHasExtras(element.getOperator())) {
26036          openArray("_operator");
26037          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
26038            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
26039          closeArray();
26040        }
26041      };
26042      if (element.hasValueElement()) {
26043        composeStringCore("value", element.getValueElement(), false);
26044        composeStringExtras("value", element.getValueElement(), false);
26045      }
26046  }
26047
26048  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
26049    if (element != null) {
26050      open(name);
26051      composeCodeSystemPropertyComponentInner(element);
26052      close();
26053    }
26054  }
26055
26056  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
26057      composeBackbone(element);
26058      if (element.hasCodeElement()) {
26059        composeCodeCore("code", element.getCodeElement(), false);
26060        composeCodeExtras("code", element.getCodeElement(), false);
26061      }
26062      if (element.hasUriElement()) {
26063        composeUriCore("uri", element.getUriElement(), false);
26064        composeUriExtras("uri", element.getUriElement(), false);
26065      }
26066      if (element.hasDescriptionElement()) {
26067        composeStringCore("description", element.getDescriptionElement(), false);
26068        composeStringExtras("description", element.getDescriptionElement(), false);
26069      }
26070      if (element.hasTypeElement()) {
26071        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26072        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
26073      }
26074  }
26075
26076  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
26077    if (element != null) {
26078      open(name);
26079      composeCodeSystemConceptDefinitionComponentInner(element);
26080      close();
26081    }
26082  }
26083
26084  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
26085      composeBackbone(element);
26086      if (element.hasCodeElement()) {
26087        composeCodeCore("code", element.getCodeElement(), false);
26088        composeCodeExtras("code", element.getCodeElement(), false);
26089      }
26090      if (element.hasDisplayElement()) {
26091        composeStringCore("display", element.getDisplayElement(), false);
26092        composeStringExtras("display", element.getDisplayElement(), false);
26093      }
26094      if (element.hasDefinitionElement()) {
26095        composeStringCore("definition", element.getDefinitionElement(), false);
26096        composeStringExtras("definition", element.getDefinitionElement(), false);
26097      }
26098      if (element.hasDesignation()) {
26099        openArray("designation");
26100        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
26101          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
26102        closeArray();
26103      };
26104      if (element.hasProperty()) {
26105        openArray("property");
26106        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
26107          composeCodeSystemConceptPropertyComponent(null, e);
26108        closeArray();
26109      };
26110      if (element.hasConcept()) {
26111        openArray("concept");
26112        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
26113          composeCodeSystemConceptDefinitionComponent(null, e);
26114        closeArray();
26115      };
26116  }
26117
26118  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26119    if (element != null) {
26120      open(name);
26121      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
26122      close();
26123    }
26124  }
26125
26126  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
26127      composeBackbone(element);
26128      if (element.hasLanguageElement()) {
26129        composeCodeCore("language", element.getLanguageElement(), false);
26130        composeCodeExtras("language", element.getLanguageElement(), false);
26131      }
26132      if (element.hasUse()) {
26133        composeCoding("use", element.getUse());
26134      }
26135      if (element.hasValueElement()) {
26136        composeStringCore("value", element.getValueElement(), false);
26137        composeStringExtras("value", element.getValueElement(), false);
26138      }
26139  }
26140
26141  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
26142    if (element != null) {
26143      open(name);
26144      composeCodeSystemConceptPropertyComponentInner(element);
26145      close();
26146    }
26147  }
26148
26149  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
26150      composeBackbone(element);
26151      if (element.hasCodeElement()) {
26152        composeCodeCore("code", element.getCodeElement(), false);
26153        composeCodeExtras("code", element.getCodeElement(), false);
26154      }
26155      if (element.hasValue()) {
26156        composeType("value", element.getValue());
26157      }
26158  }
26159
26160  protected void composeCommunication(String name, Communication element) throws IOException {
26161    if (element != null) {
26162      prop("resourceType", name);
26163      composeCommunicationInner(element);
26164    }
26165  }
26166
26167  protected void composeCommunicationInner(Communication element) throws IOException {
26168      composeDomainResourceElements(element);
26169      if (element.hasIdentifier()) {
26170        openArray("identifier");
26171        for (Identifier e : element.getIdentifier()) 
26172          composeIdentifier(null, e);
26173        closeArray();
26174      };
26175      if (element.hasDefinition()) {
26176        openArray("definition");
26177        for (Reference e : element.getDefinition()) 
26178          composeReference(null, e);
26179        closeArray();
26180      };
26181      if (element.hasBasedOn()) {
26182        openArray("basedOn");
26183        for (Reference e : element.getBasedOn()) 
26184          composeReference(null, e);
26185        closeArray();
26186      };
26187      if (element.hasPartOf()) {
26188        openArray("partOf");
26189        for (Reference e : element.getPartOf()) 
26190          composeReference(null, e);
26191        closeArray();
26192      };
26193      if (element.hasStatusElement()) {
26194        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26195        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
26196      }
26197      if (element.hasNotDoneElement()) {
26198        composeBooleanCore("notDone", element.getNotDoneElement(), false);
26199        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
26200      }
26201      if (element.hasNotDoneReason()) {
26202        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
26203      }
26204      if (element.hasCategory()) {
26205        openArray("category");
26206        for (CodeableConcept e : element.getCategory()) 
26207          composeCodeableConcept(null, e);
26208        closeArray();
26209      };
26210      if (element.hasMedium()) {
26211        openArray("medium");
26212        for (CodeableConcept e : element.getMedium()) 
26213          composeCodeableConcept(null, e);
26214        closeArray();
26215      };
26216      if (element.hasSubject()) {
26217        composeReference("subject", element.getSubject());
26218      }
26219      if (element.hasRecipient()) {
26220        openArray("recipient");
26221        for (Reference e : element.getRecipient()) 
26222          composeReference(null, e);
26223        closeArray();
26224      };
26225      if (element.hasTopic()) {
26226        openArray("topic");
26227        for (Reference e : element.getTopic()) 
26228          composeReference(null, e);
26229        closeArray();
26230      };
26231      if (element.hasContext()) {
26232        composeReference("context", element.getContext());
26233      }
26234      if (element.hasSentElement()) {
26235        composeDateTimeCore("sent", element.getSentElement(), false);
26236        composeDateTimeExtras("sent", element.getSentElement(), false);
26237      }
26238      if (element.hasReceivedElement()) {
26239        composeDateTimeCore("received", element.getReceivedElement(), false);
26240        composeDateTimeExtras("received", element.getReceivedElement(), false);
26241      }
26242      if (element.hasSender()) {
26243        composeReference("sender", element.getSender());
26244      }
26245      if (element.hasReasonCode()) {
26246        openArray("reasonCode");
26247        for (CodeableConcept e : element.getReasonCode()) 
26248          composeCodeableConcept(null, e);
26249        closeArray();
26250      };
26251      if (element.hasReasonReference()) {
26252        openArray("reasonReference");
26253        for (Reference e : element.getReasonReference()) 
26254          composeReference(null, e);
26255        closeArray();
26256      };
26257      if (element.hasPayload()) {
26258        openArray("payload");
26259        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
26260          composeCommunicationCommunicationPayloadComponent(null, e);
26261        closeArray();
26262      };
26263      if (element.hasNote()) {
26264        openArray("note");
26265        for (Annotation e : element.getNote()) 
26266          composeAnnotation(null, e);
26267        closeArray();
26268      };
26269  }
26270
26271  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
26272    if (element != null) {
26273      open(name);
26274      composeCommunicationCommunicationPayloadComponentInner(element);
26275      close();
26276    }
26277  }
26278
26279  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
26280      composeBackbone(element);
26281      if (element.hasContent()) {
26282        composeType("content", element.getContent());
26283      }
26284  }
26285
26286  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
26287    if (element != null) {
26288      prop("resourceType", name);
26289      composeCommunicationRequestInner(element);
26290    }
26291  }
26292
26293  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
26294      composeDomainResourceElements(element);
26295      if (element.hasIdentifier()) {
26296        openArray("identifier");
26297        for (Identifier e : element.getIdentifier()) 
26298          composeIdentifier(null, e);
26299        closeArray();
26300      };
26301      if (element.hasBasedOn()) {
26302        openArray("basedOn");
26303        for (Reference e : element.getBasedOn()) 
26304          composeReference(null, e);
26305        closeArray();
26306      };
26307      if (element.hasReplaces()) {
26308        openArray("replaces");
26309        for (Reference e : element.getReplaces()) 
26310          composeReference(null, e);
26311        closeArray();
26312      };
26313      if (element.hasGroupIdentifier()) {
26314        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
26315      }
26316      if (element.hasStatusElement()) {
26317        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26318        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
26319      }
26320      if (element.hasCategory()) {
26321        openArray("category");
26322        for (CodeableConcept e : element.getCategory()) 
26323          composeCodeableConcept(null, e);
26324        closeArray();
26325      };
26326      if (element.hasPriorityElement()) {
26327        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26328        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
26329      }
26330      if (element.hasMedium()) {
26331        openArray("medium");
26332        for (CodeableConcept e : element.getMedium()) 
26333          composeCodeableConcept(null, e);
26334        closeArray();
26335      };
26336      if (element.hasSubject()) {
26337        composeReference("subject", element.getSubject());
26338      }
26339      if (element.hasRecipient()) {
26340        openArray("recipient");
26341        for (Reference e : element.getRecipient()) 
26342          composeReference(null, e);
26343        closeArray();
26344      };
26345      if (element.hasTopic()) {
26346        openArray("topic");
26347        for (Reference e : element.getTopic()) 
26348          composeReference(null, e);
26349        closeArray();
26350      };
26351      if (element.hasContext()) {
26352        composeReference("context", element.getContext());
26353      }
26354      if (element.hasPayload()) {
26355        openArray("payload");
26356        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
26357          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
26358        closeArray();
26359      };
26360      if (element.hasOccurrence()) {
26361        composeType("occurrence", element.getOccurrence());
26362      }
26363      if (element.hasAuthoredOnElement()) {
26364        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
26365        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
26366      }
26367      if (element.hasSender()) {
26368        composeReference("sender", element.getSender());
26369      }
26370      if (element.hasRequester()) {
26371        composeCommunicationRequestCommunicationRequestRequesterComponent("requester", element.getRequester());
26372      }
26373      if (element.hasReasonCode()) {
26374        openArray("reasonCode");
26375        for (CodeableConcept e : element.getReasonCode()) 
26376          composeCodeableConcept(null, e);
26377        closeArray();
26378      };
26379      if (element.hasReasonReference()) {
26380        openArray("reasonReference");
26381        for (Reference e : element.getReasonReference()) 
26382          composeReference(null, e);
26383        closeArray();
26384      };
26385      if (element.hasNote()) {
26386        openArray("note");
26387        for (Annotation e : element.getNote()) 
26388          composeAnnotation(null, e);
26389        closeArray();
26390      };
26391  }
26392
26393  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26394    if (element != null) {
26395      open(name);
26396      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
26397      close();
26398    }
26399  }
26400
26401  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
26402      composeBackbone(element);
26403      if (element.hasContent()) {
26404        composeType("content", element.getContent());
26405      }
26406  }
26407
26408  protected void composeCommunicationRequestCommunicationRequestRequesterComponent(String name, CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26409    if (element != null) {
26410      open(name);
26411      composeCommunicationRequestCommunicationRequestRequesterComponentInner(element);
26412      close();
26413    }
26414  }
26415
26416  protected void composeCommunicationRequestCommunicationRequestRequesterComponentInner(CommunicationRequest.CommunicationRequestRequesterComponent element) throws IOException {
26417      composeBackbone(element);
26418      if (element.hasAgent()) {
26419        composeReference("agent", element.getAgent());
26420      }
26421      if (element.hasOnBehalfOf()) {
26422        composeReference("onBehalfOf", element.getOnBehalfOf());
26423      }
26424  }
26425
26426  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
26427    if (element != null) {
26428      prop("resourceType", name);
26429      composeCompartmentDefinitionInner(element);
26430    }
26431  }
26432
26433  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
26434      composeDomainResourceElements(element);
26435      if (element.hasUrlElement()) {
26436        composeUriCore("url", element.getUrlElement(), false);
26437        composeUriExtras("url", element.getUrlElement(), false);
26438      }
26439      if (element.hasNameElement()) {
26440        composeStringCore("name", element.getNameElement(), false);
26441        composeStringExtras("name", element.getNameElement(), false);
26442      }
26443      if (element.hasTitleElement()) {
26444        composeStringCore("title", element.getTitleElement(), false);
26445        composeStringExtras("title", element.getTitleElement(), false);
26446      }
26447      if (element.hasStatusElement()) {
26448        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26449        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26450      }
26451      if (element.hasExperimentalElement()) {
26452        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26453        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26454      }
26455      if (element.hasDateElement()) {
26456        composeDateTimeCore("date", element.getDateElement(), false);
26457        composeDateTimeExtras("date", element.getDateElement(), false);
26458      }
26459      if (element.hasPublisherElement()) {
26460        composeStringCore("publisher", element.getPublisherElement(), false);
26461        composeStringExtras("publisher", element.getPublisherElement(), false);
26462      }
26463      if (element.hasContact()) {
26464        openArray("contact");
26465        for (ContactDetail e : element.getContact()) 
26466          composeContactDetail(null, e);
26467        closeArray();
26468      };
26469      if (element.hasDescriptionElement()) {
26470        composeMarkdownCore("description", element.getDescriptionElement(), false);
26471        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26472      }
26473      if (element.hasPurposeElement()) {
26474        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26475        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26476      }
26477      if (element.hasUseContext()) {
26478        openArray("useContext");
26479        for (UsageContext e : element.getUseContext()) 
26480          composeUsageContext(null, e);
26481        closeArray();
26482      };
26483      if (element.hasJurisdiction()) {
26484        openArray("jurisdiction");
26485        for (CodeableConcept e : element.getJurisdiction()) 
26486          composeCodeableConcept(null, e);
26487        closeArray();
26488      };
26489      if (element.hasCodeElement()) {
26490        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26491        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
26492      }
26493      if (element.hasSearchElement()) {
26494        composeBooleanCore("search", element.getSearchElement(), false);
26495        composeBooleanExtras("search", element.getSearchElement(), false);
26496      }
26497      if (element.hasResource()) {
26498        openArray("resource");
26499        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
26500          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
26501        closeArray();
26502      };
26503  }
26504
26505  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26506    if (element != null) {
26507      open(name);
26508      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
26509      close();
26510    }
26511  }
26512
26513  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
26514      composeBackbone(element);
26515      if (element.hasCodeElement()) {
26516        composeCodeCore("code", element.getCodeElement(), false);
26517        composeCodeExtras("code", element.getCodeElement(), false);
26518      }
26519      if (element.hasParam()) {
26520        openArray("param");
26521        for (StringType e : element.getParam()) 
26522          composeStringCore(null, e, true);
26523        closeArray();
26524        if (anyHasExtras(element.getParam())) {
26525          openArray("_param");
26526          for (StringType e : element.getParam()) 
26527            composeStringExtras(null, e, true);
26528          closeArray();
26529        }
26530      };
26531      if (element.hasDocumentationElement()) {
26532        composeStringCore("documentation", element.getDocumentationElement(), false);
26533        composeStringExtras("documentation", element.getDocumentationElement(), false);
26534      }
26535  }
26536
26537  protected void composeComposition(String name, Composition element) throws IOException {
26538    if (element != null) {
26539      prop("resourceType", name);
26540      composeCompositionInner(element);
26541    }
26542  }
26543
26544  protected void composeCompositionInner(Composition element) throws IOException {
26545      composeDomainResourceElements(element);
26546      if (element.hasIdentifier()) {
26547        composeIdentifier("identifier", element.getIdentifier());
26548      }
26549      if (element.hasStatusElement()) {
26550        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26551        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
26552      }
26553      if (element.hasType()) {
26554        composeCodeableConcept("type", element.getType());
26555      }
26556      if (element.hasClass_()) {
26557        composeCodeableConcept("class", element.getClass_());
26558      }
26559      if (element.hasSubject()) {
26560        composeReference("subject", element.getSubject());
26561      }
26562      if (element.hasEncounter()) {
26563        composeReference("encounter", element.getEncounter());
26564      }
26565      if (element.hasDateElement()) {
26566        composeDateTimeCore("date", element.getDateElement(), false);
26567        composeDateTimeExtras("date", element.getDateElement(), false);
26568      }
26569      if (element.hasAuthor()) {
26570        openArray("author");
26571        for (Reference e : element.getAuthor()) 
26572          composeReference(null, e);
26573        closeArray();
26574      };
26575      if (element.hasTitleElement()) {
26576        composeStringCore("title", element.getTitleElement(), false);
26577        composeStringExtras("title", element.getTitleElement(), false);
26578      }
26579      if (element.hasConfidentialityElement()) {
26580        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26581        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
26582      }
26583      if (element.hasAttester()) {
26584        openArray("attester");
26585        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
26586          composeCompositionCompositionAttesterComponent(null, e);
26587        closeArray();
26588      };
26589      if (element.hasCustodian()) {
26590        composeReference("custodian", element.getCustodian());
26591      }
26592      if (element.hasRelatesTo()) {
26593        openArray("relatesTo");
26594        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
26595          composeCompositionCompositionRelatesToComponent(null, e);
26596        closeArray();
26597      };
26598      if (element.hasEvent()) {
26599        openArray("event");
26600        for (Composition.CompositionEventComponent e : element.getEvent()) 
26601          composeCompositionCompositionEventComponent(null, e);
26602        closeArray();
26603      };
26604      if (element.hasSection()) {
26605        openArray("section");
26606        for (Composition.SectionComponent e : element.getSection()) 
26607          composeCompositionSectionComponent(null, e);
26608        closeArray();
26609      };
26610  }
26611
26612  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
26613    if (element != null) {
26614      open(name);
26615      composeCompositionCompositionAttesterComponentInner(element);
26616      close();
26617    }
26618  }
26619
26620  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
26621      composeBackbone(element);
26622      if (element.hasMode()) {
26623        openArray("mode");
26624        for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26625          composeEnumerationCore(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26626        closeArray();
26627        if (anyHasExtras(element.getMode())) {
26628          openArray("_mode");
26629          for (Enumeration<Composition.CompositionAttestationMode> e : element.getMode()) 
26630            composeEnumerationExtras(null, e, new Composition.CompositionAttestationModeEnumFactory(), true);
26631          closeArray();
26632        }
26633      };
26634      if (element.hasTimeElement()) {
26635        composeDateTimeCore("time", element.getTimeElement(), false);
26636        composeDateTimeExtras("time", element.getTimeElement(), false);
26637      }
26638      if (element.hasParty()) {
26639        composeReference("party", element.getParty());
26640      }
26641  }
26642
26643  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
26644    if (element != null) {
26645      open(name);
26646      composeCompositionCompositionRelatesToComponentInner(element);
26647      close();
26648    }
26649  }
26650
26651  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
26652      composeBackbone(element);
26653      if (element.hasCodeElement()) {
26654        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26655        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
26656      }
26657      if (element.hasTarget()) {
26658        composeType("target", element.getTarget());
26659      }
26660  }
26661
26662  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
26663    if (element != null) {
26664      open(name);
26665      composeCompositionCompositionEventComponentInner(element);
26666      close();
26667    }
26668  }
26669
26670  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
26671      composeBackbone(element);
26672      if (element.hasCode()) {
26673        openArray("code");
26674        for (CodeableConcept e : element.getCode()) 
26675          composeCodeableConcept(null, e);
26676        closeArray();
26677      };
26678      if (element.hasPeriod()) {
26679        composePeriod("period", element.getPeriod());
26680      }
26681      if (element.hasDetail()) {
26682        openArray("detail");
26683        for (Reference e : element.getDetail()) 
26684          composeReference(null, e);
26685        closeArray();
26686      };
26687  }
26688
26689  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
26690    if (element != null) {
26691      open(name);
26692      composeCompositionSectionComponentInner(element);
26693      close();
26694    }
26695  }
26696
26697  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
26698      composeBackbone(element);
26699      if (element.hasTitleElement()) {
26700        composeStringCore("title", element.getTitleElement(), false);
26701        composeStringExtras("title", element.getTitleElement(), false);
26702      }
26703      if (element.hasCode()) {
26704        composeCodeableConcept("code", element.getCode());
26705      }
26706      if (element.hasText()) {
26707        composeNarrative("text", element.getText());
26708      }
26709      if (element.hasModeElement()) {
26710        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
26711        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
26712      }
26713      if (element.hasOrderedBy()) {
26714        composeCodeableConcept("orderedBy", element.getOrderedBy());
26715      }
26716      if (element.hasEntry()) {
26717        openArray("entry");
26718        for (Reference e : element.getEntry()) 
26719          composeReference(null, e);
26720        closeArray();
26721      };
26722      if (element.hasEmptyReason()) {
26723        composeCodeableConcept("emptyReason", element.getEmptyReason());
26724      }
26725      if (element.hasSection()) {
26726        openArray("section");
26727        for (Composition.SectionComponent e : element.getSection()) 
26728          composeCompositionSectionComponent(null, e);
26729        closeArray();
26730      };
26731  }
26732
26733  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
26734    if (element != null) {
26735      prop("resourceType", name);
26736      composeConceptMapInner(element);
26737    }
26738  }
26739
26740  protected void composeConceptMapInner(ConceptMap element) throws IOException {
26741      composeDomainResourceElements(element);
26742      if (element.hasUrlElement()) {
26743        composeUriCore("url", element.getUrlElement(), false);
26744        composeUriExtras("url", element.getUrlElement(), false);
26745      }
26746      if (element.hasIdentifier()) {
26747        composeIdentifier("identifier", element.getIdentifier());
26748      }
26749      if (element.hasVersionElement()) {
26750        composeStringCore("version", element.getVersionElement(), false);
26751        composeStringExtras("version", element.getVersionElement(), false);
26752      }
26753      if (element.hasNameElement()) {
26754        composeStringCore("name", element.getNameElement(), false);
26755        composeStringExtras("name", element.getNameElement(), false);
26756      }
26757      if (element.hasTitleElement()) {
26758        composeStringCore("title", element.getTitleElement(), false);
26759        composeStringExtras("title", element.getTitleElement(), false);
26760      }
26761      if (element.hasStatusElement()) {
26762        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26763        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
26764      }
26765      if (element.hasExperimentalElement()) {
26766        composeBooleanCore("experimental", element.getExperimentalElement(), false);
26767        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
26768      }
26769      if (element.hasDateElement()) {
26770        composeDateTimeCore("date", element.getDateElement(), false);
26771        composeDateTimeExtras("date", element.getDateElement(), false);
26772      }
26773      if (element.hasPublisherElement()) {
26774        composeStringCore("publisher", element.getPublisherElement(), false);
26775        composeStringExtras("publisher", element.getPublisherElement(), false);
26776      }
26777      if (element.hasContact()) {
26778        openArray("contact");
26779        for (ContactDetail e : element.getContact()) 
26780          composeContactDetail(null, e);
26781        closeArray();
26782      };
26783      if (element.hasDescriptionElement()) {
26784        composeMarkdownCore("description", element.getDescriptionElement(), false);
26785        composeMarkdownExtras("description", element.getDescriptionElement(), false);
26786      }
26787      if (element.hasUseContext()) {
26788        openArray("useContext");
26789        for (UsageContext e : element.getUseContext()) 
26790          composeUsageContext(null, e);
26791        closeArray();
26792      };
26793      if (element.hasJurisdiction()) {
26794        openArray("jurisdiction");
26795        for (CodeableConcept e : element.getJurisdiction()) 
26796          composeCodeableConcept(null, e);
26797        closeArray();
26798      };
26799      if (element.hasPurposeElement()) {
26800        composeMarkdownCore("purpose", element.getPurposeElement(), false);
26801        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
26802      }
26803      if (element.hasCopyrightElement()) {
26804        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
26805        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
26806      }
26807      if (element.hasSource()) {
26808        composeType("source", element.getSource());
26809      }
26810      if (element.hasTarget()) {
26811        composeType("target", element.getTarget());
26812      }
26813      if (element.hasGroup()) {
26814        openArray("group");
26815        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
26816          composeConceptMapConceptMapGroupComponent(null, e);
26817        closeArray();
26818      };
26819  }
26820
26821  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
26822    if (element != null) {
26823      open(name);
26824      composeConceptMapConceptMapGroupComponentInner(element);
26825      close();
26826    }
26827  }
26828
26829  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
26830      composeBackbone(element);
26831      if (element.hasSourceElement()) {
26832        composeUriCore("source", element.getSourceElement(), false);
26833        composeUriExtras("source", element.getSourceElement(), false);
26834      }
26835      if (element.hasSourceVersionElement()) {
26836        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
26837        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
26838      }
26839      if (element.hasTargetElement()) {
26840        composeUriCore("target", element.getTargetElement(), false);
26841        composeUriExtras("target", element.getTargetElement(), false);
26842      }
26843      if (element.hasTargetVersionElement()) {
26844        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
26845        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
26846      }
26847      if (element.hasElement()) {
26848        openArray("element");
26849        for (ConceptMap.SourceElementComponent e : element.getElement()) 
26850          composeConceptMapSourceElementComponent(null, e);
26851        closeArray();
26852      };
26853      if (element.hasUnmapped()) {
26854        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
26855      }
26856  }
26857
26858  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
26859    if (element != null) {
26860      open(name);
26861      composeConceptMapSourceElementComponentInner(element);
26862      close();
26863    }
26864  }
26865
26866  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
26867      composeBackbone(element);
26868      if (element.hasCodeElement()) {
26869        composeCodeCore("code", element.getCodeElement(), false);
26870        composeCodeExtras("code", element.getCodeElement(), false);
26871      }
26872      if (element.hasDisplayElement()) {
26873        composeStringCore("display", element.getDisplayElement(), false);
26874        composeStringExtras("display", element.getDisplayElement(), false);
26875      }
26876      if (element.hasTarget()) {
26877        openArray("target");
26878        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
26879          composeConceptMapTargetElementComponent(null, e);
26880        closeArray();
26881      };
26882  }
26883
26884  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
26885    if (element != null) {
26886      open(name);
26887      composeConceptMapTargetElementComponentInner(element);
26888      close();
26889    }
26890  }
26891
26892  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
26893      composeBackbone(element);
26894      if (element.hasCodeElement()) {
26895        composeCodeCore("code", element.getCodeElement(), false);
26896        composeCodeExtras("code", element.getCodeElement(), false);
26897      }
26898      if (element.hasDisplayElement()) {
26899        composeStringCore("display", element.getDisplayElement(), false);
26900        composeStringExtras("display", element.getDisplayElement(), false);
26901      }
26902      if (element.hasEquivalenceElement()) {
26903        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
26904        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
26905      }
26906      if (element.hasCommentElement()) {
26907        composeStringCore("comment", element.getCommentElement(), false);
26908        composeStringExtras("comment", element.getCommentElement(), false);
26909      }
26910      if (element.hasDependsOn()) {
26911        openArray("dependsOn");
26912        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
26913          composeConceptMapOtherElementComponent(null, e);
26914        closeArray();
26915      };
26916      if (element.hasProduct()) {
26917        openArray("product");
26918        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
26919          composeConceptMapOtherElementComponent(null, e);
26920        closeArray();
26921      };
26922  }
26923
26924  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
26925    if (element != null) {
26926      open(name);
26927      composeConceptMapOtherElementComponentInner(element);
26928      close();
26929    }
26930  }
26931
26932  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
26933      composeBackbone(element);
26934      if (element.hasPropertyElement()) {
26935        composeUriCore("property", element.getPropertyElement(), false);
26936        composeUriExtras("property", element.getPropertyElement(), false);
26937      }
26938      if (element.hasSystemElement()) {
26939        composeUriCore("system", element.getSystemElement(), false);
26940        composeUriExtras("system", element.getSystemElement(), false);
26941      }
26942      if (element.hasCodeElement()) {
26943        composeStringCore("code", element.getCodeElement(), false);
26944        composeStringExtras("code", element.getCodeElement(), false);
26945      }
26946      if (element.hasDisplayElement()) {
26947        composeStringCore("display", element.getDisplayElement(), false);
26948        composeStringExtras("display", element.getDisplayElement(), false);
26949      }
26950  }
26951
26952  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
26953    if (element != null) {
26954      open(name);
26955      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
26956      close();
26957    }
26958  }
26959
26960  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
26961      composeBackbone(element);
26962      if (element.hasModeElement()) {
26963        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
26964        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
26965      }
26966      if (element.hasCodeElement()) {
26967        composeCodeCore("code", element.getCodeElement(), false);
26968        composeCodeExtras("code", element.getCodeElement(), false);
26969      }
26970      if (element.hasDisplayElement()) {
26971        composeStringCore("display", element.getDisplayElement(), false);
26972        composeStringExtras("display", element.getDisplayElement(), false);
26973      }
26974      if (element.hasUrlElement()) {
26975        composeUriCore("url", element.getUrlElement(), false);
26976        composeUriExtras("url", element.getUrlElement(), false);
26977      }
26978  }
26979
26980  protected void composeCondition(String name, Condition element) throws IOException {
26981    if (element != null) {
26982      prop("resourceType", name);
26983      composeConditionInner(element);
26984    }
26985  }
26986
26987  protected void composeConditionInner(Condition element) throws IOException {
26988      composeDomainResourceElements(element);
26989      if (element.hasIdentifier()) {
26990        openArray("identifier");
26991        for (Identifier e : element.getIdentifier()) 
26992          composeIdentifier(null, e);
26993        closeArray();
26994      };
26995      if (element.hasClinicalStatusElement()) {
26996        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
26997        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new Condition.ConditionClinicalStatusEnumFactory(), false);
26998      }
26999      if (element.hasVerificationStatusElement()) {
27000        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
27001        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new Condition.ConditionVerificationStatusEnumFactory(), false);
27002      }
27003      if (element.hasCategory()) {
27004        openArray("category");
27005        for (CodeableConcept e : element.getCategory()) 
27006          composeCodeableConcept(null, e);
27007        closeArray();
27008      };
27009      if (element.hasSeverity()) {
27010        composeCodeableConcept("severity", element.getSeverity());
27011      }
27012      if (element.hasCode()) {
27013        composeCodeableConcept("code", element.getCode());
27014      }
27015      if (element.hasBodySite()) {
27016        openArray("bodySite");
27017        for (CodeableConcept e : element.getBodySite()) 
27018          composeCodeableConcept(null, e);
27019        closeArray();
27020      };
27021      if (element.hasSubject()) {
27022        composeReference("subject", element.getSubject());
27023      }
27024      if (element.hasContext()) {
27025        composeReference("context", element.getContext());
27026      }
27027      if (element.hasOnset()) {
27028        composeType("onset", element.getOnset());
27029      }
27030      if (element.hasAbatement()) {
27031        composeType("abatement", element.getAbatement());
27032      }
27033      if (element.hasAssertedDateElement()) {
27034        composeDateTimeCore("assertedDate", element.getAssertedDateElement(), false);
27035        composeDateTimeExtras("assertedDate", element.getAssertedDateElement(), false);
27036      }
27037      if (element.hasAsserter()) {
27038        composeReference("asserter", element.getAsserter());
27039      }
27040      if (element.hasStage()) {
27041        composeConditionConditionStageComponent("stage", element.getStage());
27042      }
27043      if (element.hasEvidence()) {
27044        openArray("evidence");
27045        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
27046          composeConditionConditionEvidenceComponent(null, e);
27047        closeArray();
27048      };
27049      if (element.hasNote()) {
27050        openArray("note");
27051        for (Annotation e : element.getNote()) 
27052          composeAnnotation(null, e);
27053        closeArray();
27054      };
27055  }
27056
27057  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
27058    if (element != null) {
27059      open(name);
27060      composeConditionConditionStageComponentInner(element);
27061      close();
27062    }
27063  }
27064
27065  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
27066      composeBackbone(element);
27067      if (element.hasSummary()) {
27068        composeCodeableConcept("summary", element.getSummary());
27069      }
27070      if (element.hasAssessment()) {
27071        openArray("assessment");
27072        for (Reference e : element.getAssessment()) 
27073          composeReference(null, e);
27074        closeArray();
27075      };
27076  }
27077
27078  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
27079    if (element != null) {
27080      open(name);
27081      composeConditionConditionEvidenceComponentInner(element);
27082      close();
27083    }
27084  }
27085
27086  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
27087      composeBackbone(element);
27088      if (element.hasCode()) {
27089        openArray("code");
27090        for (CodeableConcept e : element.getCode()) 
27091          composeCodeableConcept(null, e);
27092        closeArray();
27093      };
27094      if (element.hasDetail()) {
27095        openArray("detail");
27096        for (Reference e : element.getDetail()) 
27097          composeReference(null, e);
27098        closeArray();
27099      };
27100  }
27101
27102  protected void composeConsent(String name, Consent element) throws IOException {
27103    if (element != null) {
27104      prop("resourceType", name);
27105      composeConsentInner(element);
27106    }
27107  }
27108
27109  protected void composeConsentInner(Consent element) throws IOException {
27110      composeDomainResourceElements(element);
27111      if (element.hasIdentifier()) {
27112        composeIdentifier("identifier", element.getIdentifier());
27113      }
27114      if (element.hasStatusElement()) {
27115        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27116        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
27117      }
27118      if (element.hasCategory()) {
27119        openArray("category");
27120        for (CodeableConcept e : element.getCategory()) 
27121          composeCodeableConcept(null, e);
27122        closeArray();
27123      };
27124      if (element.hasPatient()) {
27125        composeReference("patient", element.getPatient());
27126      }
27127      if (element.hasPeriod()) {
27128        composePeriod("period", element.getPeriod());
27129      }
27130      if (element.hasDateTimeElement()) {
27131        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
27132        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
27133      }
27134      if (element.hasConsentingParty()) {
27135        openArray("consentingParty");
27136        for (Reference e : element.getConsentingParty()) 
27137          composeReference(null, e);
27138        closeArray();
27139      };
27140      if (element.hasActor()) {
27141        openArray("actor");
27142        for (Consent.ConsentActorComponent e : element.getActor()) 
27143          composeConsentConsentActorComponent(null, e);
27144        closeArray();
27145      };
27146      if (element.hasAction()) {
27147        openArray("action");
27148        for (CodeableConcept e : element.getAction()) 
27149          composeCodeableConcept(null, e);
27150        closeArray();
27151      };
27152      if (element.hasOrganization()) {
27153        openArray("organization");
27154        for (Reference e : element.getOrganization()) 
27155          composeReference(null, e);
27156        closeArray();
27157      };
27158      if (element.hasSource()) {
27159        composeType("source", element.getSource());
27160      }
27161      if (element.hasPolicy()) {
27162        openArray("policy");
27163        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
27164          composeConsentConsentPolicyComponent(null, e);
27165        closeArray();
27166      };
27167      if (element.hasPolicyRuleElement()) {
27168        composeUriCore("policyRule", element.getPolicyRuleElement(), false);
27169        composeUriExtras("policyRule", element.getPolicyRuleElement(), false);
27170      }
27171      if (element.hasSecurityLabel()) {
27172        openArray("securityLabel");
27173        for (Coding e : element.getSecurityLabel()) 
27174          composeCoding(null, e);
27175        closeArray();
27176      };
27177      if (element.hasPurpose()) {
27178        openArray("purpose");
27179        for (Coding e : element.getPurpose()) 
27180          composeCoding(null, e);
27181        closeArray();
27182      };
27183      if (element.hasDataPeriod()) {
27184        composePeriod("dataPeriod", element.getDataPeriod());
27185      }
27186      if (element.hasData()) {
27187        openArray("data");
27188        for (Consent.ConsentDataComponent e : element.getData()) 
27189          composeConsentConsentDataComponent(null, e);
27190        closeArray();
27191      };
27192      if (element.hasExcept()) {
27193        openArray("except");
27194        for (Consent.ExceptComponent e : element.getExcept()) 
27195          composeConsentExceptComponent(null, e);
27196        closeArray();
27197      };
27198  }
27199
27200  protected void composeConsentConsentActorComponent(String name, Consent.ConsentActorComponent element) throws IOException {
27201    if (element != null) {
27202      open(name);
27203      composeConsentConsentActorComponentInner(element);
27204      close();
27205    }
27206  }
27207
27208  protected void composeConsentConsentActorComponentInner(Consent.ConsentActorComponent element) throws IOException {
27209      composeBackbone(element);
27210      if (element.hasRole()) {
27211        composeCodeableConcept("role", element.getRole());
27212      }
27213      if (element.hasReference()) {
27214        composeReference("reference", element.getReference());
27215      }
27216  }
27217
27218  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
27219    if (element != null) {
27220      open(name);
27221      composeConsentConsentPolicyComponentInner(element);
27222      close();
27223    }
27224  }
27225
27226  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
27227      composeBackbone(element);
27228      if (element.hasAuthorityElement()) {
27229        composeUriCore("authority", element.getAuthorityElement(), false);
27230        composeUriExtras("authority", element.getAuthorityElement(), false);
27231      }
27232      if (element.hasUriElement()) {
27233        composeUriCore("uri", element.getUriElement(), false);
27234        composeUriExtras("uri", element.getUriElement(), false);
27235      }
27236  }
27237
27238  protected void composeConsentConsentDataComponent(String name, Consent.ConsentDataComponent element) throws IOException {
27239    if (element != null) {
27240      open(name);
27241      composeConsentConsentDataComponentInner(element);
27242      close();
27243    }
27244  }
27245
27246  protected void composeConsentConsentDataComponentInner(Consent.ConsentDataComponent element) throws IOException {
27247      composeBackbone(element);
27248      if (element.hasMeaningElement()) {
27249        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27250        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27251      }
27252      if (element.hasReference()) {
27253        composeReference("reference", element.getReference());
27254      }
27255  }
27256
27257  protected void composeConsentExceptComponent(String name, Consent.ExceptComponent element) throws IOException {
27258    if (element != null) {
27259      open(name);
27260      composeConsentExceptComponentInner(element);
27261      close();
27262    }
27263  }
27264
27265  protected void composeConsentExceptComponentInner(Consent.ExceptComponent element) throws IOException {
27266      composeBackbone(element);
27267      if (element.hasTypeElement()) {
27268        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27269        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentExceptTypeEnumFactory(), false);
27270      }
27271      if (element.hasPeriod()) {
27272        composePeriod("period", element.getPeriod());
27273      }
27274      if (element.hasActor()) {
27275        openArray("actor");
27276        for (Consent.ExceptActorComponent e : element.getActor()) 
27277          composeConsentExceptActorComponent(null, e);
27278        closeArray();
27279      };
27280      if (element.hasAction()) {
27281        openArray("action");
27282        for (CodeableConcept e : element.getAction()) 
27283          composeCodeableConcept(null, e);
27284        closeArray();
27285      };
27286      if (element.hasSecurityLabel()) {
27287        openArray("securityLabel");
27288        for (Coding e : element.getSecurityLabel()) 
27289          composeCoding(null, e);
27290        closeArray();
27291      };
27292      if (element.hasPurpose()) {
27293        openArray("purpose");
27294        for (Coding e : element.getPurpose()) 
27295          composeCoding(null, e);
27296        closeArray();
27297      };
27298      if (element.hasClass_()) {
27299        openArray("class");
27300        for (Coding e : element.getClass_()) 
27301          composeCoding(null, e);
27302        closeArray();
27303      };
27304      if (element.hasCode()) {
27305        openArray("code");
27306        for (Coding e : element.getCode()) 
27307          composeCoding(null, e);
27308        closeArray();
27309      };
27310      if (element.hasDataPeriod()) {
27311        composePeriod("dataPeriod", element.getDataPeriod());
27312      }
27313      if (element.hasData()) {
27314        openArray("data");
27315        for (Consent.ExceptDataComponent e : element.getData()) 
27316          composeConsentExceptDataComponent(null, e);
27317        closeArray();
27318      };
27319  }
27320
27321  protected void composeConsentExceptActorComponent(String name, Consent.ExceptActorComponent element) throws IOException {
27322    if (element != null) {
27323      open(name);
27324      composeConsentExceptActorComponentInner(element);
27325      close();
27326    }
27327  }
27328
27329  protected void composeConsentExceptActorComponentInner(Consent.ExceptActorComponent element) throws IOException {
27330      composeBackbone(element);
27331      if (element.hasRole()) {
27332        composeCodeableConcept("role", element.getRole());
27333      }
27334      if (element.hasReference()) {
27335        composeReference("reference", element.getReference());
27336      }
27337  }
27338
27339  protected void composeConsentExceptDataComponent(String name, Consent.ExceptDataComponent element) throws IOException {
27340    if (element != null) {
27341      open(name);
27342      composeConsentExceptDataComponentInner(element);
27343      close();
27344    }
27345  }
27346
27347  protected void composeConsentExceptDataComponentInner(Consent.ExceptDataComponent element) throws IOException {
27348      composeBackbone(element);
27349      if (element.hasMeaningElement()) {
27350        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27351        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
27352      }
27353      if (element.hasReference()) {
27354        composeReference("reference", element.getReference());
27355      }
27356  }
27357
27358  protected void composeContract(String name, Contract element) throws IOException {
27359    if (element != null) {
27360      prop("resourceType", name);
27361      composeContractInner(element);
27362    }
27363  }
27364
27365  protected void composeContractInner(Contract element) throws IOException {
27366      composeDomainResourceElements(element);
27367      if (element.hasIdentifier()) {
27368        composeIdentifier("identifier", element.getIdentifier());
27369      }
27370      if (element.hasStatusElement()) {
27371        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27372        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
27373      }
27374      if (element.hasIssuedElement()) {
27375        composeDateTimeCore("issued", element.getIssuedElement(), false);
27376        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27377      }
27378      if (element.hasApplies()) {
27379        composePeriod("applies", element.getApplies());
27380      }
27381      if (element.hasSubject()) {
27382        openArray("subject");
27383        for (Reference e : element.getSubject()) 
27384          composeReference(null, e);
27385        closeArray();
27386      };
27387      if (element.hasTopic()) {
27388        openArray("topic");
27389        for (Reference e : element.getTopic()) 
27390          composeReference(null, e);
27391        closeArray();
27392      };
27393      if (element.hasAuthority()) {
27394        openArray("authority");
27395        for (Reference e : element.getAuthority()) 
27396          composeReference(null, e);
27397        closeArray();
27398      };
27399      if (element.hasDomain()) {
27400        openArray("domain");
27401        for (Reference e : element.getDomain()) 
27402          composeReference(null, e);
27403        closeArray();
27404      };
27405      if (element.hasType()) {
27406        composeCodeableConcept("type", element.getType());
27407      }
27408      if (element.hasSubType()) {
27409        openArray("subType");
27410        for (CodeableConcept e : element.getSubType()) 
27411          composeCodeableConcept(null, e);
27412        closeArray();
27413      };
27414      if (element.hasAction()) {
27415        openArray("action");
27416        for (CodeableConcept e : element.getAction()) 
27417          composeCodeableConcept(null, e);
27418        closeArray();
27419      };
27420      if (element.hasActionReason()) {
27421        openArray("actionReason");
27422        for (CodeableConcept e : element.getActionReason()) 
27423          composeCodeableConcept(null, e);
27424        closeArray();
27425      };
27426      if (element.hasDecisionType()) {
27427        composeCodeableConcept("decisionType", element.getDecisionType());
27428      }
27429      if (element.hasContentDerivative()) {
27430        composeCodeableConcept("contentDerivative", element.getContentDerivative());
27431      }
27432      if (element.hasSecurityLabel()) {
27433        openArray("securityLabel");
27434        for (Coding e : element.getSecurityLabel()) 
27435          composeCoding(null, e);
27436        closeArray();
27437      };
27438      if (element.hasAgent()) {
27439        openArray("agent");
27440        for (Contract.AgentComponent e : element.getAgent()) 
27441          composeContractAgentComponent(null, e);
27442        closeArray();
27443      };
27444      if (element.hasSigner()) {
27445        openArray("signer");
27446        for (Contract.SignatoryComponent e : element.getSigner()) 
27447          composeContractSignatoryComponent(null, e);
27448        closeArray();
27449      };
27450      if (element.hasValuedItem()) {
27451        openArray("valuedItem");
27452        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
27453          composeContractValuedItemComponent(null, e);
27454        closeArray();
27455      };
27456      if (element.hasTerm()) {
27457        openArray("term");
27458        for (Contract.TermComponent e : element.getTerm()) 
27459          composeContractTermComponent(null, e);
27460        closeArray();
27461      };
27462      if (element.hasBinding()) {
27463        composeType("binding", element.getBinding());
27464      }
27465      if (element.hasFriendly()) {
27466        openArray("friendly");
27467        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
27468          composeContractFriendlyLanguageComponent(null, e);
27469        closeArray();
27470      };
27471      if (element.hasLegal()) {
27472        openArray("legal");
27473        for (Contract.LegalLanguageComponent e : element.getLegal()) 
27474          composeContractLegalLanguageComponent(null, e);
27475        closeArray();
27476      };
27477      if (element.hasRule()) {
27478        openArray("rule");
27479        for (Contract.ComputableLanguageComponent e : element.getRule()) 
27480          composeContractComputableLanguageComponent(null, e);
27481        closeArray();
27482      };
27483  }
27484
27485  protected void composeContractAgentComponent(String name, Contract.AgentComponent element) throws IOException {
27486    if (element != null) {
27487      open(name);
27488      composeContractAgentComponentInner(element);
27489      close();
27490    }
27491  }
27492
27493  protected void composeContractAgentComponentInner(Contract.AgentComponent element) throws IOException {
27494      composeBackbone(element);
27495      if (element.hasActor()) {
27496        composeReference("actor", element.getActor());
27497      }
27498      if (element.hasRole()) {
27499        openArray("role");
27500        for (CodeableConcept e : element.getRole()) 
27501          composeCodeableConcept(null, e);
27502        closeArray();
27503      };
27504  }
27505
27506  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
27507    if (element != null) {
27508      open(name);
27509      composeContractSignatoryComponentInner(element);
27510      close();
27511    }
27512  }
27513
27514  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
27515      composeBackbone(element);
27516      if (element.hasType()) {
27517        composeCoding("type", element.getType());
27518      }
27519      if (element.hasParty()) {
27520        composeReference("party", element.getParty());
27521      }
27522      if (element.hasSignature()) {
27523        openArray("signature");
27524        for (Signature e : element.getSignature()) 
27525          composeSignature(null, e);
27526        closeArray();
27527      };
27528  }
27529
27530  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
27531    if (element != null) {
27532      open(name);
27533      composeContractValuedItemComponentInner(element);
27534      close();
27535    }
27536  }
27537
27538  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
27539      composeBackbone(element);
27540      if (element.hasEntity()) {
27541        composeType("entity", element.getEntity());
27542      }
27543      if (element.hasIdentifier()) {
27544        composeIdentifier("identifier", element.getIdentifier());
27545      }
27546      if (element.hasEffectiveTimeElement()) {
27547        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
27548        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
27549      }
27550      if (element.hasQuantity()) {
27551        composeSimpleQuantity("quantity", element.getQuantity());
27552      }
27553      if (element.hasUnitPrice()) {
27554        composeMoney("unitPrice", element.getUnitPrice());
27555      }
27556      if (element.hasFactorElement()) {
27557        composeDecimalCore("factor", element.getFactorElement(), false);
27558        composeDecimalExtras("factor", element.getFactorElement(), false);
27559      }
27560      if (element.hasPointsElement()) {
27561        composeDecimalCore("points", element.getPointsElement(), false);
27562        composeDecimalExtras("points", element.getPointsElement(), false);
27563      }
27564      if (element.hasNet()) {
27565        composeMoney("net", element.getNet());
27566      }
27567  }
27568
27569  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
27570    if (element != null) {
27571      open(name);
27572      composeContractTermComponentInner(element);
27573      close();
27574    }
27575  }
27576
27577  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
27578      composeBackbone(element);
27579      if (element.hasIdentifier()) {
27580        composeIdentifier("identifier", element.getIdentifier());
27581      }
27582      if (element.hasIssuedElement()) {
27583        composeDateTimeCore("issued", element.getIssuedElement(), false);
27584        composeDateTimeExtras("issued", element.getIssuedElement(), false);
27585      }
27586      if (element.hasApplies()) {
27587        composePeriod("applies", element.getApplies());
27588      }
27589      if (element.hasType()) {
27590        composeCodeableConcept("type", element.getType());
27591      }
27592      if (element.hasSubType()) {
27593        composeCodeableConcept("subType", element.getSubType());
27594      }
27595      if (element.hasTopic()) {
27596        openArray("topic");
27597        for (Reference e : element.getTopic()) 
27598          composeReference(null, e);
27599        closeArray();
27600      };
27601      if (element.hasAction()) {
27602        openArray("action");
27603        for (CodeableConcept e : element.getAction()) 
27604          composeCodeableConcept(null, e);
27605        closeArray();
27606      };
27607      if (element.hasActionReason()) {
27608        openArray("actionReason");
27609        for (CodeableConcept e : element.getActionReason()) 
27610          composeCodeableConcept(null, e);
27611        closeArray();
27612      };
27613      if (element.hasSecurityLabel()) {
27614        openArray("securityLabel");
27615        for (Coding e : element.getSecurityLabel()) 
27616          composeCoding(null, e);
27617        closeArray();
27618      };
27619      if (element.hasAgent()) {
27620        openArray("agent");
27621        for (Contract.TermAgentComponent e : element.getAgent()) 
27622          composeContractTermAgentComponent(null, e);
27623        closeArray();
27624      };
27625      if (element.hasTextElement()) {
27626        composeStringCore("text", element.getTextElement(), false);
27627        composeStringExtras("text", element.getTextElement(), false);
27628      }
27629      if (element.hasValuedItem()) {
27630        openArray("valuedItem");
27631        for (Contract.TermValuedItemComponent e : element.getValuedItem()) 
27632          composeContractTermValuedItemComponent(null, e);
27633        closeArray();
27634      };
27635      if (element.hasGroup()) {
27636        openArray("group");
27637        for (Contract.TermComponent e : element.getGroup()) 
27638          composeContractTermComponent(null, e);
27639        closeArray();
27640      };
27641  }
27642
27643  protected void composeContractTermAgentComponent(String name, Contract.TermAgentComponent element) throws IOException {
27644    if (element != null) {
27645      open(name);
27646      composeContractTermAgentComponentInner(element);
27647      close();
27648    }
27649  }
27650
27651  protected void composeContractTermAgentComponentInner(Contract.TermAgentComponent element) throws IOException {
27652      composeBackbone(element);
27653      if (element.hasActor()) {
27654        composeReference("actor", element.getActor());
27655      }
27656      if (element.hasRole()) {
27657        openArray("role");
27658        for (CodeableConcept e : element.getRole()) 
27659          composeCodeableConcept(null, e);
27660        closeArray();
27661      };
27662  }
27663
27664  protected void composeContractTermValuedItemComponent(String name, Contract.TermValuedItemComponent element) throws IOException {
27665    if (element != null) {
27666      open(name);
27667      composeContractTermValuedItemComponentInner(element);
27668      close();
27669    }
27670  }
27671
27672  protected void composeContractTermValuedItemComponentInner(Contract.TermValuedItemComponent element) throws IOException {
27673      composeBackbone(element);
27674      if (element.hasEntity()) {
27675        composeType("entity", element.getEntity());
27676      }
27677      if (element.hasIdentifier()) {
27678        composeIdentifier("identifier", element.getIdentifier());
27679      }
27680      if (element.hasEffectiveTimeElement()) {
27681        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
27682        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
27683      }
27684      if (element.hasQuantity()) {
27685        composeSimpleQuantity("quantity", element.getQuantity());
27686      }
27687      if (element.hasUnitPrice()) {
27688        composeMoney("unitPrice", element.getUnitPrice());
27689      }
27690      if (element.hasFactorElement()) {
27691        composeDecimalCore("factor", element.getFactorElement(), false);
27692        composeDecimalExtras("factor", element.getFactorElement(), false);
27693      }
27694      if (element.hasPointsElement()) {
27695        composeDecimalCore("points", element.getPointsElement(), false);
27696        composeDecimalExtras("points", element.getPointsElement(), false);
27697      }
27698      if (element.hasNet()) {
27699        composeMoney("net", element.getNet());
27700      }
27701  }
27702
27703  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
27704    if (element != null) {
27705      open(name);
27706      composeContractFriendlyLanguageComponentInner(element);
27707      close();
27708    }
27709  }
27710
27711  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
27712      composeBackbone(element);
27713      if (element.hasContent()) {
27714        composeType("content", element.getContent());
27715      }
27716  }
27717
27718  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
27719    if (element != null) {
27720      open(name);
27721      composeContractLegalLanguageComponentInner(element);
27722      close();
27723    }
27724  }
27725
27726  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
27727      composeBackbone(element);
27728      if (element.hasContent()) {
27729        composeType("content", element.getContent());
27730      }
27731  }
27732
27733  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
27734    if (element != null) {
27735      open(name);
27736      composeContractComputableLanguageComponentInner(element);
27737      close();
27738    }
27739  }
27740
27741  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
27742      composeBackbone(element);
27743      if (element.hasContent()) {
27744        composeType("content", element.getContent());
27745      }
27746  }
27747
27748  protected void composeCoverage(String name, Coverage element) throws IOException {
27749    if (element != null) {
27750      prop("resourceType", name);
27751      composeCoverageInner(element);
27752    }
27753  }
27754
27755  protected void composeCoverageInner(Coverage element) throws IOException {
27756      composeDomainResourceElements(element);
27757      if (element.hasIdentifier()) {
27758        openArray("identifier");
27759        for (Identifier e : element.getIdentifier()) 
27760          composeIdentifier(null, e);
27761        closeArray();
27762      };
27763      if (element.hasStatusElement()) {
27764        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
27765        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
27766      }
27767      if (element.hasType()) {
27768        composeCodeableConcept("type", element.getType());
27769      }
27770      if (element.hasPolicyHolder()) {
27771        composeReference("policyHolder", element.getPolicyHolder());
27772      }
27773      if (element.hasSubscriber()) {
27774        composeReference("subscriber", element.getSubscriber());
27775      }
27776      if (element.hasSubscriberIdElement()) {
27777        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
27778        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
27779      }
27780      if (element.hasBeneficiary()) {
27781        composeReference("beneficiary", element.getBeneficiary());
27782      }
27783      if (element.hasRelationship()) {
27784        composeCodeableConcept("relationship", element.getRelationship());
27785      }
27786      if (element.hasPeriod()) {
27787        composePeriod("period", element.getPeriod());
27788      }
27789      if (element.hasPayor()) {
27790        openArray("payor");
27791        for (Reference e : element.getPayor()) 
27792          composeReference(null, e);
27793        closeArray();
27794      };
27795      if (element.hasGrouping()) {
27796        composeCoverageGroupComponent("grouping", element.getGrouping());
27797      }
27798      if (element.hasDependentElement()) {
27799        composeStringCore("dependent", element.getDependentElement(), false);
27800        composeStringExtras("dependent", element.getDependentElement(), false);
27801      }
27802      if (element.hasSequenceElement()) {
27803        composeStringCore("sequence", element.getSequenceElement(), false);
27804        composeStringExtras("sequence", element.getSequenceElement(), false);
27805      }
27806      if (element.hasOrderElement()) {
27807        composePositiveIntCore("order", element.getOrderElement(), false);
27808        composePositiveIntExtras("order", element.getOrderElement(), false);
27809      }
27810      if (element.hasNetworkElement()) {
27811        composeStringCore("network", element.getNetworkElement(), false);
27812        composeStringExtras("network", element.getNetworkElement(), false);
27813      }
27814      if (element.hasContract()) {
27815        openArray("contract");
27816        for (Reference e : element.getContract()) 
27817          composeReference(null, e);
27818        closeArray();
27819      };
27820  }
27821
27822  protected void composeCoverageGroupComponent(String name, Coverage.GroupComponent element) throws IOException {
27823    if (element != null) {
27824      open(name);
27825      composeCoverageGroupComponentInner(element);
27826      close();
27827    }
27828  }
27829
27830  protected void composeCoverageGroupComponentInner(Coverage.GroupComponent element) throws IOException {
27831      composeBackbone(element);
27832      if (element.hasGroupElement()) {
27833        composeStringCore("group", element.getGroupElement(), false);
27834        composeStringExtras("group", element.getGroupElement(), false);
27835      }
27836      if (element.hasGroupDisplayElement()) {
27837        composeStringCore("groupDisplay", element.getGroupDisplayElement(), false);
27838        composeStringExtras("groupDisplay", element.getGroupDisplayElement(), false);
27839      }
27840      if (element.hasSubGroupElement()) {
27841        composeStringCore("subGroup", element.getSubGroupElement(), false);
27842        composeStringExtras("subGroup", element.getSubGroupElement(), false);
27843      }
27844      if (element.hasSubGroupDisplayElement()) {
27845        composeStringCore("subGroupDisplay", element.getSubGroupDisplayElement(), false);
27846        composeStringExtras("subGroupDisplay", element.getSubGroupDisplayElement(), false);
27847      }
27848      if (element.hasPlanElement()) {
27849        composeStringCore("plan", element.getPlanElement(), false);
27850        composeStringExtras("plan", element.getPlanElement(), false);
27851      }
27852      if (element.hasPlanDisplayElement()) {
27853        composeStringCore("planDisplay", element.getPlanDisplayElement(), false);
27854        composeStringExtras("planDisplay", element.getPlanDisplayElement(), false);
27855      }
27856      if (element.hasSubPlanElement()) {
27857        composeStringCore("subPlan", element.getSubPlanElement(), false);
27858        composeStringExtras("subPlan", element.getSubPlanElement(), false);
27859      }
27860      if (element.hasSubPlanDisplayElement()) {
27861        composeStringCore("subPlanDisplay", element.getSubPlanDisplayElement(), false);
27862        composeStringExtras("subPlanDisplay", element.getSubPlanDisplayElement(), false);
27863      }
27864      if (element.hasClass_Element()) {
27865        composeStringCore("class", element.getClass_Element(), false);
27866        composeStringExtras("class", element.getClass_Element(), false);
27867      }
27868      if (element.hasClassDisplayElement()) {
27869        composeStringCore("classDisplay", element.getClassDisplayElement(), false);
27870        composeStringExtras("classDisplay", element.getClassDisplayElement(), false);
27871      }
27872      if (element.hasSubClassElement()) {
27873        composeStringCore("subClass", element.getSubClassElement(), false);
27874        composeStringExtras("subClass", element.getSubClassElement(), false);
27875      }
27876      if (element.hasSubClassDisplayElement()) {
27877        composeStringCore("subClassDisplay", element.getSubClassDisplayElement(), false);
27878        composeStringExtras("subClassDisplay", element.getSubClassDisplayElement(), false);
27879      }
27880  }
27881
27882  protected void composeDataElement(String name, DataElement element) throws IOException {
27883    if (element != null) {
27884      prop("resourceType", name);
27885      composeDataElementInner(element);
27886    }
27887  }
27888
27889  protected void composeDataElementInner(DataElement element) throws IOException {
27890      composeDomainResourceElements(element);
27891      if (element.hasUrlElement()) {
27892        composeUriCore("url", element.getUrlElement(), false);
27893        composeUriExtras("url", element.getUrlElement(), false);
27894      }
27895      if (element.hasIdentifier()) {
27896        openArray("identifier");
27897        for (Identifier e : element.getIdentifier()) 
27898          composeIdentifier(null, e);
27899        closeArray();
27900      };
27901      if (element.hasVersionElement()) {
27902        composeStringCore("version", element.getVersionElement(), false);
27903        composeStringExtras("version", element.getVersionElement(), false);
27904      }
27905      if (element.hasStatusElement()) {
27906        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27907        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
27908      }
27909      if (element.hasExperimentalElement()) {
27910        composeBooleanCore("experimental", element.getExperimentalElement(), false);
27911        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
27912      }
27913      if (element.hasDateElement()) {
27914        composeDateTimeCore("date", element.getDateElement(), false);
27915        composeDateTimeExtras("date", element.getDateElement(), false);
27916      }
27917      if (element.hasPublisherElement()) {
27918        composeStringCore("publisher", element.getPublisherElement(), false);
27919        composeStringExtras("publisher", element.getPublisherElement(), false);
27920      }
27921      if (element.hasNameElement()) {
27922        composeStringCore("name", element.getNameElement(), false);
27923        composeStringExtras("name", element.getNameElement(), false);
27924      }
27925      if (element.hasTitleElement()) {
27926        composeStringCore("title", element.getTitleElement(), false);
27927        composeStringExtras("title", element.getTitleElement(), false);
27928      }
27929      if (element.hasContact()) {
27930        openArray("contact");
27931        for (ContactDetail e : element.getContact()) 
27932          composeContactDetail(null, e);
27933        closeArray();
27934      };
27935      if (element.hasUseContext()) {
27936        openArray("useContext");
27937        for (UsageContext e : element.getUseContext()) 
27938          composeUsageContext(null, e);
27939        closeArray();
27940      };
27941      if (element.hasJurisdiction()) {
27942        openArray("jurisdiction");
27943        for (CodeableConcept e : element.getJurisdiction()) 
27944          composeCodeableConcept(null, e);
27945        closeArray();
27946      };
27947      if (element.hasCopyrightElement()) {
27948        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
27949        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
27950      }
27951      if (element.hasStringencyElement()) {
27952        composeEnumerationCore("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
27953        composeEnumerationExtras("stringency", element.getStringencyElement(), new DataElement.DataElementStringencyEnumFactory(), false);
27954      }
27955      if (element.hasMapping()) {
27956        openArray("mapping");
27957        for (DataElement.DataElementMappingComponent e : element.getMapping()) 
27958          composeDataElementDataElementMappingComponent(null, e);
27959        closeArray();
27960      };
27961      if (element.hasElement()) {
27962        openArray("element");
27963        for (ElementDefinition e : element.getElement()) 
27964          composeElementDefinition(null, e);
27965        closeArray();
27966      };
27967  }
27968
27969  protected void composeDataElementDataElementMappingComponent(String name, DataElement.DataElementMappingComponent element) throws IOException {
27970    if (element != null) {
27971      open(name);
27972      composeDataElementDataElementMappingComponentInner(element);
27973      close();
27974    }
27975  }
27976
27977  protected void composeDataElementDataElementMappingComponentInner(DataElement.DataElementMappingComponent element) throws IOException {
27978      composeBackbone(element);
27979      if (element.hasIdentityElement()) {
27980        composeIdCore("identity", element.getIdentityElement(), false);
27981        composeIdExtras("identity", element.getIdentityElement(), false);
27982      }
27983      if (element.hasUriElement()) {
27984        composeUriCore("uri", element.getUriElement(), false);
27985        composeUriExtras("uri", element.getUriElement(), false);
27986      }
27987      if (element.hasNameElement()) {
27988        composeStringCore("name", element.getNameElement(), false);
27989        composeStringExtras("name", element.getNameElement(), false);
27990      }
27991      if (element.hasCommentElement()) {
27992        composeStringCore("comment", element.getCommentElement(), false);
27993        composeStringExtras("comment", element.getCommentElement(), false);
27994      }
27995  }
27996
27997  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
27998    if (element != null) {
27999      prop("resourceType", name);
28000      composeDetectedIssueInner(element);
28001    }
28002  }
28003
28004  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
28005      composeDomainResourceElements(element);
28006      if (element.hasIdentifier()) {
28007        composeIdentifier("identifier", element.getIdentifier());
28008      }
28009      if (element.hasStatusElement()) {
28010        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
28011        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
28012      }
28013      if (element.hasCategory()) {
28014        composeCodeableConcept("category", element.getCategory());
28015      }
28016      if (element.hasSeverityElement()) {
28017        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28018        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
28019      }
28020      if (element.hasPatient()) {
28021        composeReference("patient", element.getPatient());
28022      }
28023      if (element.hasDateElement()) {
28024        composeDateTimeCore("date", element.getDateElement(), false);
28025        composeDateTimeExtras("date", element.getDateElement(), false);
28026      }
28027      if (element.hasAuthor()) {
28028        composeReference("author", element.getAuthor());
28029      }
28030      if (element.hasImplicated()) {
28031        openArray("implicated");
28032        for (Reference e : element.getImplicated()) 
28033          composeReference(null, e);
28034        closeArray();
28035      };
28036      if (element.hasDetailElement()) {
28037        composeStringCore("detail", element.getDetailElement(), false);
28038        composeStringExtras("detail", element.getDetailElement(), false);
28039      }
28040      if (element.hasReferenceElement()) {
28041        composeUriCore("reference", element.getReferenceElement(), false);
28042        composeUriExtras("reference", element.getReferenceElement(), false);
28043      }
28044      if (element.hasMitigation()) {
28045        openArray("mitigation");
28046        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
28047          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
28048        closeArray();
28049      };
28050  }
28051
28052  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28053    if (element != null) {
28054      open(name);
28055      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
28056      close();
28057    }
28058  }
28059
28060  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
28061      composeBackbone(element);
28062      if (element.hasAction()) {
28063        composeCodeableConcept("action", element.getAction());
28064      }
28065      if (element.hasDateElement()) {
28066        composeDateTimeCore("date", element.getDateElement(), false);
28067        composeDateTimeExtras("date", element.getDateElement(), false);
28068      }
28069      if (element.hasAuthor()) {
28070        composeReference("author", element.getAuthor());
28071      }
28072  }
28073
28074  protected void composeDevice(String name, Device element) throws IOException {
28075    if (element != null) {
28076      prop("resourceType", name);
28077      composeDeviceInner(element);
28078    }
28079  }
28080
28081  protected void composeDeviceInner(Device element) throws IOException {
28082      composeDomainResourceElements(element);
28083      if (element.hasIdentifier()) {
28084        openArray("identifier");
28085        for (Identifier e : element.getIdentifier()) 
28086          composeIdentifier(null, e);
28087        closeArray();
28088      };
28089      if (element.hasUdi()) {
28090        composeDeviceDeviceUdiComponent("udi", element.getUdi());
28091      }
28092      if (element.hasStatusElement()) {
28093        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28094        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
28095      }
28096      if (element.hasType()) {
28097        composeCodeableConcept("type", element.getType());
28098      }
28099      if (element.hasLotNumberElement()) {
28100        composeStringCore("lotNumber", element.getLotNumberElement(), false);
28101        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
28102      }
28103      if (element.hasManufacturerElement()) {
28104        composeStringCore("manufacturer", element.getManufacturerElement(), false);
28105        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
28106      }
28107      if (element.hasManufactureDateElement()) {
28108        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
28109        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
28110      }
28111      if (element.hasExpirationDateElement()) {
28112        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
28113        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
28114      }
28115      if (element.hasModelElement()) {
28116        composeStringCore("model", element.getModelElement(), false);
28117        composeStringExtras("model", element.getModelElement(), false);
28118      }
28119      if (element.hasVersionElement()) {
28120        composeStringCore("version", element.getVersionElement(), false);
28121        composeStringExtras("version", element.getVersionElement(), false);
28122      }
28123      if (element.hasPatient()) {
28124        composeReference("patient", element.getPatient());
28125      }
28126      if (element.hasOwner()) {
28127        composeReference("owner", element.getOwner());
28128      }
28129      if (element.hasContact()) {
28130        openArray("contact");
28131        for (ContactPoint e : element.getContact()) 
28132          composeContactPoint(null, e);
28133        closeArray();
28134      };
28135      if (element.hasLocation()) {
28136        composeReference("location", element.getLocation());
28137      }
28138      if (element.hasUrlElement()) {
28139        composeUriCore("url", element.getUrlElement(), false);
28140        composeUriExtras("url", element.getUrlElement(), false);
28141      }
28142      if (element.hasNote()) {
28143        openArray("note");
28144        for (Annotation e : element.getNote()) 
28145          composeAnnotation(null, e);
28146        closeArray();
28147      };
28148      if (element.hasSafety()) {
28149        openArray("safety");
28150        for (CodeableConcept e : element.getSafety()) 
28151          composeCodeableConcept(null, e);
28152        closeArray();
28153      };
28154  }
28155
28156  protected void composeDeviceDeviceUdiComponent(String name, Device.DeviceUdiComponent element) throws IOException {
28157    if (element != null) {
28158      open(name);
28159      composeDeviceDeviceUdiComponentInner(element);
28160      close();
28161    }
28162  }
28163
28164  protected void composeDeviceDeviceUdiComponentInner(Device.DeviceUdiComponent element) throws IOException {
28165      composeBackbone(element);
28166      if (element.hasDeviceIdentifierElement()) {
28167        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28168        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
28169      }
28170      if (element.hasNameElement()) {
28171        composeStringCore("name", element.getNameElement(), false);
28172        composeStringExtras("name", element.getNameElement(), false);
28173      }
28174      if (element.hasJurisdictionElement()) {
28175        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
28176        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
28177      }
28178      if (element.hasCarrierHRFElement()) {
28179        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
28180        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
28181      }
28182      if (element.hasCarrierAIDCElement()) {
28183        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
28184        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
28185      }
28186      if (element.hasIssuerElement()) {
28187        composeUriCore("issuer", element.getIssuerElement(), false);
28188        composeUriExtras("issuer", element.getIssuerElement(), false);
28189      }
28190      if (element.hasEntryTypeElement()) {
28191        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28192        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
28193      }
28194  }
28195
28196  protected void composeDeviceComponent(String name, DeviceComponent element) throws IOException {
28197    if (element != null) {
28198      prop("resourceType", name);
28199      composeDeviceComponentInner(element);
28200    }
28201  }
28202
28203  protected void composeDeviceComponentInner(DeviceComponent element) throws IOException {
28204      composeDomainResourceElements(element);
28205      if (element.hasIdentifier()) {
28206        composeIdentifier("identifier", element.getIdentifier());
28207      }
28208      if (element.hasType()) {
28209        composeCodeableConcept("type", element.getType());
28210      }
28211      if (element.hasLastSystemChangeElement()) {
28212        composeInstantCore("lastSystemChange", element.getLastSystemChangeElement(), false);
28213        composeInstantExtras("lastSystemChange", element.getLastSystemChangeElement(), false);
28214      }
28215      if (element.hasSource()) {
28216        composeReference("source", element.getSource());
28217      }
28218      if (element.hasParent()) {
28219        composeReference("parent", element.getParent());
28220      }
28221      if (element.hasOperationalStatus()) {
28222        openArray("operationalStatus");
28223        for (CodeableConcept e : element.getOperationalStatus()) 
28224          composeCodeableConcept(null, e);
28225        closeArray();
28226      };
28227      if (element.hasParameterGroup()) {
28228        composeCodeableConcept("parameterGroup", element.getParameterGroup());
28229      }
28230      if (element.hasMeasurementPrincipleElement()) {
28231        composeEnumerationCore("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28232        composeEnumerationExtras("measurementPrinciple", element.getMeasurementPrincipleElement(), new DeviceComponent.MeasmntPrincipleEnumFactory(), false);
28233      }
28234      if (element.hasProductionSpecification()) {
28235        openArray("productionSpecification");
28236        for (DeviceComponent.DeviceComponentProductionSpecificationComponent e : element.getProductionSpecification()) 
28237          composeDeviceComponentDeviceComponentProductionSpecificationComponent(null, e);
28238        closeArray();
28239      };
28240      if (element.hasLanguageCode()) {
28241        composeCodeableConcept("languageCode", element.getLanguageCode());
28242      }
28243  }
28244
28245  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponent(String name, DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28246    if (element != null) {
28247      open(name);
28248      composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(element);
28249      close();
28250    }
28251  }
28252
28253  protected void composeDeviceComponentDeviceComponentProductionSpecificationComponentInner(DeviceComponent.DeviceComponentProductionSpecificationComponent element) throws IOException {
28254      composeBackbone(element);
28255      if (element.hasSpecType()) {
28256        composeCodeableConcept("specType", element.getSpecType());
28257      }
28258      if (element.hasComponentId()) {
28259        composeIdentifier("componentId", element.getComponentId());
28260      }
28261      if (element.hasProductionSpecElement()) {
28262        composeStringCore("productionSpec", element.getProductionSpecElement(), false);
28263        composeStringExtras("productionSpec", element.getProductionSpecElement(), false);
28264      }
28265  }
28266
28267  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
28268    if (element != null) {
28269      prop("resourceType", name);
28270      composeDeviceMetricInner(element);
28271    }
28272  }
28273
28274  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
28275      composeDomainResourceElements(element);
28276      if (element.hasIdentifier()) {
28277        composeIdentifier("identifier", element.getIdentifier());
28278      }
28279      if (element.hasType()) {
28280        composeCodeableConcept("type", element.getType());
28281      }
28282      if (element.hasUnit()) {
28283        composeCodeableConcept("unit", element.getUnit());
28284      }
28285      if (element.hasSource()) {
28286        composeReference("source", element.getSource());
28287      }
28288      if (element.hasParent()) {
28289        composeReference("parent", element.getParent());
28290      }
28291      if (element.hasOperationalStatusElement()) {
28292        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28293        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
28294      }
28295      if (element.hasColorElement()) {
28296        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28297        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
28298      }
28299      if (element.hasCategoryElement()) {
28300        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28301        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
28302      }
28303      if (element.hasMeasurementPeriod()) {
28304        composeTiming("measurementPeriod", element.getMeasurementPeriod());
28305      }
28306      if (element.hasCalibration()) {
28307        openArray("calibration");
28308        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
28309          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
28310        closeArray();
28311      };
28312  }
28313
28314  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28315    if (element != null) {
28316      open(name);
28317      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
28318      close();
28319    }
28320  }
28321
28322  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
28323      composeBackbone(element);
28324      if (element.hasTypeElement()) {
28325        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28326        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
28327      }
28328      if (element.hasStateElement()) {
28329        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28330        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
28331      }
28332      if (element.hasTimeElement()) {
28333        composeInstantCore("time", element.getTimeElement(), false);
28334        composeInstantExtras("time", element.getTimeElement(), false);
28335      }
28336  }
28337
28338  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
28339    if (element != null) {
28340      prop("resourceType", name);
28341      composeDeviceRequestInner(element);
28342    }
28343  }
28344
28345  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
28346      composeDomainResourceElements(element);
28347      if (element.hasIdentifier()) {
28348        openArray("identifier");
28349        for (Identifier e : element.getIdentifier()) 
28350          composeIdentifier(null, e);
28351        closeArray();
28352      };
28353      if (element.hasDefinition()) {
28354        openArray("definition");
28355        for (Reference e : element.getDefinition()) 
28356          composeReference(null, e);
28357        closeArray();
28358      };
28359      if (element.hasBasedOn()) {
28360        openArray("basedOn");
28361        for (Reference e : element.getBasedOn()) 
28362          composeReference(null, e);
28363        closeArray();
28364      };
28365      if (element.hasPriorRequest()) {
28366        openArray("priorRequest");
28367        for (Reference e : element.getPriorRequest()) 
28368          composeReference(null, e);
28369        closeArray();
28370      };
28371      if (element.hasGroupIdentifier()) {
28372        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
28373      }
28374      if (element.hasStatusElement()) {
28375        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28376        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
28377      }
28378      if (element.hasIntent()) {
28379        composeCodeableConcept("intent", element.getIntent());
28380      }
28381      if (element.hasPriorityElement()) {
28382        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28383        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
28384      }
28385      if (element.hasCode()) {
28386        composeType("code", element.getCode());
28387      }
28388      if (element.hasSubject()) {
28389        composeReference("subject", element.getSubject());
28390      }
28391      if (element.hasContext()) {
28392        composeReference("context", element.getContext());
28393      }
28394      if (element.hasOccurrence()) {
28395        composeType("occurrence", element.getOccurrence());
28396      }
28397      if (element.hasAuthoredOnElement()) {
28398        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
28399        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
28400      }
28401      if (element.hasRequester()) {
28402        composeDeviceRequestDeviceRequestRequesterComponent("requester", element.getRequester());
28403      }
28404      if (element.hasPerformerType()) {
28405        composeCodeableConcept("performerType", element.getPerformerType());
28406      }
28407      if (element.hasPerformer()) {
28408        composeReference("performer", element.getPerformer());
28409      }
28410      if (element.hasReasonCode()) {
28411        openArray("reasonCode");
28412        for (CodeableConcept e : element.getReasonCode()) 
28413          composeCodeableConcept(null, e);
28414        closeArray();
28415      };
28416      if (element.hasReasonReference()) {
28417        openArray("reasonReference");
28418        for (Reference e : element.getReasonReference()) 
28419          composeReference(null, e);
28420        closeArray();
28421      };
28422      if (element.hasSupportingInfo()) {
28423        openArray("supportingInfo");
28424        for (Reference e : element.getSupportingInfo()) 
28425          composeReference(null, e);
28426        closeArray();
28427      };
28428      if (element.hasNote()) {
28429        openArray("note");
28430        for (Annotation e : element.getNote()) 
28431          composeAnnotation(null, e);
28432        closeArray();
28433      };
28434      if (element.hasRelevantHistory()) {
28435        openArray("relevantHistory");
28436        for (Reference e : element.getRelevantHistory()) 
28437          composeReference(null, e);
28438        closeArray();
28439      };
28440  }
28441
28442  protected void composeDeviceRequestDeviceRequestRequesterComponent(String name, DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28443    if (element != null) {
28444      open(name);
28445      composeDeviceRequestDeviceRequestRequesterComponentInner(element);
28446      close();
28447    }
28448  }
28449
28450  protected void composeDeviceRequestDeviceRequestRequesterComponentInner(DeviceRequest.DeviceRequestRequesterComponent element) throws IOException {
28451      composeBackbone(element);
28452      if (element.hasAgent()) {
28453        composeReference("agent", element.getAgent());
28454      }
28455      if (element.hasOnBehalfOf()) {
28456        composeReference("onBehalfOf", element.getOnBehalfOf());
28457      }
28458  }
28459
28460  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
28461    if (element != null) {
28462      prop("resourceType", name);
28463      composeDeviceUseStatementInner(element);
28464    }
28465  }
28466
28467  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
28468      composeDomainResourceElements(element);
28469      if (element.hasIdentifier()) {
28470        openArray("identifier");
28471        for (Identifier e : element.getIdentifier()) 
28472          composeIdentifier(null, e);
28473        closeArray();
28474      };
28475      if (element.hasStatusElement()) {
28476        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28477        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
28478      }
28479      if (element.hasSubject()) {
28480        composeReference("subject", element.getSubject());
28481      }
28482      if (element.hasWhenUsed()) {
28483        composePeriod("whenUsed", element.getWhenUsed());
28484      }
28485      if (element.hasTiming()) {
28486        composeType("timing", element.getTiming());
28487      }
28488      if (element.hasRecordedOnElement()) {
28489        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
28490        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
28491      }
28492      if (element.hasSource()) {
28493        composeReference("source", element.getSource());
28494      }
28495      if (element.hasDevice()) {
28496        composeReference("device", element.getDevice());
28497      }
28498      if (element.hasIndication()) {
28499        openArray("indication");
28500        for (CodeableConcept e : element.getIndication()) 
28501          composeCodeableConcept(null, e);
28502        closeArray();
28503      };
28504      if (element.hasBodySite()) {
28505        composeCodeableConcept("bodySite", element.getBodySite());
28506      }
28507      if (element.hasNote()) {
28508        openArray("note");
28509        for (Annotation e : element.getNote()) 
28510          composeAnnotation(null, e);
28511        closeArray();
28512      };
28513  }
28514
28515  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
28516    if (element != null) {
28517      prop("resourceType", name);
28518      composeDiagnosticReportInner(element);
28519    }
28520  }
28521
28522  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
28523      composeDomainResourceElements(element);
28524      if (element.hasIdentifier()) {
28525        openArray("identifier");
28526        for (Identifier e : element.getIdentifier()) 
28527          composeIdentifier(null, e);
28528        closeArray();
28529      };
28530      if (element.hasBasedOn()) {
28531        openArray("basedOn");
28532        for (Reference e : element.getBasedOn()) 
28533          composeReference(null, e);
28534        closeArray();
28535      };
28536      if (element.hasStatusElement()) {
28537        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28538        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
28539      }
28540      if (element.hasCategory()) {
28541        composeCodeableConcept("category", element.getCategory());
28542      }
28543      if (element.hasCode()) {
28544        composeCodeableConcept("code", element.getCode());
28545      }
28546      if (element.hasSubject()) {
28547        composeReference("subject", element.getSubject());
28548      }
28549      if (element.hasContext()) {
28550        composeReference("context", element.getContext());
28551      }
28552      if (element.hasEffective()) {
28553        composeType("effective", element.getEffective());
28554      }
28555      if (element.hasIssuedElement()) {
28556        composeInstantCore("issued", element.getIssuedElement(), false);
28557        composeInstantExtras("issued", element.getIssuedElement(), false);
28558      }
28559      if (element.hasPerformer()) {
28560        openArray("performer");
28561        for (DiagnosticReport.DiagnosticReportPerformerComponent e : element.getPerformer()) 
28562          composeDiagnosticReportDiagnosticReportPerformerComponent(null, e);
28563        closeArray();
28564      };
28565      if (element.hasSpecimen()) {
28566        openArray("specimen");
28567        for (Reference e : element.getSpecimen()) 
28568          composeReference(null, e);
28569        closeArray();
28570      };
28571      if (element.hasResult()) {
28572        openArray("result");
28573        for (Reference e : element.getResult()) 
28574          composeReference(null, e);
28575        closeArray();
28576      };
28577      if (element.hasImagingStudy()) {
28578        openArray("imagingStudy");
28579        for (Reference e : element.getImagingStudy()) 
28580          composeReference(null, e);
28581        closeArray();
28582      };
28583      if (element.hasImage()) {
28584        openArray("image");
28585        for (DiagnosticReport.DiagnosticReportImageComponent e : element.getImage()) 
28586          composeDiagnosticReportDiagnosticReportImageComponent(null, e);
28587        closeArray();
28588      };
28589      if (element.hasConclusionElement()) {
28590        composeStringCore("conclusion", element.getConclusionElement(), false);
28591        composeStringExtras("conclusion", element.getConclusionElement(), false);
28592      }
28593      if (element.hasCodedDiagnosis()) {
28594        openArray("codedDiagnosis");
28595        for (CodeableConcept e : element.getCodedDiagnosis()) 
28596          composeCodeableConcept(null, e);
28597        closeArray();
28598      };
28599      if (element.hasPresentedForm()) {
28600        openArray("presentedForm");
28601        for (Attachment e : element.getPresentedForm()) 
28602          composeAttachment(null, e);
28603        closeArray();
28604      };
28605  }
28606
28607  protected void composeDiagnosticReportDiagnosticReportPerformerComponent(String name, DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28608    if (element != null) {
28609      open(name);
28610      composeDiagnosticReportDiagnosticReportPerformerComponentInner(element);
28611      close();
28612    }
28613  }
28614
28615  protected void composeDiagnosticReportDiagnosticReportPerformerComponentInner(DiagnosticReport.DiagnosticReportPerformerComponent element) throws IOException {
28616      composeBackbone(element);
28617      if (element.hasRole()) {
28618        composeCodeableConcept("role", element.getRole());
28619      }
28620      if (element.hasActor()) {
28621        composeReference("actor", element.getActor());
28622      }
28623  }
28624
28625  protected void composeDiagnosticReportDiagnosticReportImageComponent(String name, DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28626    if (element != null) {
28627      open(name);
28628      composeDiagnosticReportDiagnosticReportImageComponentInner(element);
28629      close();
28630    }
28631  }
28632
28633  protected void composeDiagnosticReportDiagnosticReportImageComponentInner(DiagnosticReport.DiagnosticReportImageComponent element) throws IOException {
28634      composeBackbone(element);
28635      if (element.hasCommentElement()) {
28636        composeStringCore("comment", element.getCommentElement(), false);
28637        composeStringExtras("comment", element.getCommentElement(), false);
28638      }
28639      if (element.hasLink()) {
28640        composeReference("link", element.getLink());
28641      }
28642  }
28643
28644  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
28645    if (element != null) {
28646      prop("resourceType", name);
28647      composeDocumentManifestInner(element);
28648    }
28649  }
28650
28651  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
28652      composeDomainResourceElements(element);
28653      if (element.hasMasterIdentifier()) {
28654        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
28655      }
28656      if (element.hasIdentifier()) {
28657        openArray("identifier");
28658        for (Identifier e : element.getIdentifier()) 
28659          composeIdentifier(null, e);
28660        closeArray();
28661      };
28662      if (element.hasStatusElement()) {
28663        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28664        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28665      }
28666      if (element.hasType()) {
28667        composeCodeableConcept("type", element.getType());
28668      }
28669      if (element.hasSubject()) {
28670        composeReference("subject", element.getSubject());
28671      }
28672      if (element.hasCreatedElement()) {
28673        composeDateTimeCore("created", element.getCreatedElement(), false);
28674        composeDateTimeExtras("created", element.getCreatedElement(), false);
28675      }
28676      if (element.hasAuthor()) {
28677        openArray("author");
28678        for (Reference e : element.getAuthor()) 
28679          composeReference(null, e);
28680        closeArray();
28681      };
28682      if (element.hasRecipient()) {
28683        openArray("recipient");
28684        for (Reference e : element.getRecipient()) 
28685          composeReference(null, e);
28686        closeArray();
28687      };
28688      if (element.hasSourceElement()) {
28689        composeUriCore("source", element.getSourceElement(), false);
28690        composeUriExtras("source", element.getSourceElement(), false);
28691      }
28692      if (element.hasDescriptionElement()) {
28693        composeStringCore("description", element.getDescriptionElement(), false);
28694        composeStringExtras("description", element.getDescriptionElement(), false);
28695      }
28696      if (element.hasContent()) {
28697        openArray("content");
28698        for (DocumentManifest.DocumentManifestContentComponent e : element.getContent()) 
28699          composeDocumentManifestDocumentManifestContentComponent(null, e);
28700        closeArray();
28701      };
28702      if (element.hasRelated()) {
28703        openArray("related");
28704        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
28705          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
28706        closeArray();
28707      };
28708  }
28709
28710  protected void composeDocumentManifestDocumentManifestContentComponent(String name, DocumentManifest.DocumentManifestContentComponent element) throws IOException {
28711    if (element != null) {
28712      open(name);
28713      composeDocumentManifestDocumentManifestContentComponentInner(element);
28714      close();
28715    }
28716  }
28717
28718  protected void composeDocumentManifestDocumentManifestContentComponentInner(DocumentManifest.DocumentManifestContentComponent element) throws IOException {
28719      composeBackbone(element);
28720      if (element.hasP()) {
28721        composeType("p", element.getP());
28722      }
28723  }
28724
28725  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
28726    if (element != null) {
28727      open(name);
28728      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
28729      close();
28730    }
28731  }
28732
28733  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
28734      composeBackbone(element);
28735      if (element.hasIdentifier()) {
28736        composeIdentifier("identifier", element.getIdentifier());
28737      }
28738      if (element.hasRef()) {
28739        composeReference("ref", element.getRef());
28740      }
28741  }
28742
28743  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
28744    if (element != null) {
28745      prop("resourceType", name);
28746      composeDocumentReferenceInner(element);
28747    }
28748  }
28749
28750  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
28751      composeDomainResourceElements(element);
28752      if (element.hasMasterIdentifier()) {
28753        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
28754      }
28755      if (element.hasIdentifier()) {
28756        openArray("identifier");
28757        for (Identifier e : element.getIdentifier()) 
28758          composeIdentifier(null, e);
28759        closeArray();
28760      };
28761      if (element.hasStatusElement()) {
28762        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28763        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
28764      }
28765      if (element.hasDocStatusElement()) {
28766        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
28767        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
28768      }
28769      if (element.hasType()) {
28770        composeCodeableConcept("type", element.getType());
28771      }
28772      if (element.hasClass_()) {
28773        composeCodeableConcept("class", element.getClass_());
28774      }
28775      if (element.hasSubject()) {
28776        composeReference("subject", element.getSubject());
28777      }
28778      if (element.hasCreatedElement()) {
28779        composeDateTimeCore("created", element.getCreatedElement(), false);
28780        composeDateTimeExtras("created", element.getCreatedElement(), false);
28781      }
28782      if (element.hasIndexedElement()) {
28783        composeInstantCore("indexed", element.getIndexedElement(), false);
28784        composeInstantExtras("indexed", element.getIndexedElement(), false);
28785      }
28786      if (element.hasAuthor()) {
28787        openArray("author");
28788        for (Reference e : element.getAuthor()) 
28789          composeReference(null, e);
28790        closeArray();
28791      };
28792      if (element.hasAuthenticator()) {
28793        composeReference("authenticator", element.getAuthenticator());
28794      }
28795      if (element.hasCustodian()) {
28796        composeReference("custodian", element.getCustodian());
28797      }
28798      if (element.hasRelatesTo()) {
28799        openArray("relatesTo");
28800        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
28801          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
28802        closeArray();
28803      };
28804      if (element.hasDescriptionElement()) {
28805        composeStringCore("description", element.getDescriptionElement(), false);
28806        composeStringExtras("description", element.getDescriptionElement(), false);
28807      }
28808      if (element.hasSecurityLabel()) {
28809        openArray("securityLabel");
28810        for (CodeableConcept e : element.getSecurityLabel()) 
28811          composeCodeableConcept(null, e);
28812        closeArray();
28813      };
28814      if (element.hasContent()) {
28815        openArray("content");
28816        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
28817          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
28818        closeArray();
28819      };
28820      if (element.hasContext()) {
28821        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
28822      }
28823  }
28824
28825  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
28826    if (element != null) {
28827      open(name);
28828      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
28829      close();
28830    }
28831  }
28832
28833  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
28834      composeBackbone(element);
28835      if (element.hasCodeElement()) {
28836        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
28837        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
28838      }
28839      if (element.hasTarget()) {
28840        composeReference("target", element.getTarget());
28841      }
28842  }
28843
28844  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
28845    if (element != null) {
28846      open(name);
28847      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
28848      close();
28849    }
28850  }
28851
28852  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
28853      composeBackbone(element);
28854      if (element.hasAttachment()) {
28855        composeAttachment("attachment", element.getAttachment());
28856      }
28857      if (element.hasFormat()) {
28858        composeCoding("format", element.getFormat());
28859      }
28860  }
28861
28862  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
28863    if (element != null) {
28864      open(name);
28865      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
28866      close();
28867    }
28868  }
28869
28870  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
28871      composeBackbone(element);
28872      if (element.hasEncounter()) {
28873        composeReference("encounter", element.getEncounter());
28874      }
28875      if (element.hasEvent()) {
28876        openArray("event");
28877        for (CodeableConcept e : element.getEvent()) 
28878          composeCodeableConcept(null, e);
28879        closeArray();
28880      };
28881      if (element.hasPeriod()) {
28882        composePeriod("period", element.getPeriod());
28883      }
28884      if (element.hasFacilityType()) {
28885        composeCodeableConcept("facilityType", element.getFacilityType());
28886      }
28887      if (element.hasPracticeSetting()) {
28888        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
28889      }
28890      if (element.hasSourcePatientInfo()) {
28891        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
28892      }
28893      if (element.hasRelated()) {
28894        openArray("related");
28895        for (DocumentReference.DocumentReferenceContextRelatedComponent e : element.getRelated()) 
28896          composeDocumentReferenceDocumentReferenceContextRelatedComponent(null, e);
28897        closeArray();
28898      };
28899  }
28900
28901  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponent(String name, DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
28902    if (element != null) {
28903      open(name);
28904      composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(element);
28905      close();
28906    }
28907  }
28908
28909  protected void composeDocumentReferenceDocumentReferenceContextRelatedComponentInner(DocumentReference.DocumentReferenceContextRelatedComponent element) throws IOException {
28910      composeBackbone(element);
28911      if (element.hasIdentifier()) {
28912        composeIdentifier("identifier", element.getIdentifier());
28913      }
28914      if (element.hasRef()) {
28915        composeReference("ref", element.getRef());
28916      }
28917  }
28918
28919  protected void composeEligibilityRequest(String name, EligibilityRequest element) throws IOException {
28920    if (element != null) {
28921      prop("resourceType", name);
28922      composeEligibilityRequestInner(element);
28923    }
28924  }
28925
28926  protected void composeEligibilityRequestInner(EligibilityRequest element) throws IOException {
28927      composeDomainResourceElements(element);
28928      if (element.hasIdentifier()) {
28929        openArray("identifier");
28930        for (Identifier e : element.getIdentifier()) 
28931          composeIdentifier(null, e);
28932        closeArray();
28933      };
28934      if (element.hasStatusElement()) {
28935        composeEnumerationCore("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
28936        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
28937      }
28938      if (element.hasPriority()) {
28939        composeCodeableConcept("priority", element.getPriority());
28940      }
28941      if (element.hasPatient()) {
28942        composeReference("patient", element.getPatient());
28943      }
28944      if (element.hasServiced()) {
28945        composeType("serviced", element.getServiced());
28946      }
28947      if (element.hasCreatedElement()) {
28948        composeDateTimeCore("created", element.getCreatedElement(), false);
28949        composeDateTimeExtras("created", element.getCreatedElement(), false);
28950      }
28951      if (element.hasEnterer()) {
28952        composeReference("enterer", element.getEnterer());
28953      }
28954      if (element.hasProvider()) {
28955        composeReference("provider", element.getProvider());
28956      }
28957      if (element.hasOrganization()) {
28958        composeReference("organization", element.getOrganization());
28959      }
28960      if (element.hasInsurer()) {
28961        composeReference("insurer", element.getInsurer());
28962      }
28963      if (element.hasFacility()) {
28964        composeReference("facility", element.getFacility());
28965      }
28966      if (element.hasCoverage()) {
28967        composeReference("coverage", element.getCoverage());
28968      }
28969      if (element.hasBusinessArrangementElement()) {
28970        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
28971        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
28972      }
28973      if (element.hasBenefitCategory()) {
28974        composeCodeableConcept("benefitCategory", element.getBenefitCategory());
28975      }
28976      if (element.hasBenefitSubCategory()) {
28977        composeCodeableConcept("benefitSubCategory", element.getBenefitSubCategory());
28978      }
28979  }
28980
28981  protected void composeEligibilityResponse(String name, EligibilityResponse element) throws IOException {
28982    if (element != null) {
28983      prop("resourceType", name);
28984      composeEligibilityResponseInner(element);
28985    }
28986  }
28987
28988  protected void composeEligibilityResponseInner(EligibilityResponse element) throws IOException {
28989      composeDomainResourceElements(element);
28990      if (element.hasIdentifier()) {
28991        openArray("identifier");
28992        for (Identifier e : element.getIdentifier()) 
28993          composeIdentifier(null, e);
28994        closeArray();
28995      };
28996      if (element.hasStatusElement()) {
28997        composeEnumerationCore("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
28998        composeEnumerationExtras("status", element.getStatusElement(), new EligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
28999      }
29000      if (element.hasCreatedElement()) {
29001        composeDateTimeCore("created", element.getCreatedElement(), false);
29002        composeDateTimeExtras("created", element.getCreatedElement(), false);
29003      }
29004      if (element.hasRequestProvider()) {
29005        composeReference("requestProvider", element.getRequestProvider());
29006      }
29007      if (element.hasRequestOrganization()) {
29008        composeReference("requestOrganization", element.getRequestOrganization());
29009      }
29010      if (element.hasRequest()) {
29011        composeReference("request", element.getRequest());
29012      }
29013      if (element.hasOutcome()) {
29014        composeCodeableConcept("outcome", element.getOutcome());
29015      }
29016      if (element.hasDispositionElement()) {
29017        composeStringCore("disposition", element.getDispositionElement(), false);
29018        composeStringExtras("disposition", element.getDispositionElement(), false);
29019      }
29020      if (element.hasInsurer()) {
29021        composeReference("insurer", element.getInsurer());
29022      }
29023      if (element.hasInforceElement()) {
29024        composeBooleanCore("inforce", element.getInforceElement(), false);
29025        composeBooleanExtras("inforce", element.getInforceElement(), false);
29026      }
29027      if (element.hasInsurance()) {
29028        openArray("insurance");
29029        for (EligibilityResponse.InsuranceComponent e : element.getInsurance()) 
29030          composeEligibilityResponseInsuranceComponent(null, e);
29031        closeArray();
29032      };
29033      if (element.hasForm()) {
29034        composeCodeableConcept("form", element.getForm());
29035      }
29036      if (element.hasError()) {
29037        openArray("error");
29038        for (EligibilityResponse.ErrorsComponent e : element.getError()) 
29039          composeEligibilityResponseErrorsComponent(null, e);
29040        closeArray();
29041      };
29042  }
29043
29044  protected void composeEligibilityResponseInsuranceComponent(String name, EligibilityResponse.InsuranceComponent element) throws IOException {
29045    if (element != null) {
29046      open(name);
29047      composeEligibilityResponseInsuranceComponentInner(element);
29048      close();
29049    }
29050  }
29051
29052  protected void composeEligibilityResponseInsuranceComponentInner(EligibilityResponse.InsuranceComponent element) throws IOException {
29053      composeBackbone(element);
29054      if (element.hasCoverage()) {
29055        composeReference("coverage", element.getCoverage());
29056      }
29057      if (element.hasContract()) {
29058        composeReference("contract", element.getContract());
29059      }
29060      if (element.hasBenefitBalance()) {
29061        openArray("benefitBalance");
29062        for (EligibilityResponse.BenefitsComponent e : element.getBenefitBalance()) 
29063          composeEligibilityResponseBenefitsComponent(null, e);
29064        closeArray();
29065      };
29066  }
29067
29068  protected void composeEligibilityResponseBenefitsComponent(String name, EligibilityResponse.BenefitsComponent element) throws IOException {
29069    if (element != null) {
29070      open(name);
29071      composeEligibilityResponseBenefitsComponentInner(element);
29072      close();
29073    }
29074  }
29075
29076  protected void composeEligibilityResponseBenefitsComponentInner(EligibilityResponse.BenefitsComponent element) throws IOException {
29077      composeBackbone(element);
29078      if (element.hasCategory()) {
29079        composeCodeableConcept("category", element.getCategory());
29080      }
29081      if (element.hasSubCategory()) {
29082        composeCodeableConcept("subCategory", element.getSubCategory());
29083      }
29084      if (element.hasExcludedElement()) {
29085        composeBooleanCore("excluded", element.getExcludedElement(), false);
29086        composeBooleanExtras("excluded", element.getExcludedElement(), false);
29087      }
29088      if (element.hasNameElement()) {
29089        composeStringCore("name", element.getNameElement(), false);
29090        composeStringExtras("name", element.getNameElement(), false);
29091      }
29092      if (element.hasDescriptionElement()) {
29093        composeStringCore("description", element.getDescriptionElement(), false);
29094        composeStringExtras("description", element.getDescriptionElement(), false);
29095      }
29096      if (element.hasNetwork()) {
29097        composeCodeableConcept("network", element.getNetwork());
29098      }
29099      if (element.hasUnit()) {
29100        composeCodeableConcept("unit", element.getUnit());
29101      }
29102      if (element.hasTerm()) {
29103        composeCodeableConcept("term", element.getTerm());
29104      }
29105      if (element.hasFinancial()) {
29106        openArray("financial");
29107        for (EligibilityResponse.BenefitComponent e : element.getFinancial()) 
29108          composeEligibilityResponseBenefitComponent(null, e);
29109        closeArray();
29110      };
29111  }
29112
29113  protected void composeEligibilityResponseBenefitComponent(String name, EligibilityResponse.BenefitComponent element) throws IOException {
29114    if (element != null) {
29115      open(name);
29116      composeEligibilityResponseBenefitComponentInner(element);
29117      close();
29118    }
29119  }
29120
29121  protected void composeEligibilityResponseBenefitComponentInner(EligibilityResponse.BenefitComponent element) throws IOException {
29122      composeBackbone(element);
29123      if (element.hasType()) {
29124        composeCodeableConcept("type", element.getType());
29125      }
29126      if (element.hasAllowed()) {
29127        composeType("allowed", element.getAllowed());
29128      }
29129      if (element.hasUsed()) {
29130        composeType("used", element.getUsed());
29131      }
29132  }
29133
29134  protected void composeEligibilityResponseErrorsComponent(String name, EligibilityResponse.ErrorsComponent element) throws IOException {
29135    if (element != null) {
29136      open(name);
29137      composeEligibilityResponseErrorsComponentInner(element);
29138      close();
29139    }
29140  }
29141
29142  protected void composeEligibilityResponseErrorsComponentInner(EligibilityResponse.ErrorsComponent element) throws IOException {
29143      composeBackbone(element);
29144      if (element.hasCode()) {
29145        composeCodeableConcept("code", element.getCode());
29146      }
29147  }
29148
29149  protected void composeEncounter(String name, Encounter element) throws IOException {
29150    if (element != null) {
29151      prop("resourceType", name);
29152      composeEncounterInner(element);
29153    }
29154  }
29155
29156  protected void composeEncounterInner(Encounter element) throws IOException {
29157      composeDomainResourceElements(element);
29158      if (element.hasIdentifier()) {
29159        openArray("identifier");
29160        for (Identifier e : element.getIdentifier()) 
29161          composeIdentifier(null, e);
29162        closeArray();
29163      };
29164      if (element.hasStatusElement()) {
29165        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29166        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29167      }
29168      if (element.hasStatusHistory()) {
29169        openArray("statusHistory");
29170        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
29171          composeEncounterStatusHistoryComponent(null, e);
29172        closeArray();
29173      };
29174      if (element.hasClass_()) {
29175        composeCoding("class", element.getClass_());
29176      }
29177      if (element.hasClassHistory()) {
29178        openArray("classHistory");
29179        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
29180          composeEncounterClassHistoryComponent(null, e);
29181        closeArray();
29182      };
29183      if (element.hasType()) {
29184        openArray("type");
29185        for (CodeableConcept e : element.getType()) 
29186          composeCodeableConcept(null, e);
29187        closeArray();
29188      };
29189      if (element.hasPriority()) {
29190        composeCodeableConcept("priority", element.getPriority());
29191      }
29192      if (element.hasSubject()) {
29193        composeReference("subject", element.getSubject());
29194      }
29195      if (element.hasEpisodeOfCare()) {
29196        openArray("episodeOfCare");
29197        for (Reference e : element.getEpisodeOfCare()) 
29198          composeReference(null, e);
29199        closeArray();
29200      };
29201      if (element.hasIncomingReferral()) {
29202        openArray("incomingReferral");
29203        for (Reference e : element.getIncomingReferral()) 
29204          composeReference(null, e);
29205        closeArray();
29206      };
29207      if (element.hasParticipant()) {
29208        openArray("participant");
29209        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
29210          composeEncounterEncounterParticipantComponent(null, e);
29211        closeArray();
29212      };
29213      if (element.hasAppointment()) {
29214        composeReference("appointment", element.getAppointment());
29215      }
29216      if (element.hasPeriod()) {
29217        composePeriod("period", element.getPeriod());
29218      }
29219      if (element.hasLength()) {
29220        composeDuration("length", element.getLength());
29221      }
29222      if (element.hasReason()) {
29223        openArray("reason");
29224        for (CodeableConcept e : element.getReason()) 
29225          composeCodeableConcept(null, e);
29226        closeArray();
29227      };
29228      if (element.hasDiagnosis()) {
29229        openArray("diagnosis");
29230        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
29231          composeEncounterDiagnosisComponent(null, e);
29232        closeArray();
29233      };
29234      if (element.hasAccount()) {
29235        openArray("account");
29236        for (Reference e : element.getAccount()) 
29237          composeReference(null, e);
29238        closeArray();
29239      };
29240      if (element.hasHospitalization()) {
29241        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
29242      }
29243      if (element.hasLocation()) {
29244        openArray("location");
29245        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
29246          composeEncounterEncounterLocationComponent(null, e);
29247        closeArray();
29248      };
29249      if (element.hasServiceProvider()) {
29250        composeReference("serviceProvider", element.getServiceProvider());
29251      }
29252      if (element.hasPartOf()) {
29253        composeReference("partOf", element.getPartOf());
29254      }
29255  }
29256
29257  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
29258    if (element != null) {
29259      open(name);
29260      composeEncounterStatusHistoryComponentInner(element);
29261      close();
29262    }
29263  }
29264
29265  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
29266      composeBackbone(element);
29267      if (element.hasStatusElement()) {
29268        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29269        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
29270      }
29271      if (element.hasPeriod()) {
29272        composePeriod("period", element.getPeriod());
29273      }
29274  }
29275
29276  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
29277    if (element != null) {
29278      open(name);
29279      composeEncounterClassHistoryComponentInner(element);
29280      close();
29281    }
29282  }
29283
29284  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
29285      composeBackbone(element);
29286      if (element.hasClass_()) {
29287        composeCoding("class", element.getClass_());
29288      }
29289      if (element.hasPeriod()) {
29290        composePeriod("period", element.getPeriod());
29291      }
29292  }
29293
29294  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
29295    if (element != null) {
29296      open(name);
29297      composeEncounterEncounterParticipantComponentInner(element);
29298      close();
29299    }
29300  }
29301
29302  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
29303      composeBackbone(element);
29304      if (element.hasType()) {
29305        openArray("type");
29306        for (CodeableConcept e : element.getType()) 
29307          composeCodeableConcept(null, e);
29308        closeArray();
29309      };
29310      if (element.hasPeriod()) {
29311        composePeriod("period", element.getPeriod());
29312      }
29313      if (element.hasIndividual()) {
29314        composeReference("individual", element.getIndividual());
29315      }
29316  }
29317
29318  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
29319    if (element != null) {
29320      open(name);
29321      composeEncounterDiagnosisComponentInner(element);
29322      close();
29323    }
29324  }
29325
29326  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
29327      composeBackbone(element);
29328      if (element.hasCondition()) {
29329        composeReference("condition", element.getCondition());
29330      }
29331      if (element.hasRole()) {
29332        composeCodeableConcept("role", element.getRole());
29333      }
29334      if (element.hasRankElement()) {
29335        composePositiveIntCore("rank", element.getRankElement(), false);
29336        composePositiveIntExtras("rank", element.getRankElement(), false);
29337      }
29338  }
29339
29340  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
29341    if (element != null) {
29342      open(name);
29343      composeEncounterEncounterHospitalizationComponentInner(element);
29344      close();
29345    }
29346  }
29347
29348  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
29349      composeBackbone(element);
29350      if (element.hasPreAdmissionIdentifier()) {
29351        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
29352      }
29353      if (element.hasOrigin()) {
29354        composeReference("origin", element.getOrigin());
29355      }
29356      if (element.hasAdmitSource()) {
29357        composeCodeableConcept("admitSource", element.getAdmitSource());
29358      }
29359      if (element.hasReAdmission()) {
29360        composeCodeableConcept("reAdmission", element.getReAdmission());
29361      }
29362      if (element.hasDietPreference()) {
29363        openArray("dietPreference");
29364        for (CodeableConcept e : element.getDietPreference()) 
29365          composeCodeableConcept(null, e);
29366        closeArray();
29367      };
29368      if (element.hasSpecialCourtesy()) {
29369        openArray("specialCourtesy");
29370        for (CodeableConcept e : element.getSpecialCourtesy()) 
29371          composeCodeableConcept(null, e);
29372        closeArray();
29373      };
29374      if (element.hasSpecialArrangement()) {
29375        openArray("specialArrangement");
29376        for (CodeableConcept e : element.getSpecialArrangement()) 
29377          composeCodeableConcept(null, e);
29378        closeArray();
29379      };
29380      if (element.hasDestination()) {
29381        composeReference("destination", element.getDestination());
29382      }
29383      if (element.hasDischargeDisposition()) {
29384        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
29385      }
29386  }
29387
29388  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
29389    if (element != null) {
29390      open(name);
29391      composeEncounterEncounterLocationComponentInner(element);
29392      close();
29393    }
29394  }
29395
29396  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
29397      composeBackbone(element);
29398      if (element.hasLocation()) {
29399        composeReference("location", element.getLocation());
29400      }
29401      if (element.hasStatusElement()) {
29402        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29403        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
29404      }
29405      if (element.hasPeriod()) {
29406        composePeriod("period", element.getPeriod());
29407      }
29408  }
29409
29410  protected void composeEndpoint(String name, Endpoint element) throws IOException {
29411    if (element != null) {
29412      prop("resourceType", name);
29413      composeEndpointInner(element);
29414    }
29415  }
29416
29417  protected void composeEndpointInner(Endpoint element) throws IOException {
29418      composeDomainResourceElements(element);
29419      if (element.hasIdentifier()) {
29420        openArray("identifier");
29421        for (Identifier e : element.getIdentifier()) 
29422          composeIdentifier(null, e);
29423        closeArray();
29424      };
29425      if (element.hasStatusElement()) {
29426        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29427        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
29428      }
29429      if (element.hasConnectionType()) {
29430        composeCoding("connectionType", element.getConnectionType());
29431      }
29432      if (element.hasNameElement()) {
29433        composeStringCore("name", element.getNameElement(), false);
29434        composeStringExtras("name", element.getNameElement(), false);
29435      }
29436      if (element.hasManagingOrganization()) {
29437        composeReference("managingOrganization", element.getManagingOrganization());
29438      }
29439      if (element.hasContact()) {
29440        openArray("contact");
29441        for (ContactPoint e : element.getContact()) 
29442          composeContactPoint(null, e);
29443        closeArray();
29444      };
29445      if (element.hasPeriod()) {
29446        composePeriod("period", element.getPeriod());
29447      }
29448      if (element.hasPayloadType()) {
29449        openArray("payloadType");
29450        for (CodeableConcept e : element.getPayloadType()) 
29451          composeCodeableConcept(null, e);
29452        closeArray();
29453      };
29454      if (element.hasPayloadMimeType()) {
29455        openArray("payloadMimeType");
29456        for (CodeType e : element.getPayloadMimeType()) 
29457          composeCodeCore(null, e, true);
29458        closeArray();
29459        if (anyHasExtras(element.getPayloadMimeType())) {
29460          openArray("_payloadMimeType");
29461          for (CodeType e : element.getPayloadMimeType()) 
29462            composeCodeExtras(null, e, true);
29463          closeArray();
29464        }
29465      };
29466      if (element.hasAddressElement()) {
29467        composeUriCore("address", element.getAddressElement(), false);
29468        composeUriExtras("address", element.getAddressElement(), false);
29469      }
29470      if (element.hasHeader()) {
29471        openArray("header");
29472        for (StringType e : element.getHeader()) 
29473          composeStringCore(null, e, true);
29474        closeArray();
29475        if (anyHasExtras(element.getHeader())) {
29476          openArray("_header");
29477          for (StringType e : element.getHeader()) 
29478            composeStringExtras(null, e, true);
29479          closeArray();
29480        }
29481      };
29482  }
29483
29484  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
29485    if (element != null) {
29486      prop("resourceType", name);
29487      composeEnrollmentRequestInner(element);
29488    }
29489  }
29490
29491  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
29492      composeDomainResourceElements(element);
29493      if (element.hasIdentifier()) {
29494        openArray("identifier");
29495        for (Identifier e : element.getIdentifier()) 
29496          composeIdentifier(null, e);
29497        closeArray();
29498      };
29499      if (element.hasStatusElement()) {
29500        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29501        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
29502      }
29503      if (element.hasCreatedElement()) {
29504        composeDateTimeCore("created", element.getCreatedElement(), false);
29505        composeDateTimeExtras("created", element.getCreatedElement(), false);
29506      }
29507      if (element.hasInsurer()) {
29508        composeReference("insurer", element.getInsurer());
29509      }
29510      if (element.hasProvider()) {
29511        composeReference("provider", element.getProvider());
29512      }
29513      if (element.hasOrganization()) {
29514        composeReference("organization", element.getOrganization());
29515      }
29516      if (element.hasSubject()) {
29517        composeReference("subject", element.getSubject());
29518      }
29519      if (element.hasCoverage()) {
29520        composeReference("coverage", element.getCoverage());
29521      }
29522  }
29523
29524  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
29525    if (element != null) {
29526      prop("resourceType", name);
29527      composeEnrollmentResponseInner(element);
29528    }
29529  }
29530
29531  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
29532      composeDomainResourceElements(element);
29533      if (element.hasIdentifier()) {
29534        openArray("identifier");
29535        for (Identifier e : element.getIdentifier()) 
29536          composeIdentifier(null, e);
29537        closeArray();
29538      };
29539      if (element.hasStatusElement()) {
29540        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29541        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
29542      }
29543      if (element.hasRequest()) {
29544        composeReference("request", element.getRequest());
29545      }
29546      if (element.hasOutcome()) {
29547        composeCodeableConcept("outcome", element.getOutcome());
29548      }
29549      if (element.hasDispositionElement()) {
29550        composeStringCore("disposition", element.getDispositionElement(), false);
29551        composeStringExtras("disposition", element.getDispositionElement(), false);
29552      }
29553      if (element.hasCreatedElement()) {
29554        composeDateTimeCore("created", element.getCreatedElement(), false);
29555        composeDateTimeExtras("created", element.getCreatedElement(), false);
29556      }
29557      if (element.hasOrganization()) {
29558        composeReference("organization", element.getOrganization());
29559      }
29560      if (element.hasRequestProvider()) {
29561        composeReference("requestProvider", element.getRequestProvider());
29562      }
29563      if (element.hasRequestOrganization()) {
29564        composeReference("requestOrganization", element.getRequestOrganization());
29565      }
29566  }
29567
29568  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
29569    if (element != null) {
29570      prop("resourceType", name);
29571      composeEpisodeOfCareInner(element);
29572    }
29573  }
29574
29575  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
29576      composeDomainResourceElements(element);
29577      if (element.hasIdentifier()) {
29578        openArray("identifier");
29579        for (Identifier e : element.getIdentifier()) 
29580          composeIdentifier(null, e);
29581        closeArray();
29582      };
29583      if (element.hasStatusElement()) {
29584        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29585        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29586      }
29587      if (element.hasStatusHistory()) {
29588        openArray("statusHistory");
29589        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
29590          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
29591        closeArray();
29592      };
29593      if (element.hasType()) {
29594        openArray("type");
29595        for (CodeableConcept e : element.getType()) 
29596          composeCodeableConcept(null, e);
29597        closeArray();
29598      };
29599      if (element.hasDiagnosis()) {
29600        openArray("diagnosis");
29601        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
29602          composeEpisodeOfCareDiagnosisComponent(null, e);
29603        closeArray();
29604      };
29605      if (element.hasPatient()) {
29606        composeReference("patient", element.getPatient());
29607      }
29608      if (element.hasManagingOrganization()) {
29609        composeReference("managingOrganization", element.getManagingOrganization());
29610      }
29611      if (element.hasPeriod()) {
29612        composePeriod("period", element.getPeriod());
29613      }
29614      if (element.hasReferralRequest()) {
29615        openArray("referralRequest");
29616        for (Reference e : element.getReferralRequest()) 
29617          composeReference(null, e);
29618        closeArray();
29619      };
29620      if (element.hasCareManager()) {
29621        composeReference("careManager", element.getCareManager());
29622      }
29623      if (element.hasTeam()) {
29624        openArray("team");
29625        for (Reference e : element.getTeam()) 
29626          composeReference(null, e);
29627        closeArray();
29628      };
29629      if (element.hasAccount()) {
29630        openArray("account");
29631        for (Reference e : element.getAccount()) 
29632          composeReference(null, e);
29633        closeArray();
29634      };
29635  }
29636
29637  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29638    if (element != null) {
29639      open(name);
29640      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
29641      close();
29642    }
29643  }
29644
29645  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
29646      composeBackbone(element);
29647      if (element.hasStatusElement()) {
29648        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29649        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
29650      }
29651      if (element.hasPeriod()) {
29652        composePeriod("period", element.getPeriod());
29653      }
29654  }
29655
29656  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
29657    if (element != null) {
29658      open(name);
29659      composeEpisodeOfCareDiagnosisComponentInner(element);
29660      close();
29661    }
29662  }
29663
29664  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
29665      composeBackbone(element);
29666      if (element.hasCondition()) {
29667        composeReference("condition", element.getCondition());
29668      }
29669      if (element.hasRole()) {
29670        composeCodeableConcept("role", element.getRole());
29671      }
29672      if (element.hasRankElement()) {
29673        composePositiveIntCore("rank", element.getRankElement(), false);
29674        composePositiveIntExtras("rank", element.getRankElement(), false);
29675      }
29676  }
29677
29678  protected void composeExpansionProfile(String name, ExpansionProfile element) throws IOException {
29679    if (element != null) {
29680      prop("resourceType", name);
29681      composeExpansionProfileInner(element);
29682    }
29683  }
29684
29685  protected void composeExpansionProfileInner(ExpansionProfile element) throws IOException {
29686      composeDomainResourceElements(element);
29687      if (element.hasUrlElement()) {
29688        composeUriCore("url", element.getUrlElement(), false);
29689        composeUriExtras("url", element.getUrlElement(), false);
29690      }
29691      if (element.hasIdentifier()) {
29692        composeIdentifier("identifier", element.getIdentifier());
29693      }
29694      if (element.hasVersionElement()) {
29695        composeStringCore("version", element.getVersionElement(), false);
29696        composeStringExtras("version", element.getVersionElement(), false);
29697      }
29698      if (element.hasNameElement()) {
29699        composeStringCore("name", element.getNameElement(), false);
29700        composeStringExtras("name", element.getNameElement(), false);
29701      }
29702      if (element.hasStatusElement()) {
29703        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29704        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29705      }
29706      if (element.hasExperimentalElement()) {
29707        composeBooleanCore("experimental", element.getExperimentalElement(), false);
29708        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
29709      }
29710      if (element.hasDateElement()) {
29711        composeDateTimeCore("date", element.getDateElement(), false);
29712        composeDateTimeExtras("date", element.getDateElement(), false);
29713      }
29714      if (element.hasPublisherElement()) {
29715        composeStringCore("publisher", element.getPublisherElement(), false);
29716        composeStringExtras("publisher", element.getPublisherElement(), false);
29717      }
29718      if (element.hasContact()) {
29719        openArray("contact");
29720        for (ContactDetail e : element.getContact()) 
29721          composeContactDetail(null, e);
29722        closeArray();
29723      };
29724      if (element.hasDescriptionElement()) {
29725        composeMarkdownCore("description", element.getDescriptionElement(), false);
29726        composeMarkdownExtras("description", element.getDescriptionElement(), false);
29727      }
29728      if (element.hasUseContext()) {
29729        openArray("useContext");
29730        for (UsageContext e : element.getUseContext()) 
29731          composeUsageContext(null, e);
29732        closeArray();
29733      };
29734      if (element.hasJurisdiction()) {
29735        openArray("jurisdiction");
29736        for (CodeableConcept e : element.getJurisdiction()) 
29737          composeCodeableConcept(null, e);
29738        closeArray();
29739      };
29740      if (element.hasFixedVersion()) {
29741        openArray("fixedVersion");
29742        for (ExpansionProfile.ExpansionProfileFixedVersionComponent e : element.getFixedVersion()) 
29743          composeExpansionProfileExpansionProfileFixedVersionComponent(null, e);
29744        closeArray();
29745      };
29746      if (element.hasExcludedSystem()) {
29747        composeExpansionProfileExpansionProfileExcludedSystemComponent("excludedSystem", element.getExcludedSystem());
29748      }
29749      if (element.hasIncludeDesignationsElement()) {
29750        composeBooleanCore("includeDesignations", element.getIncludeDesignationsElement(), false);
29751        composeBooleanExtras("includeDesignations", element.getIncludeDesignationsElement(), false);
29752      }
29753      if (element.hasDesignation()) {
29754        composeExpansionProfileExpansionProfileDesignationComponent("designation", element.getDesignation());
29755      }
29756      if (element.hasIncludeDefinitionElement()) {
29757        composeBooleanCore("includeDefinition", element.getIncludeDefinitionElement(), false);
29758        composeBooleanExtras("includeDefinition", element.getIncludeDefinitionElement(), false);
29759      }
29760      if (element.hasActiveOnlyElement()) {
29761        composeBooleanCore("activeOnly", element.getActiveOnlyElement(), false);
29762        composeBooleanExtras("activeOnly", element.getActiveOnlyElement(), false);
29763      }
29764      if (element.hasExcludeNestedElement()) {
29765        composeBooleanCore("excludeNested", element.getExcludeNestedElement(), false);
29766        composeBooleanExtras("excludeNested", element.getExcludeNestedElement(), false);
29767      }
29768      if (element.hasExcludeNotForUIElement()) {
29769        composeBooleanCore("excludeNotForUI", element.getExcludeNotForUIElement(), false);
29770        composeBooleanExtras("excludeNotForUI", element.getExcludeNotForUIElement(), false);
29771      }
29772      if (element.hasExcludePostCoordinatedElement()) {
29773        composeBooleanCore("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
29774        composeBooleanExtras("excludePostCoordinated", element.getExcludePostCoordinatedElement(), false);
29775      }
29776      if (element.hasDisplayLanguageElement()) {
29777        composeCodeCore("displayLanguage", element.getDisplayLanguageElement(), false);
29778        composeCodeExtras("displayLanguage", element.getDisplayLanguageElement(), false);
29779      }
29780      if (element.hasLimitedExpansionElement()) {
29781        composeBooleanCore("limitedExpansion", element.getLimitedExpansionElement(), false);
29782        composeBooleanExtras("limitedExpansion", element.getLimitedExpansionElement(), false);
29783      }
29784  }
29785
29786  protected void composeExpansionProfileExpansionProfileFixedVersionComponent(String name, ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
29787    if (element != null) {
29788      open(name);
29789      composeExpansionProfileExpansionProfileFixedVersionComponentInner(element);
29790      close();
29791    }
29792  }
29793
29794  protected void composeExpansionProfileExpansionProfileFixedVersionComponentInner(ExpansionProfile.ExpansionProfileFixedVersionComponent element) throws IOException {
29795      composeBackbone(element);
29796      if (element.hasSystemElement()) {
29797        composeUriCore("system", element.getSystemElement(), false);
29798        composeUriExtras("system", element.getSystemElement(), false);
29799      }
29800      if (element.hasVersionElement()) {
29801        composeStringCore("version", element.getVersionElement(), false);
29802        composeStringExtras("version", element.getVersionElement(), false);
29803      }
29804      if (element.hasModeElement()) {
29805        composeEnumerationCore("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
29806        composeEnumerationExtras("mode", element.getModeElement(), new ExpansionProfile.SystemVersionProcessingModeEnumFactory(), false);
29807      }
29808  }
29809
29810  protected void composeExpansionProfileExpansionProfileExcludedSystemComponent(String name, ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
29811    if (element != null) {
29812      open(name);
29813      composeExpansionProfileExpansionProfileExcludedSystemComponentInner(element);
29814      close();
29815    }
29816  }
29817
29818  protected void composeExpansionProfileExpansionProfileExcludedSystemComponentInner(ExpansionProfile.ExpansionProfileExcludedSystemComponent element) throws IOException {
29819      composeBackbone(element);
29820      if (element.hasSystemElement()) {
29821        composeUriCore("system", element.getSystemElement(), false);
29822        composeUriExtras("system", element.getSystemElement(), false);
29823      }
29824      if (element.hasVersionElement()) {
29825        composeStringCore("version", element.getVersionElement(), false);
29826        composeStringExtras("version", element.getVersionElement(), false);
29827      }
29828  }
29829
29830  protected void composeExpansionProfileExpansionProfileDesignationComponent(String name, ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
29831    if (element != null) {
29832      open(name);
29833      composeExpansionProfileExpansionProfileDesignationComponentInner(element);
29834      close();
29835    }
29836  }
29837
29838  protected void composeExpansionProfileExpansionProfileDesignationComponentInner(ExpansionProfile.ExpansionProfileDesignationComponent element) throws IOException {
29839      composeBackbone(element);
29840      if (element.hasInclude()) {
29841        composeExpansionProfileDesignationIncludeComponent("include", element.getInclude());
29842      }
29843      if (element.hasExclude()) {
29844        composeExpansionProfileDesignationExcludeComponent("exclude", element.getExclude());
29845      }
29846  }
29847
29848  protected void composeExpansionProfileDesignationIncludeComponent(String name, ExpansionProfile.DesignationIncludeComponent element) throws IOException {
29849    if (element != null) {
29850      open(name);
29851      composeExpansionProfileDesignationIncludeComponentInner(element);
29852      close();
29853    }
29854  }
29855
29856  protected void composeExpansionProfileDesignationIncludeComponentInner(ExpansionProfile.DesignationIncludeComponent element) throws IOException {
29857      composeBackbone(element);
29858      if (element.hasDesignation()) {
29859        openArray("designation");
29860        for (ExpansionProfile.DesignationIncludeDesignationComponent e : element.getDesignation()) 
29861          composeExpansionProfileDesignationIncludeDesignationComponent(null, e);
29862        closeArray();
29863      };
29864  }
29865
29866  protected void composeExpansionProfileDesignationIncludeDesignationComponent(String name, ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
29867    if (element != null) {
29868      open(name);
29869      composeExpansionProfileDesignationIncludeDesignationComponentInner(element);
29870      close();
29871    }
29872  }
29873
29874  protected void composeExpansionProfileDesignationIncludeDesignationComponentInner(ExpansionProfile.DesignationIncludeDesignationComponent element) throws IOException {
29875      composeBackbone(element);
29876      if (element.hasLanguageElement()) {
29877        composeCodeCore("language", element.getLanguageElement(), false);
29878        composeCodeExtras("language", element.getLanguageElement(), false);
29879      }
29880      if (element.hasUse()) {
29881        composeCoding("use", element.getUse());
29882      }
29883  }
29884
29885  protected void composeExpansionProfileDesignationExcludeComponent(String name, ExpansionProfile.DesignationExcludeComponent element) throws IOException {
29886    if (element != null) {
29887      open(name);
29888      composeExpansionProfileDesignationExcludeComponentInner(element);
29889      close();
29890    }
29891  }
29892
29893  protected void composeExpansionProfileDesignationExcludeComponentInner(ExpansionProfile.DesignationExcludeComponent element) throws IOException {
29894      composeBackbone(element);
29895      if (element.hasDesignation()) {
29896        openArray("designation");
29897        for (ExpansionProfile.DesignationExcludeDesignationComponent e : element.getDesignation()) 
29898          composeExpansionProfileDesignationExcludeDesignationComponent(null, e);
29899        closeArray();
29900      };
29901  }
29902
29903  protected void composeExpansionProfileDesignationExcludeDesignationComponent(String name, ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
29904    if (element != null) {
29905      open(name);
29906      composeExpansionProfileDesignationExcludeDesignationComponentInner(element);
29907      close();
29908    }
29909  }
29910
29911  protected void composeExpansionProfileDesignationExcludeDesignationComponentInner(ExpansionProfile.DesignationExcludeDesignationComponent element) throws IOException {
29912      composeBackbone(element);
29913      if (element.hasLanguageElement()) {
29914        composeCodeCore("language", element.getLanguageElement(), false);
29915        composeCodeExtras("language", element.getLanguageElement(), false);
29916      }
29917      if (element.hasUse()) {
29918        composeCoding("use", element.getUse());
29919      }
29920  }
29921
29922  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
29923    if (element != null) {
29924      prop("resourceType", name);
29925      composeExplanationOfBenefitInner(element);
29926    }
29927  }
29928
29929  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
29930      composeDomainResourceElements(element);
29931      if (element.hasIdentifier()) {
29932        openArray("identifier");
29933        for (Identifier e : element.getIdentifier()) 
29934          composeIdentifier(null, e);
29935        closeArray();
29936      };
29937      if (element.hasStatusElement()) {
29938        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
29939        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
29940      }
29941      if (element.hasType()) {
29942        composeCodeableConcept("type", element.getType());
29943      }
29944      if (element.hasSubType()) {
29945        openArray("subType");
29946        for (CodeableConcept e : element.getSubType()) 
29947          composeCodeableConcept(null, e);
29948        closeArray();
29949      };
29950      if (element.hasPatient()) {
29951        composeReference("patient", element.getPatient());
29952      }
29953      if (element.hasBillablePeriod()) {
29954        composePeriod("billablePeriod", element.getBillablePeriod());
29955      }
29956      if (element.hasCreatedElement()) {
29957        composeDateTimeCore("created", element.getCreatedElement(), false);
29958        composeDateTimeExtras("created", element.getCreatedElement(), false);
29959      }
29960      if (element.hasEnterer()) {
29961        composeReference("enterer", element.getEnterer());
29962      }
29963      if (element.hasInsurer()) {
29964        composeReference("insurer", element.getInsurer());
29965      }
29966      if (element.hasProvider()) {
29967        composeReference("provider", element.getProvider());
29968      }
29969      if (element.hasOrganization()) {
29970        composeReference("organization", element.getOrganization());
29971      }
29972      if (element.hasReferral()) {
29973        composeReference("referral", element.getReferral());
29974      }
29975      if (element.hasFacility()) {
29976        composeReference("facility", element.getFacility());
29977      }
29978      if (element.hasClaim()) {
29979        composeReference("claim", element.getClaim());
29980      }
29981      if (element.hasClaimResponse()) {
29982        composeReference("claimResponse", element.getClaimResponse());
29983      }
29984      if (element.hasOutcome()) {
29985        composeCodeableConcept("outcome", element.getOutcome());
29986      }
29987      if (element.hasDispositionElement()) {
29988        composeStringCore("disposition", element.getDispositionElement(), false);
29989        composeStringExtras("disposition", element.getDispositionElement(), false);
29990      }
29991      if (element.hasRelated()) {
29992        openArray("related");
29993        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
29994          composeExplanationOfBenefitRelatedClaimComponent(null, e);
29995        closeArray();
29996      };
29997      if (element.hasPrescription()) {
29998        composeReference("prescription", element.getPrescription());
29999      }
30000      if (element.hasOriginalPrescription()) {
30001        composeReference("originalPrescription", element.getOriginalPrescription());
30002      }
30003      if (element.hasPayee()) {
30004        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
30005      }
30006      if (element.hasInformation()) {
30007        openArray("information");
30008        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
30009          composeExplanationOfBenefitSupportingInformationComponent(null, e);
30010        closeArray();
30011      };
30012      if (element.hasCareTeam()) {
30013        openArray("careTeam");
30014        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
30015          composeExplanationOfBenefitCareTeamComponent(null, e);
30016        closeArray();
30017      };
30018      if (element.hasDiagnosis()) {
30019        openArray("diagnosis");
30020        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
30021          composeExplanationOfBenefitDiagnosisComponent(null, e);
30022        closeArray();
30023      };
30024      if (element.hasProcedure()) {
30025        openArray("procedure");
30026        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
30027          composeExplanationOfBenefitProcedureComponent(null, e);
30028        closeArray();
30029      };
30030      if (element.hasPrecedenceElement()) {
30031        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
30032        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
30033      }
30034      if (element.hasInsurance()) {
30035        composeExplanationOfBenefitInsuranceComponent("insurance", element.getInsurance());
30036      }
30037      if (element.hasAccident()) {
30038        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
30039      }
30040      if (element.hasEmploymentImpacted()) {
30041        composePeriod("employmentImpacted", element.getEmploymentImpacted());
30042      }
30043      if (element.hasHospitalization()) {
30044        composePeriod("hospitalization", element.getHospitalization());
30045      }
30046      if (element.hasItem()) {
30047        openArray("item");
30048        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
30049          composeExplanationOfBenefitItemComponent(null, e);
30050        closeArray();
30051      };
30052      if (element.hasAddItem()) {
30053        openArray("addItem");
30054        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
30055          composeExplanationOfBenefitAddedItemComponent(null, e);
30056        closeArray();
30057      };
30058      if (element.hasTotalCost()) {
30059        composeMoney("totalCost", element.getTotalCost());
30060      }
30061      if (element.hasUnallocDeductable()) {
30062        composeMoney("unallocDeductable", element.getUnallocDeductable());
30063      }
30064      if (element.hasTotalBenefit()) {
30065        composeMoney("totalBenefit", element.getTotalBenefit());
30066      }
30067      if (element.hasPayment()) {
30068        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
30069      }
30070      if (element.hasForm()) {
30071        composeCodeableConcept("form", element.getForm());
30072      }
30073      if (element.hasProcessNote()) {
30074        openArray("processNote");
30075        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
30076          composeExplanationOfBenefitNoteComponent(null, e);
30077        closeArray();
30078      };
30079      if (element.hasBenefitBalance()) {
30080        openArray("benefitBalance");
30081        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
30082          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
30083        closeArray();
30084      };
30085  }
30086
30087  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30088    if (element != null) {
30089      open(name);
30090      composeExplanationOfBenefitRelatedClaimComponentInner(element);
30091      close();
30092    }
30093  }
30094
30095  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
30096      composeBackbone(element);
30097      if (element.hasClaim()) {
30098        composeReference("claim", element.getClaim());
30099      }
30100      if (element.hasRelationship()) {
30101        composeCodeableConcept("relationship", element.getRelationship());
30102      }
30103      if (element.hasReference()) {
30104        composeIdentifier("reference", element.getReference());
30105      }
30106  }
30107
30108  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
30109    if (element != null) {
30110      open(name);
30111      composeExplanationOfBenefitPayeeComponentInner(element);
30112      close();
30113    }
30114  }
30115
30116  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
30117      composeBackbone(element);
30118      if (element.hasType()) {
30119        composeCodeableConcept("type", element.getType());
30120      }
30121      if (element.hasResourceType()) {
30122        composeCodeableConcept("resourceType", element.getResourceType());
30123      }
30124      if (element.hasParty()) {
30125        composeReference("party", element.getParty());
30126      }
30127  }
30128
30129  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
30130    if (element != null) {
30131      open(name);
30132      composeExplanationOfBenefitSupportingInformationComponentInner(element);
30133      close();
30134    }
30135  }
30136
30137  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
30138      composeBackbone(element);
30139      if (element.hasSequenceElement()) {
30140        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30141        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30142      }
30143      if (element.hasCategory()) {
30144        composeCodeableConcept("category", element.getCategory());
30145      }
30146      if (element.hasCode()) {
30147        composeCodeableConcept("code", element.getCode());
30148      }
30149      if (element.hasTiming()) {
30150        composeType("timing", element.getTiming());
30151      }
30152      if (element.hasValue()) {
30153        composeType("value", element.getValue());
30154      }
30155      if (element.hasReason()) {
30156        composeCoding("reason", element.getReason());
30157      }
30158  }
30159
30160  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30161    if (element != null) {
30162      open(name);
30163      composeExplanationOfBenefitCareTeamComponentInner(element);
30164      close();
30165    }
30166  }
30167
30168  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
30169      composeBackbone(element);
30170      if (element.hasSequenceElement()) {
30171        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30172        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30173      }
30174      if (element.hasProvider()) {
30175        composeReference("provider", element.getProvider());
30176      }
30177      if (element.hasResponsibleElement()) {
30178        composeBooleanCore("responsible", element.getResponsibleElement(), false);
30179        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
30180      }
30181      if (element.hasRole()) {
30182        composeCodeableConcept("role", element.getRole());
30183      }
30184      if (element.hasQualification()) {
30185        composeCodeableConcept("qualification", element.getQualification());
30186      }
30187  }
30188
30189  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30190    if (element != null) {
30191      open(name);
30192      composeExplanationOfBenefitDiagnosisComponentInner(element);
30193      close();
30194    }
30195  }
30196
30197  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
30198      composeBackbone(element);
30199      if (element.hasSequenceElement()) {
30200        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30201        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30202      }
30203      if (element.hasDiagnosis()) {
30204        composeType("diagnosis", element.getDiagnosis());
30205      }
30206      if (element.hasType()) {
30207        openArray("type");
30208        for (CodeableConcept e : element.getType()) 
30209          composeCodeableConcept(null, e);
30210        closeArray();
30211      };
30212      if (element.hasPackageCode()) {
30213        composeCodeableConcept("packageCode", element.getPackageCode());
30214      }
30215  }
30216
30217  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30218    if (element != null) {
30219      open(name);
30220      composeExplanationOfBenefitProcedureComponentInner(element);
30221      close();
30222    }
30223  }
30224
30225  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
30226      composeBackbone(element);
30227      if (element.hasSequenceElement()) {
30228        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30229        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30230      }
30231      if (element.hasDateElement()) {
30232        composeDateTimeCore("date", element.getDateElement(), false);
30233        composeDateTimeExtras("date", element.getDateElement(), false);
30234      }
30235      if (element.hasProcedure()) {
30236        composeType("procedure", element.getProcedure());
30237      }
30238  }
30239
30240  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30241    if (element != null) {
30242      open(name);
30243      composeExplanationOfBenefitInsuranceComponentInner(element);
30244      close();
30245    }
30246  }
30247
30248  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
30249      composeBackbone(element);
30250      if (element.hasCoverage()) {
30251        composeReference("coverage", element.getCoverage());
30252      }
30253      if (element.hasPreAuthRef()) {
30254        openArray("preAuthRef");
30255        for (StringType e : element.getPreAuthRef()) 
30256          composeStringCore(null, e, true);
30257        closeArray();
30258        if (anyHasExtras(element.getPreAuthRef())) {
30259          openArray("_preAuthRef");
30260          for (StringType e : element.getPreAuthRef()) 
30261            composeStringExtras(null, e, true);
30262          closeArray();
30263        }
30264      };
30265  }
30266
30267  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
30268    if (element != null) {
30269      open(name);
30270      composeExplanationOfBenefitAccidentComponentInner(element);
30271      close();
30272    }
30273  }
30274
30275  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
30276      composeBackbone(element);
30277      if (element.hasDateElement()) {
30278        composeDateCore("date", element.getDateElement(), false);
30279        composeDateExtras("date", element.getDateElement(), false);
30280      }
30281      if (element.hasType()) {
30282        composeCodeableConcept("type", element.getType());
30283      }
30284      if (element.hasLocation()) {
30285        composeType("location", element.getLocation());
30286      }
30287  }
30288
30289  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
30290    if (element != null) {
30291      open(name);
30292      composeExplanationOfBenefitItemComponentInner(element);
30293      close();
30294    }
30295  }
30296
30297  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
30298      composeBackbone(element);
30299      if (element.hasSequenceElement()) {
30300        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30301        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30302      }
30303      if (element.hasCareTeamLinkId()) {
30304        openArray("careTeamLinkId");
30305        for (PositiveIntType e : element.getCareTeamLinkId()) 
30306          composePositiveIntCore(null, e, true);
30307        closeArray();
30308        if (anyHasExtras(element.getCareTeamLinkId())) {
30309          openArray("_careTeamLinkId");
30310          for (PositiveIntType e : element.getCareTeamLinkId()) 
30311            composePositiveIntExtras(null, e, true);
30312          closeArray();
30313        }
30314      };
30315      if (element.hasDiagnosisLinkId()) {
30316        openArray("diagnosisLinkId");
30317        for (PositiveIntType e : element.getDiagnosisLinkId()) 
30318          composePositiveIntCore(null, e, true);
30319        closeArray();
30320        if (anyHasExtras(element.getDiagnosisLinkId())) {
30321          openArray("_diagnosisLinkId");
30322          for (PositiveIntType e : element.getDiagnosisLinkId()) 
30323            composePositiveIntExtras(null, e, true);
30324          closeArray();
30325        }
30326      };
30327      if (element.hasProcedureLinkId()) {
30328        openArray("procedureLinkId");
30329        for (PositiveIntType e : element.getProcedureLinkId()) 
30330          composePositiveIntCore(null, e, true);
30331        closeArray();
30332        if (anyHasExtras(element.getProcedureLinkId())) {
30333          openArray("_procedureLinkId");
30334          for (PositiveIntType e : element.getProcedureLinkId()) 
30335            composePositiveIntExtras(null, e, true);
30336          closeArray();
30337        }
30338      };
30339      if (element.hasInformationLinkId()) {
30340        openArray("informationLinkId");
30341        for (PositiveIntType e : element.getInformationLinkId()) 
30342          composePositiveIntCore(null, e, true);
30343        closeArray();
30344        if (anyHasExtras(element.getInformationLinkId())) {
30345          openArray("_informationLinkId");
30346          for (PositiveIntType e : element.getInformationLinkId()) 
30347            composePositiveIntExtras(null, e, true);
30348          closeArray();
30349        }
30350      };
30351      if (element.hasRevenue()) {
30352        composeCodeableConcept("revenue", element.getRevenue());
30353      }
30354      if (element.hasCategory()) {
30355        composeCodeableConcept("category", element.getCategory());
30356      }
30357      if (element.hasService()) {
30358        composeCodeableConcept("service", element.getService());
30359      }
30360      if (element.hasModifier()) {
30361        openArray("modifier");
30362        for (CodeableConcept e : element.getModifier()) 
30363          composeCodeableConcept(null, e);
30364        closeArray();
30365      };
30366      if (element.hasProgramCode()) {
30367        openArray("programCode");
30368        for (CodeableConcept e : element.getProgramCode()) 
30369          composeCodeableConcept(null, e);
30370        closeArray();
30371      };
30372      if (element.hasServiced()) {
30373        composeType("serviced", element.getServiced());
30374      }
30375      if (element.hasLocation()) {
30376        composeType("location", element.getLocation());
30377      }
30378      if (element.hasQuantity()) {
30379        composeSimpleQuantity("quantity", element.getQuantity());
30380      }
30381      if (element.hasUnitPrice()) {
30382        composeMoney("unitPrice", element.getUnitPrice());
30383      }
30384      if (element.hasFactorElement()) {
30385        composeDecimalCore("factor", element.getFactorElement(), false);
30386        composeDecimalExtras("factor", element.getFactorElement(), false);
30387      }
30388      if (element.hasNet()) {
30389        composeMoney("net", element.getNet());
30390      }
30391      if (element.hasUdi()) {
30392        openArray("udi");
30393        for (Reference e : element.getUdi()) 
30394          composeReference(null, e);
30395        closeArray();
30396      };
30397      if (element.hasBodySite()) {
30398        composeCodeableConcept("bodySite", element.getBodySite());
30399      }
30400      if (element.hasSubSite()) {
30401        openArray("subSite");
30402        for (CodeableConcept e : element.getSubSite()) 
30403          composeCodeableConcept(null, e);
30404        closeArray();
30405      };
30406      if (element.hasEncounter()) {
30407        openArray("encounter");
30408        for (Reference e : element.getEncounter()) 
30409          composeReference(null, e);
30410        closeArray();
30411      };
30412      if (element.hasNoteNumber()) {
30413        openArray("noteNumber");
30414        for (PositiveIntType e : element.getNoteNumber()) 
30415          composePositiveIntCore(null, e, true);
30416        closeArray();
30417        if (anyHasExtras(element.getNoteNumber())) {
30418          openArray("_noteNumber");
30419          for (PositiveIntType e : element.getNoteNumber()) 
30420            composePositiveIntExtras(null, e, true);
30421          closeArray();
30422        }
30423      };
30424      if (element.hasAdjudication()) {
30425        openArray("adjudication");
30426        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30427          composeExplanationOfBenefitAdjudicationComponent(null, e);
30428        closeArray();
30429      };
30430      if (element.hasDetail()) {
30431        openArray("detail");
30432        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
30433          composeExplanationOfBenefitDetailComponent(null, e);
30434        closeArray();
30435      };
30436  }
30437
30438  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30439    if (element != null) {
30440      open(name);
30441      composeExplanationOfBenefitAdjudicationComponentInner(element);
30442      close();
30443    }
30444  }
30445
30446  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
30447      composeBackbone(element);
30448      if (element.hasCategory()) {
30449        composeCodeableConcept("category", element.getCategory());
30450      }
30451      if (element.hasReason()) {
30452        composeCodeableConcept("reason", element.getReason());
30453      }
30454      if (element.hasAmount()) {
30455        composeMoney("amount", element.getAmount());
30456      }
30457      if (element.hasValueElement()) {
30458        composeDecimalCore("value", element.getValueElement(), false);
30459        composeDecimalExtras("value", element.getValueElement(), false);
30460      }
30461  }
30462
30463  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
30464    if (element != null) {
30465      open(name);
30466      composeExplanationOfBenefitDetailComponentInner(element);
30467      close();
30468    }
30469  }
30470
30471  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
30472      composeBackbone(element);
30473      if (element.hasSequenceElement()) {
30474        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30475        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30476      }
30477      if (element.hasType()) {
30478        composeCodeableConcept("type", element.getType());
30479      }
30480      if (element.hasRevenue()) {
30481        composeCodeableConcept("revenue", element.getRevenue());
30482      }
30483      if (element.hasCategory()) {
30484        composeCodeableConcept("category", element.getCategory());
30485      }
30486      if (element.hasService()) {
30487        composeCodeableConcept("service", element.getService());
30488      }
30489      if (element.hasModifier()) {
30490        openArray("modifier");
30491        for (CodeableConcept e : element.getModifier()) 
30492          composeCodeableConcept(null, e);
30493        closeArray();
30494      };
30495      if (element.hasProgramCode()) {
30496        openArray("programCode");
30497        for (CodeableConcept e : element.getProgramCode()) 
30498          composeCodeableConcept(null, e);
30499        closeArray();
30500      };
30501      if (element.hasQuantity()) {
30502        composeSimpleQuantity("quantity", element.getQuantity());
30503      }
30504      if (element.hasUnitPrice()) {
30505        composeMoney("unitPrice", element.getUnitPrice());
30506      }
30507      if (element.hasFactorElement()) {
30508        composeDecimalCore("factor", element.getFactorElement(), false);
30509        composeDecimalExtras("factor", element.getFactorElement(), false);
30510      }
30511      if (element.hasNet()) {
30512        composeMoney("net", element.getNet());
30513      }
30514      if (element.hasUdi()) {
30515        openArray("udi");
30516        for (Reference e : element.getUdi()) 
30517          composeReference(null, e);
30518        closeArray();
30519      };
30520      if (element.hasNoteNumber()) {
30521        openArray("noteNumber");
30522        for (PositiveIntType e : element.getNoteNumber()) 
30523          composePositiveIntCore(null, e, true);
30524        closeArray();
30525        if (anyHasExtras(element.getNoteNumber())) {
30526          openArray("_noteNumber");
30527          for (PositiveIntType e : element.getNoteNumber()) 
30528            composePositiveIntExtras(null, e, true);
30529          closeArray();
30530        }
30531      };
30532      if (element.hasAdjudication()) {
30533        openArray("adjudication");
30534        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30535          composeExplanationOfBenefitAdjudicationComponent(null, e);
30536        closeArray();
30537      };
30538      if (element.hasSubDetail()) {
30539        openArray("subDetail");
30540        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
30541          composeExplanationOfBenefitSubDetailComponent(null, e);
30542        closeArray();
30543      };
30544  }
30545
30546  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30547    if (element != null) {
30548      open(name);
30549      composeExplanationOfBenefitSubDetailComponentInner(element);
30550      close();
30551    }
30552  }
30553
30554  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
30555      composeBackbone(element);
30556      if (element.hasSequenceElement()) {
30557        composePositiveIntCore("sequence", element.getSequenceElement(), false);
30558        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
30559      }
30560      if (element.hasType()) {
30561        composeCodeableConcept("type", element.getType());
30562      }
30563      if (element.hasRevenue()) {
30564        composeCodeableConcept("revenue", element.getRevenue());
30565      }
30566      if (element.hasCategory()) {
30567        composeCodeableConcept("category", element.getCategory());
30568      }
30569      if (element.hasService()) {
30570        composeCodeableConcept("service", element.getService());
30571      }
30572      if (element.hasModifier()) {
30573        openArray("modifier");
30574        for (CodeableConcept e : element.getModifier()) 
30575          composeCodeableConcept(null, e);
30576        closeArray();
30577      };
30578      if (element.hasProgramCode()) {
30579        openArray("programCode");
30580        for (CodeableConcept e : element.getProgramCode()) 
30581          composeCodeableConcept(null, e);
30582        closeArray();
30583      };
30584      if (element.hasQuantity()) {
30585        composeSimpleQuantity("quantity", element.getQuantity());
30586      }
30587      if (element.hasUnitPrice()) {
30588        composeMoney("unitPrice", element.getUnitPrice());
30589      }
30590      if (element.hasFactorElement()) {
30591        composeDecimalCore("factor", element.getFactorElement(), false);
30592        composeDecimalExtras("factor", element.getFactorElement(), false);
30593      }
30594      if (element.hasNet()) {
30595        composeMoney("net", element.getNet());
30596      }
30597      if (element.hasUdi()) {
30598        openArray("udi");
30599        for (Reference e : element.getUdi()) 
30600          composeReference(null, e);
30601        closeArray();
30602      };
30603      if (element.hasNoteNumber()) {
30604        openArray("noteNumber");
30605        for (PositiveIntType e : element.getNoteNumber()) 
30606          composePositiveIntCore(null, e, true);
30607        closeArray();
30608        if (anyHasExtras(element.getNoteNumber())) {
30609          openArray("_noteNumber");
30610          for (PositiveIntType e : element.getNoteNumber()) 
30611            composePositiveIntExtras(null, e, true);
30612          closeArray();
30613        }
30614      };
30615      if (element.hasAdjudication()) {
30616        openArray("adjudication");
30617        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30618          composeExplanationOfBenefitAdjudicationComponent(null, e);
30619        closeArray();
30620      };
30621  }
30622
30623  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30624    if (element != null) {
30625      open(name);
30626      composeExplanationOfBenefitAddedItemComponentInner(element);
30627      close();
30628    }
30629  }
30630
30631  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
30632      composeBackbone(element);
30633      if (element.hasSequenceLinkId()) {
30634        openArray("sequenceLinkId");
30635        for (PositiveIntType e : element.getSequenceLinkId()) 
30636          composePositiveIntCore(null, e, true);
30637        closeArray();
30638        if (anyHasExtras(element.getSequenceLinkId())) {
30639          openArray("_sequenceLinkId");
30640          for (PositiveIntType e : element.getSequenceLinkId()) 
30641            composePositiveIntExtras(null, e, true);
30642          closeArray();
30643        }
30644      };
30645      if (element.hasRevenue()) {
30646        composeCodeableConcept("revenue", element.getRevenue());
30647      }
30648      if (element.hasCategory()) {
30649        composeCodeableConcept("category", element.getCategory());
30650      }
30651      if (element.hasService()) {
30652        composeCodeableConcept("service", element.getService());
30653      }
30654      if (element.hasModifier()) {
30655        openArray("modifier");
30656        for (CodeableConcept e : element.getModifier()) 
30657          composeCodeableConcept(null, e);
30658        closeArray();
30659      };
30660      if (element.hasFee()) {
30661        composeMoney("fee", element.getFee());
30662      }
30663      if (element.hasNoteNumber()) {
30664        openArray("noteNumber");
30665        for (PositiveIntType e : element.getNoteNumber()) 
30666          composePositiveIntCore(null, e, true);
30667        closeArray();
30668        if (anyHasExtras(element.getNoteNumber())) {
30669          openArray("_noteNumber");
30670          for (PositiveIntType e : element.getNoteNumber()) 
30671            composePositiveIntExtras(null, e, true);
30672          closeArray();
30673        }
30674      };
30675      if (element.hasAdjudication()) {
30676        openArray("adjudication");
30677        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30678          composeExplanationOfBenefitAdjudicationComponent(null, e);
30679        closeArray();
30680      };
30681      if (element.hasDetail()) {
30682        openArray("detail");
30683        for (ExplanationOfBenefit.AddedItemsDetailComponent e : element.getDetail()) 
30684          composeExplanationOfBenefitAddedItemsDetailComponent(null, e);
30685        closeArray();
30686      };
30687  }
30688
30689  protected void composeExplanationOfBenefitAddedItemsDetailComponent(String name, ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
30690    if (element != null) {
30691      open(name);
30692      composeExplanationOfBenefitAddedItemsDetailComponentInner(element);
30693      close();
30694    }
30695  }
30696
30697  protected void composeExplanationOfBenefitAddedItemsDetailComponentInner(ExplanationOfBenefit.AddedItemsDetailComponent element) throws IOException {
30698      composeBackbone(element);
30699      if (element.hasRevenue()) {
30700        composeCodeableConcept("revenue", element.getRevenue());
30701      }
30702      if (element.hasCategory()) {
30703        composeCodeableConcept("category", element.getCategory());
30704      }
30705      if (element.hasService()) {
30706        composeCodeableConcept("service", element.getService());
30707      }
30708      if (element.hasModifier()) {
30709        openArray("modifier");
30710        for (CodeableConcept e : element.getModifier()) 
30711          composeCodeableConcept(null, e);
30712        closeArray();
30713      };
30714      if (element.hasFee()) {
30715        composeMoney("fee", element.getFee());
30716      }
30717      if (element.hasNoteNumber()) {
30718        openArray("noteNumber");
30719        for (PositiveIntType e : element.getNoteNumber()) 
30720          composePositiveIntCore(null, e, true);
30721        closeArray();
30722        if (anyHasExtras(element.getNoteNumber())) {
30723          openArray("_noteNumber");
30724          for (PositiveIntType e : element.getNoteNumber()) 
30725            composePositiveIntExtras(null, e, true);
30726          closeArray();
30727        }
30728      };
30729      if (element.hasAdjudication()) {
30730        openArray("adjudication");
30731        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
30732          composeExplanationOfBenefitAdjudicationComponent(null, e);
30733        closeArray();
30734      };
30735  }
30736
30737  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
30738    if (element != null) {
30739      open(name);
30740      composeExplanationOfBenefitPaymentComponentInner(element);
30741      close();
30742    }
30743  }
30744
30745  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
30746      composeBackbone(element);
30747      if (element.hasType()) {
30748        composeCodeableConcept("type", element.getType());
30749      }
30750      if (element.hasAdjustment()) {
30751        composeMoney("adjustment", element.getAdjustment());
30752      }
30753      if (element.hasAdjustmentReason()) {
30754        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
30755      }
30756      if (element.hasDateElement()) {
30757        composeDateCore("date", element.getDateElement(), false);
30758        composeDateExtras("date", element.getDateElement(), false);
30759      }
30760      if (element.hasAmount()) {
30761        composeMoney("amount", element.getAmount());
30762      }
30763      if (element.hasIdentifier()) {
30764        composeIdentifier("identifier", element.getIdentifier());
30765      }
30766  }
30767
30768  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
30769    if (element != null) {
30770      open(name);
30771      composeExplanationOfBenefitNoteComponentInner(element);
30772      close();
30773    }
30774  }
30775
30776  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
30777      composeBackbone(element);
30778      if (element.hasNumberElement()) {
30779        composePositiveIntCore("number", element.getNumberElement(), false);
30780        composePositiveIntExtras("number", element.getNumberElement(), false);
30781      }
30782      if (element.hasType()) {
30783        composeCodeableConcept("type", element.getType());
30784      }
30785      if (element.hasTextElement()) {
30786        composeStringCore("text", element.getTextElement(), false);
30787        composeStringExtras("text", element.getTextElement(), false);
30788      }
30789      if (element.hasLanguage()) {
30790        composeCodeableConcept("language", element.getLanguage());
30791      }
30792  }
30793
30794  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
30795    if (element != null) {
30796      open(name);
30797      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
30798      close();
30799    }
30800  }
30801
30802  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
30803      composeBackbone(element);
30804      if (element.hasCategory()) {
30805        composeCodeableConcept("category", element.getCategory());
30806      }
30807      if (element.hasSubCategory()) {
30808        composeCodeableConcept("subCategory", element.getSubCategory());
30809      }
30810      if (element.hasExcludedElement()) {
30811        composeBooleanCore("excluded", element.getExcludedElement(), false);
30812        composeBooleanExtras("excluded", element.getExcludedElement(), false);
30813      }
30814      if (element.hasNameElement()) {
30815        composeStringCore("name", element.getNameElement(), false);
30816        composeStringExtras("name", element.getNameElement(), false);
30817      }
30818      if (element.hasDescriptionElement()) {
30819        composeStringCore("description", element.getDescriptionElement(), false);
30820        composeStringExtras("description", element.getDescriptionElement(), false);
30821      }
30822      if (element.hasNetwork()) {
30823        composeCodeableConcept("network", element.getNetwork());
30824      }
30825      if (element.hasUnit()) {
30826        composeCodeableConcept("unit", element.getUnit());
30827      }
30828      if (element.hasTerm()) {
30829        composeCodeableConcept("term", element.getTerm());
30830      }
30831      if (element.hasFinancial()) {
30832        openArray("financial");
30833        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
30834          composeExplanationOfBenefitBenefitComponent(null, e);
30835        closeArray();
30836      };
30837  }
30838
30839  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
30840    if (element != null) {
30841      open(name);
30842      composeExplanationOfBenefitBenefitComponentInner(element);
30843      close();
30844    }
30845  }
30846
30847  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
30848      composeBackbone(element);
30849      if (element.hasType()) {
30850        composeCodeableConcept("type", element.getType());
30851      }
30852      if (element.hasAllowed()) {
30853        composeType("allowed", element.getAllowed());
30854      }
30855      if (element.hasUsed()) {
30856        composeType("used", element.getUsed());
30857      }
30858  }
30859
30860  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
30861    if (element != null) {
30862      prop("resourceType", name);
30863      composeFamilyMemberHistoryInner(element);
30864    }
30865  }
30866
30867  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
30868      composeDomainResourceElements(element);
30869      if (element.hasIdentifier()) {
30870        openArray("identifier");
30871        for (Identifier e : element.getIdentifier()) 
30872          composeIdentifier(null, e);
30873        closeArray();
30874      };
30875      if (element.hasDefinition()) {
30876        openArray("definition");
30877        for (Reference e : element.getDefinition()) 
30878          composeReference(null, e);
30879        closeArray();
30880      };
30881      if (element.hasStatusElement()) {
30882        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
30883        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
30884      }
30885      if (element.hasNotDoneElement()) {
30886        composeBooleanCore("notDone", element.getNotDoneElement(), false);
30887        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
30888      }
30889      if (element.hasNotDoneReason()) {
30890        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
30891      }
30892      if (element.hasPatient()) {
30893        composeReference("patient", element.getPatient());
30894      }
30895      if (element.hasDateElement()) {
30896        composeDateTimeCore("date", element.getDateElement(), false);
30897        composeDateTimeExtras("date", element.getDateElement(), false);
30898      }
30899      if (element.hasNameElement()) {
30900        composeStringCore("name", element.getNameElement(), false);
30901        composeStringExtras("name", element.getNameElement(), false);
30902      }
30903      if (element.hasRelationship()) {
30904        composeCodeableConcept("relationship", element.getRelationship());
30905      }
30906      if (element.hasGenderElement()) {
30907        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30908        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
30909      }
30910      if (element.hasBorn()) {
30911        composeType("born", element.getBorn());
30912      }
30913      if (element.hasAge()) {
30914        composeType("age", element.getAge());
30915      }
30916      if (element.hasEstimatedAgeElement()) {
30917        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
30918        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
30919      }
30920      if (element.hasDeceased()) {
30921        composeType("deceased", element.getDeceased());
30922      }
30923      if (element.hasReasonCode()) {
30924        openArray("reasonCode");
30925        for (CodeableConcept e : element.getReasonCode()) 
30926          composeCodeableConcept(null, e);
30927        closeArray();
30928      };
30929      if (element.hasReasonReference()) {
30930        openArray("reasonReference");
30931        for (Reference e : element.getReasonReference()) 
30932          composeReference(null, e);
30933        closeArray();
30934      };
30935      if (element.hasNote()) {
30936        openArray("note");
30937        for (Annotation e : element.getNote()) 
30938          composeAnnotation(null, e);
30939        closeArray();
30940      };
30941      if (element.hasCondition()) {
30942        openArray("condition");
30943        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
30944          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
30945        closeArray();
30946      };
30947  }
30948
30949  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
30950    if (element != null) {
30951      open(name);
30952      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
30953      close();
30954    }
30955  }
30956
30957  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
30958      composeBackbone(element);
30959      if (element.hasCode()) {
30960        composeCodeableConcept("code", element.getCode());
30961      }
30962      if (element.hasOutcome()) {
30963        composeCodeableConcept("outcome", element.getOutcome());
30964      }
30965      if (element.hasOnset()) {
30966        composeType("onset", element.getOnset());
30967      }
30968      if (element.hasNote()) {
30969        openArray("note");
30970        for (Annotation e : element.getNote()) 
30971          composeAnnotation(null, e);
30972        closeArray();
30973      };
30974  }
30975
30976  protected void composeFlag(String name, Flag element) throws IOException {
30977    if (element != null) {
30978      prop("resourceType", name);
30979      composeFlagInner(element);
30980    }
30981  }
30982
30983  protected void composeFlagInner(Flag element) throws IOException {
30984      composeDomainResourceElements(element);
30985      if (element.hasIdentifier()) {
30986        openArray("identifier");
30987        for (Identifier e : element.getIdentifier()) 
30988          composeIdentifier(null, e);
30989        closeArray();
30990      };
30991      if (element.hasStatusElement()) {
30992        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
30993        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
30994      }
30995      if (element.hasCategory()) {
30996        composeCodeableConcept("category", element.getCategory());
30997      }
30998      if (element.hasCode()) {
30999        composeCodeableConcept("code", element.getCode());
31000      }
31001      if (element.hasSubject()) {
31002        composeReference("subject", element.getSubject());
31003      }
31004      if (element.hasPeriod()) {
31005        composePeriod("period", element.getPeriod());
31006      }
31007      if (element.hasEncounter()) {
31008        composeReference("encounter", element.getEncounter());
31009      }
31010      if (element.hasAuthor()) {
31011        composeReference("author", element.getAuthor());
31012      }
31013  }
31014
31015  protected void composeGoal(String name, Goal element) throws IOException {
31016    if (element != null) {
31017      prop("resourceType", name);
31018      composeGoalInner(element);
31019    }
31020  }
31021
31022  protected void composeGoalInner(Goal element) throws IOException {
31023      composeDomainResourceElements(element);
31024      if (element.hasIdentifier()) {
31025        openArray("identifier");
31026        for (Identifier e : element.getIdentifier()) 
31027          composeIdentifier(null, e);
31028        closeArray();
31029      };
31030      if (element.hasStatusElement()) {
31031        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31032        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
31033      }
31034      if (element.hasCategory()) {
31035        openArray("category");
31036        for (CodeableConcept e : element.getCategory()) 
31037          composeCodeableConcept(null, e);
31038        closeArray();
31039      };
31040      if (element.hasPriority()) {
31041        composeCodeableConcept("priority", element.getPriority());
31042      }
31043      if (element.hasDescription()) {
31044        composeCodeableConcept("description", element.getDescription());
31045      }
31046      if (element.hasSubject()) {
31047        composeReference("subject", element.getSubject());
31048      }
31049      if (element.hasStart()) {
31050        composeType("start", element.getStart());
31051      }
31052      if (element.hasTarget()) {
31053        composeGoalGoalTargetComponent("target", element.getTarget());
31054      }
31055      if (element.hasStatusDateElement()) {
31056        composeDateCore("statusDate", element.getStatusDateElement(), false);
31057        composeDateExtras("statusDate", element.getStatusDateElement(), false);
31058      }
31059      if (element.hasStatusReasonElement()) {
31060        composeStringCore("statusReason", element.getStatusReasonElement(), false);
31061        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
31062      }
31063      if (element.hasExpressedBy()) {
31064        composeReference("expressedBy", element.getExpressedBy());
31065      }
31066      if (element.hasAddresses()) {
31067        openArray("addresses");
31068        for (Reference e : element.getAddresses()) 
31069          composeReference(null, e);
31070        closeArray();
31071      };
31072      if (element.hasNote()) {
31073        openArray("note");
31074        for (Annotation e : element.getNote()) 
31075          composeAnnotation(null, e);
31076        closeArray();
31077      };
31078      if (element.hasOutcomeCode()) {
31079        openArray("outcomeCode");
31080        for (CodeableConcept e : element.getOutcomeCode()) 
31081          composeCodeableConcept(null, e);
31082        closeArray();
31083      };
31084      if (element.hasOutcomeReference()) {
31085        openArray("outcomeReference");
31086        for (Reference e : element.getOutcomeReference()) 
31087          composeReference(null, e);
31088        closeArray();
31089      };
31090  }
31091
31092  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
31093    if (element != null) {
31094      open(name);
31095      composeGoalGoalTargetComponentInner(element);
31096      close();
31097    }
31098  }
31099
31100  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
31101      composeBackbone(element);
31102      if (element.hasMeasure()) {
31103        composeCodeableConcept("measure", element.getMeasure());
31104      }
31105      if (element.hasDetail()) {
31106        composeType("detail", element.getDetail());
31107      }
31108      if (element.hasDue()) {
31109        composeType("due", element.getDue());
31110      }
31111  }
31112
31113  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
31114    if (element != null) {
31115      prop("resourceType", name);
31116      composeGraphDefinitionInner(element);
31117    }
31118  }
31119
31120  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
31121      composeDomainResourceElements(element);
31122      if (element.hasUrlElement()) {
31123        composeUriCore("url", element.getUrlElement(), false);
31124        composeUriExtras("url", element.getUrlElement(), false);
31125      }
31126      if (element.hasVersionElement()) {
31127        composeStringCore("version", element.getVersionElement(), false);
31128        composeStringExtras("version", element.getVersionElement(), false);
31129      }
31130      if (element.hasNameElement()) {
31131        composeStringCore("name", element.getNameElement(), false);
31132        composeStringExtras("name", element.getNameElement(), false);
31133      }
31134      if (element.hasStatusElement()) {
31135        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31136        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31137      }
31138      if (element.hasExperimentalElement()) {
31139        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31140        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31141      }
31142      if (element.hasDateElement()) {
31143        composeDateTimeCore("date", element.getDateElement(), false);
31144        composeDateTimeExtras("date", element.getDateElement(), false);
31145      }
31146      if (element.hasPublisherElement()) {
31147        composeStringCore("publisher", element.getPublisherElement(), false);
31148        composeStringExtras("publisher", element.getPublisherElement(), false);
31149      }
31150      if (element.hasContact()) {
31151        openArray("contact");
31152        for (ContactDetail e : element.getContact()) 
31153          composeContactDetail(null, e);
31154        closeArray();
31155      };
31156      if (element.hasDescriptionElement()) {
31157        composeMarkdownCore("description", element.getDescriptionElement(), false);
31158        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31159      }
31160      if (element.hasUseContext()) {
31161        openArray("useContext");
31162        for (UsageContext e : element.getUseContext()) 
31163          composeUsageContext(null, e);
31164        closeArray();
31165      };
31166      if (element.hasJurisdiction()) {
31167        openArray("jurisdiction");
31168        for (CodeableConcept e : element.getJurisdiction()) 
31169          composeCodeableConcept(null, e);
31170        closeArray();
31171      };
31172      if (element.hasPurposeElement()) {
31173        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31174        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31175      }
31176      if (element.hasStartElement()) {
31177        composeCodeCore("start", element.getStartElement(), false);
31178        composeCodeExtras("start", element.getStartElement(), false);
31179      }
31180      if (element.hasProfileElement()) {
31181        composeUriCore("profile", element.getProfileElement(), false);
31182        composeUriExtras("profile", element.getProfileElement(), false);
31183      }
31184      if (element.hasLink()) {
31185        openArray("link");
31186        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31187          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31188        closeArray();
31189      };
31190  }
31191
31192  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31193    if (element != null) {
31194      open(name);
31195      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
31196      close();
31197    }
31198  }
31199
31200  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
31201      composeBackbone(element);
31202      if (element.hasPathElement()) {
31203        composeStringCore("path", element.getPathElement(), false);
31204        composeStringExtras("path", element.getPathElement(), false);
31205      }
31206      if (element.hasSliceNameElement()) {
31207        composeStringCore("sliceName", element.getSliceNameElement(), false);
31208        composeStringExtras("sliceName", element.getSliceNameElement(), false);
31209      }
31210      if (element.hasMinElement()) {
31211        composeIntegerCore("min", element.getMinElement(), false);
31212        composeIntegerExtras("min", element.getMinElement(), false);
31213      }
31214      if (element.hasMaxElement()) {
31215        composeStringCore("max", element.getMaxElement(), false);
31216        composeStringExtras("max", element.getMaxElement(), false);
31217      }
31218      if (element.hasDescriptionElement()) {
31219        composeStringCore("description", element.getDescriptionElement(), false);
31220        composeStringExtras("description", element.getDescriptionElement(), false);
31221      }
31222      if (element.hasTarget()) {
31223        openArray("target");
31224        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
31225          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
31226        closeArray();
31227      };
31228  }
31229
31230  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31231    if (element != null) {
31232      open(name);
31233      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
31234      close();
31235    }
31236  }
31237
31238  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
31239      composeBackbone(element);
31240      if (element.hasTypeElement()) {
31241        composeCodeCore("type", element.getTypeElement(), false);
31242        composeCodeExtras("type", element.getTypeElement(), false);
31243      }
31244      if (element.hasProfileElement()) {
31245        composeUriCore("profile", element.getProfileElement(), false);
31246        composeUriExtras("profile", element.getProfileElement(), false);
31247      }
31248      if (element.hasCompartment()) {
31249        openArray("compartment");
31250        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
31251          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
31252        closeArray();
31253      };
31254      if (element.hasLink()) {
31255        openArray("link");
31256        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
31257          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
31258        closeArray();
31259      };
31260  }
31261
31262  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31263    if (element != null) {
31264      open(name);
31265      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
31266      close();
31267    }
31268  }
31269
31270  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
31271      composeBackbone(element);
31272      if (element.hasCodeElement()) {
31273        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31274        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
31275      }
31276      if (element.hasRuleElement()) {
31277        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31278        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
31279      }
31280      if (element.hasExpressionElement()) {
31281        composeStringCore("expression", element.getExpressionElement(), false);
31282        composeStringExtras("expression", element.getExpressionElement(), false);
31283      }
31284      if (element.hasDescriptionElement()) {
31285        composeStringCore("description", element.getDescriptionElement(), false);
31286        composeStringExtras("description", element.getDescriptionElement(), false);
31287      }
31288  }
31289
31290  protected void composeGroup(String name, Group element) throws IOException {
31291    if (element != null) {
31292      prop("resourceType", name);
31293      composeGroupInner(element);
31294    }
31295  }
31296
31297  protected void composeGroupInner(Group element) throws IOException {
31298      composeDomainResourceElements(element);
31299      if (element.hasIdentifier()) {
31300        openArray("identifier");
31301        for (Identifier e : element.getIdentifier()) 
31302          composeIdentifier(null, e);
31303        closeArray();
31304      };
31305      if (element.hasActiveElement()) {
31306        composeBooleanCore("active", element.getActiveElement(), false);
31307        composeBooleanExtras("active", element.getActiveElement(), false);
31308      }
31309      if (element.hasTypeElement()) {
31310        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31311        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
31312      }
31313      if (element.hasActualElement()) {
31314        composeBooleanCore("actual", element.getActualElement(), false);
31315        composeBooleanExtras("actual", element.getActualElement(), false);
31316      }
31317      if (element.hasCode()) {
31318        composeCodeableConcept("code", element.getCode());
31319      }
31320      if (element.hasNameElement()) {
31321        composeStringCore("name", element.getNameElement(), false);
31322        composeStringExtras("name", element.getNameElement(), false);
31323      }
31324      if (element.hasQuantityElement()) {
31325        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
31326        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
31327      }
31328      if (element.hasCharacteristic()) {
31329        openArray("characteristic");
31330        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
31331          composeGroupGroupCharacteristicComponent(null, e);
31332        closeArray();
31333      };
31334      if (element.hasMember()) {
31335        openArray("member");
31336        for (Group.GroupMemberComponent e : element.getMember()) 
31337          composeGroupGroupMemberComponent(null, e);
31338        closeArray();
31339      };
31340  }
31341
31342  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
31343    if (element != null) {
31344      open(name);
31345      composeGroupGroupCharacteristicComponentInner(element);
31346      close();
31347    }
31348  }
31349
31350  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
31351      composeBackbone(element);
31352      if (element.hasCode()) {
31353        composeCodeableConcept("code", element.getCode());
31354      }
31355      if (element.hasValue()) {
31356        composeType("value", element.getValue());
31357      }
31358      if (element.hasExcludeElement()) {
31359        composeBooleanCore("exclude", element.getExcludeElement(), false);
31360        composeBooleanExtras("exclude", element.getExcludeElement(), false);
31361      }
31362      if (element.hasPeriod()) {
31363        composePeriod("period", element.getPeriod());
31364      }
31365  }
31366
31367  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
31368    if (element != null) {
31369      open(name);
31370      composeGroupGroupMemberComponentInner(element);
31371      close();
31372    }
31373  }
31374
31375  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
31376      composeBackbone(element);
31377      if (element.hasEntity()) {
31378        composeReference("entity", element.getEntity());
31379      }
31380      if (element.hasPeriod()) {
31381        composePeriod("period", element.getPeriod());
31382      }
31383      if (element.hasInactiveElement()) {
31384        composeBooleanCore("inactive", element.getInactiveElement(), false);
31385        composeBooleanExtras("inactive", element.getInactiveElement(), false);
31386      }
31387  }
31388
31389  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
31390    if (element != null) {
31391      prop("resourceType", name);
31392      composeGuidanceResponseInner(element);
31393    }
31394  }
31395
31396  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
31397      composeDomainResourceElements(element);
31398      if (element.hasRequestIdElement()) {
31399        composeIdCore("requestId", element.getRequestIdElement(), false);
31400        composeIdExtras("requestId", element.getRequestIdElement(), false);
31401      }
31402      if (element.hasIdentifier()) {
31403        composeIdentifier("identifier", element.getIdentifier());
31404      }
31405      if (element.hasModule()) {
31406        composeReference("module", element.getModule());
31407      }
31408      if (element.hasStatusElement()) {
31409        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31410        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
31411      }
31412      if (element.hasSubject()) {
31413        composeReference("subject", element.getSubject());
31414      }
31415      if (element.hasContext()) {
31416        composeReference("context", element.getContext());
31417      }
31418      if (element.hasOccurrenceDateTimeElement()) {
31419        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31420        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
31421      }
31422      if (element.hasPerformer()) {
31423        composeReference("performer", element.getPerformer());
31424      }
31425      if (element.hasReason()) {
31426        composeType("reason", element.getReason());
31427      }
31428      if (element.hasNote()) {
31429        openArray("note");
31430        for (Annotation e : element.getNote()) 
31431          composeAnnotation(null, e);
31432        closeArray();
31433      };
31434      if (element.hasEvaluationMessage()) {
31435        openArray("evaluationMessage");
31436        for (Reference e : element.getEvaluationMessage()) 
31437          composeReference(null, e);
31438        closeArray();
31439      };
31440      if (element.hasOutputParameters()) {
31441        composeReference("outputParameters", element.getOutputParameters());
31442      }
31443      if (element.hasResult()) {
31444        composeReference("result", element.getResult());
31445      }
31446      if (element.hasDataRequirement()) {
31447        openArray("dataRequirement");
31448        for (DataRequirement e : element.getDataRequirement()) 
31449          composeDataRequirement(null, e);
31450        closeArray();
31451      };
31452  }
31453
31454  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
31455    if (element != null) {
31456      prop("resourceType", name);
31457      composeHealthcareServiceInner(element);
31458    }
31459  }
31460
31461  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
31462      composeDomainResourceElements(element);
31463      if (element.hasIdentifier()) {
31464        openArray("identifier");
31465        for (Identifier e : element.getIdentifier()) 
31466          composeIdentifier(null, e);
31467        closeArray();
31468      };
31469      if (element.hasActiveElement()) {
31470        composeBooleanCore("active", element.getActiveElement(), false);
31471        composeBooleanExtras("active", element.getActiveElement(), false);
31472      }
31473      if (element.hasProvidedBy()) {
31474        composeReference("providedBy", element.getProvidedBy());
31475      }
31476      if (element.hasCategory()) {
31477        composeCodeableConcept("category", element.getCategory());
31478      }
31479      if (element.hasType()) {
31480        openArray("type");
31481        for (CodeableConcept e : element.getType()) 
31482          composeCodeableConcept(null, e);
31483        closeArray();
31484      };
31485      if (element.hasSpecialty()) {
31486        openArray("specialty");
31487        for (CodeableConcept e : element.getSpecialty()) 
31488          composeCodeableConcept(null, e);
31489        closeArray();
31490      };
31491      if (element.hasLocation()) {
31492        openArray("location");
31493        for (Reference e : element.getLocation()) 
31494          composeReference(null, e);
31495        closeArray();
31496      };
31497      if (element.hasNameElement()) {
31498        composeStringCore("name", element.getNameElement(), false);
31499        composeStringExtras("name", element.getNameElement(), false);
31500      }
31501      if (element.hasCommentElement()) {
31502        composeStringCore("comment", element.getCommentElement(), false);
31503        composeStringExtras("comment", element.getCommentElement(), false);
31504      }
31505      if (element.hasExtraDetailsElement()) {
31506        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
31507        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
31508      }
31509      if (element.hasPhoto()) {
31510        composeAttachment("photo", element.getPhoto());
31511      }
31512      if (element.hasTelecom()) {
31513        openArray("telecom");
31514        for (ContactPoint e : element.getTelecom()) 
31515          composeContactPoint(null, e);
31516        closeArray();
31517      };
31518      if (element.hasCoverageArea()) {
31519        openArray("coverageArea");
31520        for (Reference e : element.getCoverageArea()) 
31521          composeReference(null, e);
31522        closeArray();
31523      };
31524      if (element.hasServiceProvisionCode()) {
31525        openArray("serviceProvisionCode");
31526        for (CodeableConcept e : element.getServiceProvisionCode()) 
31527          composeCodeableConcept(null, e);
31528        closeArray();
31529      };
31530      if (element.hasEligibility()) {
31531        composeCodeableConcept("eligibility", element.getEligibility());
31532      }
31533      if (element.hasEligibilityNoteElement()) {
31534        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
31535        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
31536      }
31537      if (element.hasProgramName()) {
31538        openArray("programName");
31539        for (StringType e : element.getProgramName()) 
31540          composeStringCore(null, e, true);
31541        closeArray();
31542        if (anyHasExtras(element.getProgramName())) {
31543          openArray("_programName");
31544          for (StringType e : element.getProgramName()) 
31545            composeStringExtras(null, e, true);
31546          closeArray();
31547        }
31548      };
31549      if (element.hasCharacteristic()) {
31550        openArray("characteristic");
31551        for (CodeableConcept e : element.getCharacteristic()) 
31552          composeCodeableConcept(null, e);
31553        closeArray();
31554      };
31555      if (element.hasReferralMethod()) {
31556        openArray("referralMethod");
31557        for (CodeableConcept e : element.getReferralMethod()) 
31558          composeCodeableConcept(null, e);
31559        closeArray();
31560      };
31561      if (element.hasAppointmentRequiredElement()) {
31562        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
31563        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
31564      }
31565      if (element.hasAvailableTime()) {
31566        openArray("availableTime");
31567        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
31568          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
31569        closeArray();
31570      };
31571      if (element.hasNotAvailable()) {
31572        openArray("notAvailable");
31573        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
31574          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
31575        closeArray();
31576      };
31577      if (element.hasAvailabilityExceptionsElement()) {
31578        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31579        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
31580      }
31581      if (element.hasEndpoint()) {
31582        openArray("endpoint");
31583        for (Reference e : element.getEndpoint()) 
31584          composeReference(null, e);
31585        closeArray();
31586      };
31587  }
31588
31589  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31590    if (element != null) {
31591      open(name);
31592      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
31593      close();
31594    }
31595  }
31596
31597  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
31598      composeBackbone(element);
31599      if (element.hasDaysOfWeek()) {
31600        openArray("daysOfWeek");
31601        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31602          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31603        closeArray();
31604        if (anyHasExtras(element.getDaysOfWeek())) {
31605          openArray("_daysOfWeek");
31606          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
31607            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
31608          closeArray();
31609        }
31610      };
31611      if (element.hasAllDayElement()) {
31612        composeBooleanCore("allDay", element.getAllDayElement(), false);
31613        composeBooleanExtras("allDay", element.getAllDayElement(), false);
31614      }
31615      if (element.hasAvailableStartTimeElement()) {
31616        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
31617        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
31618      }
31619      if (element.hasAvailableEndTimeElement()) {
31620        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
31621        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
31622      }
31623  }
31624
31625  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31626    if (element != null) {
31627      open(name);
31628      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
31629      close();
31630    }
31631  }
31632
31633  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
31634      composeBackbone(element);
31635      if (element.hasDescriptionElement()) {
31636        composeStringCore("description", element.getDescriptionElement(), false);
31637        composeStringExtras("description", element.getDescriptionElement(), false);
31638      }
31639      if (element.hasDuring()) {
31640        composePeriod("during", element.getDuring());
31641      }
31642  }
31643
31644  protected void composeImagingManifest(String name, ImagingManifest element) throws IOException {
31645    if (element != null) {
31646      prop("resourceType", name);
31647      composeImagingManifestInner(element);
31648    }
31649  }
31650
31651  protected void composeImagingManifestInner(ImagingManifest element) throws IOException {
31652      composeDomainResourceElements(element);
31653      if (element.hasIdentifier()) {
31654        composeIdentifier("identifier", element.getIdentifier());
31655      }
31656      if (element.hasPatient()) {
31657        composeReference("patient", element.getPatient());
31658      }
31659      if (element.hasAuthoringTimeElement()) {
31660        composeDateTimeCore("authoringTime", element.getAuthoringTimeElement(), false);
31661        composeDateTimeExtras("authoringTime", element.getAuthoringTimeElement(), false);
31662      }
31663      if (element.hasAuthor()) {
31664        composeReference("author", element.getAuthor());
31665      }
31666      if (element.hasDescriptionElement()) {
31667        composeStringCore("description", element.getDescriptionElement(), false);
31668        composeStringExtras("description", element.getDescriptionElement(), false);
31669      }
31670      if (element.hasStudy()) {
31671        openArray("study");
31672        for (ImagingManifest.StudyComponent e : element.getStudy()) 
31673          composeImagingManifestStudyComponent(null, e);
31674        closeArray();
31675      };
31676  }
31677
31678  protected void composeImagingManifestStudyComponent(String name, ImagingManifest.StudyComponent element) throws IOException {
31679    if (element != null) {
31680      open(name);
31681      composeImagingManifestStudyComponentInner(element);
31682      close();
31683    }
31684  }
31685
31686  protected void composeImagingManifestStudyComponentInner(ImagingManifest.StudyComponent element) throws IOException {
31687      composeBackbone(element);
31688      if (element.hasUidElement()) {
31689        composeOidCore("uid", element.getUidElement(), false);
31690        composeOidExtras("uid", element.getUidElement(), false);
31691      }
31692      if (element.hasImagingStudy()) {
31693        composeReference("imagingStudy", element.getImagingStudy());
31694      }
31695      if (element.hasEndpoint()) {
31696        openArray("endpoint");
31697        for (Reference e : element.getEndpoint()) 
31698          composeReference(null, e);
31699        closeArray();
31700      };
31701      if (element.hasSeries()) {
31702        openArray("series");
31703        for (ImagingManifest.SeriesComponent e : element.getSeries()) 
31704          composeImagingManifestSeriesComponent(null, e);
31705        closeArray();
31706      };
31707  }
31708
31709  protected void composeImagingManifestSeriesComponent(String name, ImagingManifest.SeriesComponent element) throws IOException {
31710    if (element != null) {
31711      open(name);
31712      composeImagingManifestSeriesComponentInner(element);
31713      close();
31714    }
31715  }
31716
31717  protected void composeImagingManifestSeriesComponentInner(ImagingManifest.SeriesComponent element) throws IOException {
31718      composeBackbone(element);
31719      if (element.hasUidElement()) {
31720        composeOidCore("uid", element.getUidElement(), false);
31721        composeOidExtras("uid", element.getUidElement(), false);
31722      }
31723      if (element.hasEndpoint()) {
31724        openArray("endpoint");
31725        for (Reference e : element.getEndpoint()) 
31726          composeReference(null, e);
31727        closeArray();
31728      };
31729      if (element.hasInstance()) {
31730        openArray("instance");
31731        for (ImagingManifest.InstanceComponent e : element.getInstance()) 
31732          composeImagingManifestInstanceComponent(null, e);
31733        closeArray();
31734      };
31735  }
31736
31737  protected void composeImagingManifestInstanceComponent(String name, ImagingManifest.InstanceComponent element) throws IOException {
31738    if (element != null) {
31739      open(name);
31740      composeImagingManifestInstanceComponentInner(element);
31741      close();
31742    }
31743  }
31744
31745  protected void composeImagingManifestInstanceComponentInner(ImagingManifest.InstanceComponent element) throws IOException {
31746      composeBackbone(element);
31747      if (element.hasSopClassElement()) {
31748        composeOidCore("sopClass", element.getSopClassElement(), false);
31749        composeOidExtras("sopClass", element.getSopClassElement(), false);
31750      }
31751      if (element.hasUidElement()) {
31752        composeOidCore("uid", element.getUidElement(), false);
31753        composeOidExtras("uid", element.getUidElement(), false);
31754      }
31755  }
31756
31757  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
31758    if (element != null) {
31759      prop("resourceType", name);
31760      composeImagingStudyInner(element);
31761    }
31762  }
31763
31764  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
31765      composeDomainResourceElements(element);
31766      if (element.hasUidElement()) {
31767        composeOidCore("uid", element.getUidElement(), false);
31768        composeOidExtras("uid", element.getUidElement(), false);
31769      }
31770      if (element.hasAccession()) {
31771        composeIdentifier("accession", element.getAccession());
31772      }
31773      if (element.hasIdentifier()) {
31774        openArray("identifier");
31775        for (Identifier e : element.getIdentifier()) 
31776          composeIdentifier(null, e);
31777        closeArray();
31778      };
31779      if (element.hasAvailabilityElement()) {
31780        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31781        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31782      }
31783      if (element.hasModalityList()) {
31784        openArray("modalityList");
31785        for (Coding e : element.getModalityList()) 
31786          composeCoding(null, e);
31787        closeArray();
31788      };
31789      if (element.hasPatient()) {
31790        composeReference("patient", element.getPatient());
31791      }
31792      if (element.hasContext()) {
31793        composeReference("context", element.getContext());
31794      }
31795      if (element.hasStartedElement()) {
31796        composeDateTimeCore("started", element.getStartedElement(), false);
31797        composeDateTimeExtras("started", element.getStartedElement(), false);
31798      }
31799      if (element.hasBasedOn()) {
31800        openArray("basedOn");
31801        for (Reference e : element.getBasedOn()) 
31802          composeReference(null, e);
31803        closeArray();
31804      };
31805      if (element.hasReferrer()) {
31806        composeReference("referrer", element.getReferrer());
31807      }
31808      if (element.hasInterpreter()) {
31809        openArray("interpreter");
31810        for (Reference e : element.getInterpreter()) 
31811          composeReference(null, e);
31812        closeArray();
31813      };
31814      if (element.hasEndpoint()) {
31815        openArray("endpoint");
31816        for (Reference e : element.getEndpoint()) 
31817          composeReference(null, e);
31818        closeArray();
31819      };
31820      if (element.hasNumberOfSeriesElement()) {
31821        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
31822        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
31823      }
31824      if (element.hasNumberOfInstancesElement()) {
31825        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
31826        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
31827      }
31828      if (element.hasProcedureReference()) {
31829        openArray("procedureReference");
31830        for (Reference e : element.getProcedureReference()) 
31831          composeReference(null, e);
31832        closeArray();
31833      };
31834      if (element.hasProcedureCode()) {
31835        openArray("procedureCode");
31836        for (CodeableConcept e : element.getProcedureCode()) 
31837          composeCodeableConcept(null, e);
31838        closeArray();
31839      };
31840      if (element.hasReason()) {
31841        composeCodeableConcept("reason", element.getReason());
31842      }
31843      if (element.hasDescriptionElement()) {
31844        composeStringCore("description", element.getDescriptionElement(), false);
31845        composeStringExtras("description", element.getDescriptionElement(), false);
31846      }
31847      if (element.hasSeries()) {
31848        openArray("series");
31849        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
31850          composeImagingStudyImagingStudySeriesComponent(null, e);
31851        closeArray();
31852      };
31853  }
31854
31855  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
31856    if (element != null) {
31857      open(name);
31858      composeImagingStudyImagingStudySeriesComponentInner(element);
31859      close();
31860    }
31861  }
31862
31863  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
31864      composeBackbone(element);
31865      if (element.hasUidElement()) {
31866        composeOidCore("uid", element.getUidElement(), false);
31867        composeOidExtras("uid", element.getUidElement(), false);
31868      }
31869      if (element.hasNumberElement()) {
31870        composeUnsignedIntCore("number", element.getNumberElement(), false);
31871        composeUnsignedIntExtras("number", element.getNumberElement(), false);
31872      }
31873      if (element.hasModality()) {
31874        composeCoding("modality", element.getModality());
31875      }
31876      if (element.hasDescriptionElement()) {
31877        composeStringCore("description", element.getDescriptionElement(), false);
31878        composeStringExtras("description", element.getDescriptionElement(), false);
31879      }
31880      if (element.hasNumberOfInstancesElement()) {
31881        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
31882        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
31883      }
31884      if (element.hasAvailabilityElement()) {
31885        composeEnumerationCore("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31886        composeEnumerationExtras("availability", element.getAvailabilityElement(), new ImagingStudy.InstanceAvailabilityEnumFactory(), false);
31887      }
31888      if (element.hasEndpoint()) {
31889        openArray("endpoint");
31890        for (Reference e : element.getEndpoint()) 
31891          composeReference(null, e);
31892        closeArray();
31893      };
31894      if (element.hasBodySite()) {
31895        composeCoding("bodySite", element.getBodySite());
31896      }
31897      if (element.hasLaterality()) {
31898        composeCoding("laterality", element.getLaterality());
31899      }
31900      if (element.hasStartedElement()) {
31901        composeDateTimeCore("started", element.getStartedElement(), false);
31902        composeDateTimeExtras("started", element.getStartedElement(), false);
31903      }
31904      if (element.hasPerformer()) {
31905        openArray("performer");
31906        for (Reference e : element.getPerformer()) 
31907          composeReference(null, e);
31908        closeArray();
31909      };
31910      if (element.hasInstance()) {
31911        openArray("instance");
31912        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
31913          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
31914        closeArray();
31915      };
31916  }
31917
31918  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
31919    if (element != null) {
31920      open(name);
31921      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
31922      close();
31923    }
31924  }
31925
31926  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
31927      composeBackbone(element);
31928      if (element.hasUidElement()) {
31929        composeOidCore("uid", element.getUidElement(), false);
31930        composeOidExtras("uid", element.getUidElement(), false);
31931      }
31932      if (element.hasNumberElement()) {
31933        composeUnsignedIntCore("number", element.getNumberElement(), false);
31934        composeUnsignedIntExtras("number", element.getNumberElement(), false);
31935      }
31936      if (element.hasSopClassElement()) {
31937        composeOidCore("sopClass", element.getSopClassElement(), false);
31938        composeOidExtras("sopClass", element.getSopClassElement(), false);
31939      }
31940      if (element.hasTitleElement()) {
31941        composeStringCore("title", element.getTitleElement(), false);
31942        composeStringExtras("title", element.getTitleElement(), false);
31943      }
31944  }
31945
31946  protected void composeImmunization(String name, Immunization element) throws IOException {
31947    if (element != null) {
31948      prop("resourceType", name);
31949      composeImmunizationInner(element);
31950    }
31951  }
31952
31953  protected void composeImmunizationInner(Immunization element) throws IOException {
31954      composeDomainResourceElements(element);
31955      if (element.hasIdentifier()) {
31956        openArray("identifier");
31957        for (Identifier e : element.getIdentifier()) 
31958          composeIdentifier(null, e);
31959        closeArray();
31960      };
31961      if (element.hasStatusElement()) {
31962        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
31963        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
31964      }
31965      if (element.hasNotGivenElement()) {
31966        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
31967        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
31968      }
31969      if (element.hasVaccineCode()) {
31970        composeCodeableConcept("vaccineCode", element.getVaccineCode());
31971      }
31972      if (element.hasPatient()) {
31973        composeReference("patient", element.getPatient());
31974      }
31975      if (element.hasEncounter()) {
31976        composeReference("encounter", element.getEncounter());
31977      }
31978      if (element.hasDateElement()) {
31979        composeDateTimeCore("date", element.getDateElement(), false);
31980        composeDateTimeExtras("date", element.getDateElement(), false);
31981      }
31982      if (element.hasPrimarySourceElement()) {
31983        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
31984        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
31985      }
31986      if (element.hasReportOrigin()) {
31987        composeCodeableConcept("reportOrigin", element.getReportOrigin());
31988      }
31989      if (element.hasLocation()) {
31990        composeReference("location", element.getLocation());
31991      }
31992      if (element.hasManufacturer()) {
31993        composeReference("manufacturer", element.getManufacturer());
31994      }
31995      if (element.hasLotNumberElement()) {
31996        composeStringCore("lotNumber", element.getLotNumberElement(), false);
31997        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
31998      }
31999      if (element.hasExpirationDateElement()) {
32000        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
32001        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
32002      }
32003      if (element.hasSite()) {
32004        composeCodeableConcept("site", element.getSite());
32005      }
32006      if (element.hasRoute()) {
32007        composeCodeableConcept("route", element.getRoute());
32008      }
32009      if (element.hasDoseQuantity()) {
32010        composeSimpleQuantity("doseQuantity", element.getDoseQuantity());
32011      }
32012      if (element.hasPractitioner()) {
32013        openArray("practitioner");
32014        for (Immunization.ImmunizationPractitionerComponent e : element.getPractitioner()) 
32015          composeImmunizationImmunizationPractitionerComponent(null, e);
32016        closeArray();
32017      };
32018      if (element.hasNote()) {
32019        openArray("note");
32020        for (Annotation e : element.getNote()) 
32021          composeAnnotation(null, e);
32022        closeArray();
32023      };
32024      if (element.hasExplanation()) {
32025        composeImmunizationImmunizationExplanationComponent("explanation", element.getExplanation());
32026      }
32027      if (element.hasReaction()) {
32028        openArray("reaction");
32029        for (Immunization.ImmunizationReactionComponent e : element.getReaction()) 
32030          composeImmunizationImmunizationReactionComponent(null, e);
32031        closeArray();
32032      };
32033      if (element.hasVaccinationProtocol()) {
32034        openArray("vaccinationProtocol");
32035        for (Immunization.ImmunizationVaccinationProtocolComponent e : element.getVaccinationProtocol()) 
32036          composeImmunizationImmunizationVaccinationProtocolComponent(null, e);
32037        closeArray();
32038      };
32039  }
32040
32041  protected void composeImmunizationImmunizationPractitionerComponent(String name, Immunization.ImmunizationPractitionerComponent element) throws IOException {
32042    if (element != null) {
32043      open(name);
32044      composeImmunizationImmunizationPractitionerComponentInner(element);
32045      close();
32046    }
32047  }
32048
32049  protected void composeImmunizationImmunizationPractitionerComponentInner(Immunization.ImmunizationPractitionerComponent element) throws IOException {
32050      composeBackbone(element);
32051      if (element.hasRole()) {
32052        composeCodeableConcept("role", element.getRole());
32053      }
32054      if (element.hasActor()) {
32055        composeReference("actor", element.getActor());
32056      }
32057  }
32058
32059  protected void composeImmunizationImmunizationExplanationComponent(String name, Immunization.ImmunizationExplanationComponent element) throws IOException {
32060    if (element != null) {
32061      open(name);
32062      composeImmunizationImmunizationExplanationComponentInner(element);
32063      close();
32064    }
32065  }
32066
32067  protected void composeImmunizationImmunizationExplanationComponentInner(Immunization.ImmunizationExplanationComponent element) throws IOException {
32068      composeBackbone(element);
32069      if (element.hasReason()) {
32070        openArray("reason");
32071        for (CodeableConcept e : element.getReason()) 
32072          composeCodeableConcept(null, e);
32073        closeArray();
32074      };
32075      if (element.hasReasonNotGiven()) {
32076        openArray("reasonNotGiven");
32077        for (CodeableConcept e : element.getReasonNotGiven()) 
32078          composeCodeableConcept(null, e);
32079        closeArray();
32080      };
32081  }
32082
32083  protected void composeImmunizationImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
32084    if (element != null) {
32085      open(name);
32086      composeImmunizationImmunizationReactionComponentInner(element);
32087      close();
32088    }
32089  }
32090
32091  protected void composeImmunizationImmunizationReactionComponentInner(Immunization.ImmunizationReactionComponent element) throws IOException {
32092      composeBackbone(element);
32093      if (element.hasDateElement()) {
32094        composeDateTimeCore("date", element.getDateElement(), false);
32095        composeDateTimeExtras("date", element.getDateElement(), false);
32096      }
32097      if (element.hasDetail()) {
32098        composeReference("detail", element.getDetail());
32099      }
32100      if (element.hasReportedElement()) {
32101        composeBooleanCore("reported", element.getReportedElement(), false);
32102        composeBooleanExtras("reported", element.getReportedElement(), false);
32103      }
32104  }
32105
32106  protected void composeImmunizationImmunizationVaccinationProtocolComponent(String name, Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32107    if (element != null) {
32108      open(name);
32109      composeImmunizationImmunizationVaccinationProtocolComponentInner(element);
32110      close();
32111    }
32112  }
32113
32114  protected void composeImmunizationImmunizationVaccinationProtocolComponentInner(Immunization.ImmunizationVaccinationProtocolComponent element) throws IOException {
32115      composeBackbone(element);
32116      if (element.hasDoseSequenceElement()) {
32117        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32118        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32119      }
32120      if (element.hasDescriptionElement()) {
32121        composeStringCore("description", element.getDescriptionElement(), false);
32122        composeStringExtras("description", element.getDescriptionElement(), false);
32123      }
32124      if (element.hasAuthority()) {
32125        composeReference("authority", element.getAuthority());
32126      }
32127      if (element.hasSeriesElement()) {
32128        composeStringCore("series", element.getSeriesElement(), false);
32129        composeStringExtras("series", element.getSeriesElement(), false);
32130      }
32131      if (element.hasSeriesDosesElement()) {
32132        composePositiveIntCore("seriesDoses", element.getSeriesDosesElement(), false);
32133        composePositiveIntExtras("seriesDoses", element.getSeriesDosesElement(), false);
32134      }
32135      if (element.hasTargetDisease()) {
32136        openArray("targetDisease");
32137        for (CodeableConcept e : element.getTargetDisease()) 
32138          composeCodeableConcept(null, e);
32139        closeArray();
32140      };
32141      if (element.hasDoseStatus()) {
32142        composeCodeableConcept("doseStatus", element.getDoseStatus());
32143      }
32144      if (element.hasDoseStatusReason()) {
32145        composeCodeableConcept("doseStatusReason", element.getDoseStatusReason());
32146      }
32147  }
32148
32149  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
32150    if (element != null) {
32151      prop("resourceType", name);
32152      composeImmunizationRecommendationInner(element);
32153    }
32154  }
32155
32156  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
32157      composeDomainResourceElements(element);
32158      if (element.hasIdentifier()) {
32159        openArray("identifier");
32160        for (Identifier e : element.getIdentifier()) 
32161          composeIdentifier(null, e);
32162        closeArray();
32163      };
32164      if (element.hasPatient()) {
32165        composeReference("patient", element.getPatient());
32166      }
32167      if (element.hasRecommendation()) {
32168        openArray("recommendation");
32169        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
32170          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
32171        closeArray();
32172      };
32173  }
32174
32175  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32176    if (element != null) {
32177      open(name);
32178      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
32179      close();
32180    }
32181  }
32182
32183  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
32184      composeBackbone(element);
32185      if (element.hasDateElement()) {
32186        composeDateTimeCore("date", element.getDateElement(), false);
32187        composeDateTimeExtras("date", element.getDateElement(), false);
32188      }
32189      if (element.hasVaccineCode()) {
32190        composeCodeableConcept("vaccineCode", element.getVaccineCode());
32191      }
32192      if (element.hasTargetDisease()) {
32193        composeCodeableConcept("targetDisease", element.getTargetDisease());
32194      }
32195      if (element.hasDoseNumberElement()) {
32196        composePositiveIntCore("doseNumber", element.getDoseNumberElement(), false);
32197        composePositiveIntExtras("doseNumber", element.getDoseNumberElement(), false);
32198      }
32199      if (element.hasForecastStatus()) {
32200        composeCodeableConcept("forecastStatus", element.getForecastStatus());
32201      }
32202      if (element.hasDateCriterion()) {
32203        openArray("dateCriterion");
32204        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
32205          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
32206        closeArray();
32207      };
32208      if (element.hasProtocol()) {
32209        composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent("protocol", element.getProtocol());
32210      }
32211      if (element.hasSupportingImmunization()) {
32212        openArray("supportingImmunization");
32213        for (Reference e : element.getSupportingImmunization()) 
32214          composeReference(null, e);
32215        closeArray();
32216      };
32217      if (element.hasSupportingPatientInformation()) {
32218        openArray("supportingPatientInformation");
32219        for (Reference e : element.getSupportingPatientInformation()) 
32220          composeReference(null, e);
32221        closeArray();
32222      };
32223  }
32224
32225  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32226    if (element != null) {
32227      open(name);
32228      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
32229      close();
32230    }
32231  }
32232
32233  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
32234      composeBackbone(element);
32235      if (element.hasCode()) {
32236        composeCodeableConcept("code", element.getCode());
32237      }
32238      if (element.hasValueElement()) {
32239        composeDateTimeCore("value", element.getValueElement(), false);
32240        composeDateTimeExtras("value", element.getValueElement(), false);
32241      }
32242  }
32243
32244  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32245    if (element != null) {
32246      open(name);
32247      composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(element);
32248      close();
32249    }
32250  }
32251
32252  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationProtocolComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent element) throws IOException {
32253      composeBackbone(element);
32254      if (element.hasDoseSequenceElement()) {
32255        composePositiveIntCore("doseSequence", element.getDoseSequenceElement(), false);
32256        composePositiveIntExtras("doseSequence", element.getDoseSequenceElement(), false);
32257      }
32258      if (element.hasDescriptionElement()) {
32259        composeStringCore("description", element.getDescriptionElement(), false);
32260        composeStringExtras("description", element.getDescriptionElement(), false);
32261      }
32262      if (element.hasAuthority()) {
32263        composeReference("authority", element.getAuthority());
32264      }
32265      if (element.hasSeriesElement()) {
32266        composeStringCore("series", element.getSeriesElement(), false);
32267        composeStringExtras("series", element.getSeriesElement(), false);
32268      }
32269  }
32270
32271  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
32272    if (element != null) {
32273      prop("resourceType", name);
32274      composeImplementationGuideInner(element);
32275    }
32276  }
32277
32278  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
32279      composeDomainResourceElements(element);
32280      if (element.hasUrlElement()) {
32281        composeUriCore("url", element.getUrlElement(), false);
32282        composeUriExtras("url", element.getUrlElement(), false);
32283      }
32284      if (element.hasVersionElement()) {
32285        composeStringCore("version", element.getVersionElement(), false);
32286        composeStringExtras("version", element.getVersionElement(), false);
32287      }
32288      if (element.hasNameElement()) {
32289        composeStringCore("name", element.getNameElement(), false);
32290        composeStringExtras("name", element.getNameElement(), false);
32291      }
32292      if (element.hasStatusElement()) {
32293        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32294        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32295      }
32296      if (element.hasExperimentalElement()) {
32297        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32298        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32299      }
32300      if (element.hasDateElement()) {
32301        composeDateTimeCore("date", element.getDateElement(), false);
32302        composeDateTimeExtras("date", element.getDateElement(), false);
32303      }
32304      if (element.hasPublisherElement()) {
32305        composeStringCore("publisher", element.getPublisherElement(), false);
32306        composeStringExtras("publisher", element.getPublisherElement(), false);
32307      }
32308      if (element.hasContact()) {
32309        openArray("contact");
32310        for (ContactDetail e : element.getContact()) 
32311          composeContactDetail(null, e);
32312        closeArray();
32313      };
32314      if (element.hasDescriptionElement()) {
32315        composeMarkdownCore("description", element.getDescriptionElement(), false);
32316        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32317      }
32318      if (element.hasUseContext()) {
32319        openArray("useContext");
32320        for (UsageContext e : element.getUseContext()) 
32321          composeUsageContext(null, e);
32322        closeArray();
32323      };
32324      if (element.hasJurisdiction()) {
32325        openArray("jurisdiction");
32326        for (CodeableConcept e : element.getJurisdiction()) 
32327          composeCodeableConcept(null, e);
32328        closeArray();
32329      };
32330      if (element.hasCopyrightElement()) {
32331        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32332        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32333      }
32334      if (element.hasFhirVersionElement()) {
32335        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
32336        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
32337      }
32338      if (element.hasDependency()) {
32339        openArray("dependency");
32340        for (ImplementationGuide.ImplementationGuideDependencyComponent e : element.getDependency()) 
32341          composeImplementationGuideImplementationGuideDependencyComponent(null, e);
32342        closeArray();
32343      };
32344      if (element.hasPackage()) {
32345        openArray("package");
32346        for (ImplementationGuide.ImplementationGuidePackageComponent e : element.getPackage()) 
32347          composeImplementationGuideImplementationGuidePackageComponent(null, e);
32348        closeArray();
32349      };
32350      if (element.hasGlobal()) {
32351        openArray("global");
32352        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
32353          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
32354        closeArray();
32355      };
32356      if (element.hasBinary()) {
32357        openArray("binary");
32358        for (UriType e : element.getBinary()) 
32359          composeUriCore(null, e, true);
32360        closeArray();
32361        if (anyHasExtras(element.getBinary())) {
32362          openArray("_binary");
32363          for (UriType e : element.getBinary()) 
32364            composeUriExtras(null, e, true);
32365          closeArray();
32366        }
32367      };
32368      if (element.hasPage()) {
32369        composeImplementationGuideImplementationGuidePageComponent("page", element.getPage());
32370      }
32371  }
32372
32373  protected void composeImplementationGuideImplementationGuideDependencyComponent(String name, ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32374    if (element != null) {
32375      open(name);
32376      composeImplementationGuideImplementationGuideDependencyComponentInner(element);
32377      close();
32378    }
32379  }
32380
32381  protected void composeImplementationGuideImplementationGuideDependencyComponentInner(ImplementationGuide.ImplementationGuideDependencyComponent element) throws IOException {
32382      composeBackbone(element);
32383      if (element.hasTypeElement()) {
32384        composeEnumerationCore("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32385        composeEnumerationExtras("type", element.getTypeElement(), new ImplementationGuide.GuideDependencyTypeEnumFactory(), false);
32386      }
32387      if (element.hasUriElement()) {
32388        composeUriCore("uri", element.getUriElement(), false);
32389        composeUriExtras("uri", element.getUriElement(), false);
32390      }
32391  }
32392
32393  protected void composeImplementationGuideImplementationGuidePackageComponent(String name, ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32394    if (element != null) {
32395      open(name);
32396      composeImplementationGuideImplementationGuidePackageComponentInner(element);
32397      close();
32398    }
32399  }
32400
32401  protected void composeImplementationGuideImplementationGuidePackageComponentInner(ImplementationGuide.ImplementationGuidePackageComponent element) throws IOException {
32402      composeBackbone(element);
32403      if (element.hasNameElement()) {
32404        composeStringCore("name", element.getNameElement(), false);
32405        composeStringExtras("name", element.getNameElement(), false);
32406      }
32407      if (element.hasDescriptionElement()) {
32408        composeStringCore("description", element.getDescriptionElement(), false);
32409        composeStringExtras("description", element.getDescriptionElement(), false);
32410      }
32411      if (element.hasResource()) {
32412        openArray("resource");
32413        for (ImplementationGuide.ImplementationGuidePackageResourceComponent e : element.getResource()) 
32414          composeImplementationGuideImplementationGuidePackageResourceComponent(null, e);
32415        closeArray();
32416      };
32417  }
32418
32419  protected void composeImplementationGuideImplementationGuidePackageResourceComponent(String name, ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32420    if (element != null) {
32421      open(name);
32422      composeImplementationGuideImplementationGuidePackageResourceComponentInner(element);
32423      close();
32424    }
32425  }
32426
32427  protected void composeImplementationGuideImplementationGuidePackageResourceComponentInner(ImplementationGuide.ImplementationGuidePackageResourceComponent element) throws IOException {
32428      composeBackbone(element);
32429      if (element.hasExampleElement()) {
32430        composeBooleanCore("example", element.getExampleElement(), false);
32431        composeBooleanExtras("example", element.getExampleElement(), false);
32432      }
32433      if (element.hasNameElement()) {
32434        composeStringCore("name", element.getNameElement(), false);
32435        composeStringExtras("name", element.getNameElement(), false);
32436      }
32437      if (element.hasDescriptionElement()) {
32438        composeStringCore("description", element.getDescriptionElement(), false);
32439        composeStringExtras("description", element.getDescriptionElement(), false);
32440      }
32441      if (element.hasAcronymElement()) {
32442        composeStringCore("acronym", element.getAcronymElement(), false);
32443        composeStringExtras("acronym", element.getAcronymElement(), false);
32444      }
32445      if (element.hasSource()) {
32446        composeType("source", element.getSource());
32447      }
32448      if (element.hasExampleFor()) {
32449        composeReference("exampleFor", element.getExampleFor());
32450      }
32451  }
32452
32453  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32454    if (element != null) {
32455      open(name);
32456      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
32457      close();
32458    }
32459  }
32460
32461  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
32462      composeBackbone(element);
32463      if (element.hasTypeElement()) {
32464        composeCodeCore("type", element.getTypeElement(), false);
32465        composeCodeExtras("type", element.getTypeElement(), false);
32466      }
32467      if (element.hasProfile()) {
32468        composeReference("profile", element.getProfile());
32469      }
32470  }
32471
32472  protected void composeImplementationGuideImplementationGuidePageComponent(String name, ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32473    if (element != null) {
32474      open(name);
32475      composeImplementationGuideImplementationGuidePageComponentInner(element);
32476      close();
32477    }
32478  }
32479
32480  protected void composeImplementationGuideImplementationGuidePageComponentInner(ImplementationGuide.ImplementationGuidePageComponent element) throws IOException {
32481      composeBackbone(element);
32482      if (element.hasSourceElement()) {
32483        composeUriCore("source", element.getSourceElement(), false);
32484        composeUriExtras("source", element.getSourceElement(), false);
32485      }
32486      if (element.hasTitleElement()) {
32487        composeStringCore("title", element.getTitleElement(), false);
32488        composeStringExtras("title", element.getTitleElement(), false);
32489      }
32490      if (element.hasKindElement()) {
32491        composeEnumerationCore("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32492        composeEnumerationExtras("kind", element.getKindElement(), new ImplementationGuide.GuidePageKindEnumFactory(), false);
32493      }
32494      if (element.hasType()) {
32495        openArray("type");
32496        for (CodeType e : element.getType()) 
32497          composeCodeCore(null, e, true);
32498        closeArray();
32499        if (anyHasExtras(element.getType())) {
32500          openArray("_type");
32501          for (CodeType e : element.getType()) 
32502            composeCodeExtras(null, e, true);
32503          closeArray();
32504        }
32505      };
32506      if (element.hasPackage()) {
32507        openArray("package");
32508        for (StringType e : element.getPackage()) 
32509          composeStringCore(null, e, true);
32510        closeArray();
32511        if (anyHasExtras(element.getPackage())) {
32512          openArray("_package");
32513          for (StringType e : element.getPackage()) 
32514            composeStringExtras(null, e, true);
32515          closeArray();
32516        }
32517      };
32518      if (element.hasFormatElement()) {
32519        composeCodeCore("format", element.getFormatElement(), false);
32520        composeCodeExtras("format", element.getFormatElement(), false);
32521      }
32522      if (element.hasPage()) {
32523        openArray("page");
32524        for (ImplementationGuide.ImplementationGuidePageComponent e : element.getPage()) 
32525          composeImplementationGuideImplementationGuidePageComponent(null, e);
32526        closeArray();
32527      };
32528  }
32529
32530  protected void composeLibrary(String name, Library element) throws IOException {
32531    if (element != null) {
32532      prop("resourceType", name);
32533      composeLibraryInner(element);
32534    }
32535  }
32536
32537  protected void composeLibraryInner(Library element) throws IOException {
32538      composeDomainResourceElements(element);
32539      if (element.hasUrlElement()) {
32540        composeUriCore("url", element.getUrlElement(), false);
32541        composeUriExtras("url", element.getUrlElement(), false);
32542      }
32543      if (element.hasIdentifier()) {
32544        openArray("identifier");
32545        for (Identifier e : element.getIdentifier()) 
32546          composeIdentifier(null, e);
32547        closeArray();
32548      };
32549      if (element.hasVersionElement()) {
32550        composeStringCore("version", element.getVersionElement(), false);
32551        composeStringExtras("version", element.getVersionElement(), false);
32552      }
32553      if (element.hasNameElement()) {
32554        composeStringCore("name", element.getNameElement(), false);
32555        composeStringExtras("name", element.getNameElement(), false);
32556      }
32557      if (element.hasTitleElement()) {
32558        composeStringCore("title", element.getTitleElement(), false);
32559        composeStringExtras("title", element.getTitleElement(), false);
32560      }
32561      if (element.hasStatusElement()) {
32562        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32563        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32564      }
32565      if (element.hasExperimentalElement()) {
32566        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32567        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32568      }
32569      if (element.hasType()) {
32570        composeCodeableConcept("type", element.getType());
32571      }
32572      if (element.hasDateElement()) {
32573        composeDateTimeCore("date", element.getDateElement(), false);
32574        composeDateTimeExtras("date", element.getDateElement(), false);
32575      }
32576      if (element.hasPublisherElement()) {
32577        composeStringCore("publisher", element.getPublisherElement(), false);
32578        composeStringExtras("publisher", element.getPublisherElement(), false);
32579      }
32580      if (element.hasDescriptionElement()) {
32581        composeMarkdownCore("description", element.getDescriptionElement(), false);
32582        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32583      }
32584      if (element.hasPurposeElement()) {
32585        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32586        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32587      }
32588      if (element.hasUsageElement()) {
32589        composeStringCore("usage", element.getUsageElement(), false);
32590        composeStringExtras("usage", element.getUsageElement(), false);
32591      }
32592      if (element.hasApprovalDateElement()) {
32593        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32594        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32595      }
32596      if (element.hasLastReviewDateElement()) {
32597        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32598        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32599      }
32600      if (element.hasEffectivePeriod()) {
32601        composePeriod("effectivePeriod", element.getEffectivePeriod());
32602      }
32603      if (element.hasUseContext()) {
32604        openArray("useContext");
32605        for (UsageContext e : element.getUseContext()) 
32606          composeUsageContext(null, e);
32607        closeArray();
32608      };
32609      if (element.hasJurisdiction()) {
32610        openArray("jurisdiction");
32611        for (CodeableConcept e : element.getJurisdiction()) 
32612          composeCodeableConcept(null, e);
32613        closeArray();
32614      };
32615      if (element.hasTopic()) {
32616        openArray("topic");
32617        for (CodeableConcept e : element.getTopic()) 
32618          composeCodeableConcept(null, e);
32619        closeArray();
32620      };
32621      if (element.hasContributor()) {
32622        openArray("contributor");
32623        for (Contributor e : element.getContributor()) 
32624          composeContributor(null, e);
32625        closeArray();
32626      };
32627      if (element.hasContact()) {
32628        openArray("contact");
32629        for (ContactDetail e : element.getContact()) 
32630          composeContactDetail(null, e);
32631        closeArray();
32632      };
32633      if (element.hasCopyrightElement()) {
32634        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32635        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32636      }
32637      if (element.hasRelatedArtifact()) {
32638        openArray("relatedArtifact");
32639        for (RelatedArtifact e : element.getRelatedArtifact()) 
32640          composeRelatedArtifact(null, e);
32641        closeArray();
32642      };
32643      if (element.hasParameter()) {
32644        openArray("parameter");
32645        for (ParameterDefinition e : element.getParameter()) 
32646          composeParameterDefinition(null, e);
32647        closeArray();
32648      };
32649      if (element.hasDataRequirement()) {
32650        openArray("dataRequirement");
32651        for (DataRequirement e : element.getDataRequirement()) 
32652          composeDataRequirement(null, e);
32653        closeArray();
32654      };
32655      if (element.hasContent()) {
32656        openArray("content");
32657        for (Attachment e : element.getContent()) 
32658          composeAttachment(null, e);
32659        closeArray();
32660      };
32661  }
32662
32663  protected void composeLinkage(String name, Linkage element) throws IOException {
32664    if (element != null) {
32665      prop("resourceType", name);
32666      composeLinkageInner(element);
32667    }
32668  }
32669
32670  protected void composeLinkageInner(Linkage element) throws IOException {
32671      composeDomainResourceElements(element);
32672      if (element.hasActiveElement()) {
32673        composeBooleanCore("active", element.getActiveElement(), false);
32674        composeBooleanExtras("active", element.getActiveElement(), false);
32675      }
32676      if (element.hasAuthor()) {
32677        composeReference("author", element.getAuthor());
32678      }
32679      if (element.hasItem()) {
32680        openArray("item");
32681        for (Linkage.LinkageItemComponent e : element.getItem()) 
32682          composeLinkageLinkageItemComponent(null, e);
32683        closeArray();
32684      };
32685  }
32686
32687  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
32688    if (element != null) {
32689      open(name);
32690      composeLinkageLinkageItemComponentInner(element);
32691      close();
32692    }
32693  }
32694
32695  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
32696      composeBackbone(element);
32697      if (element.hasTypeElement()) {
32698        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
32699        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
32700      }
32701      if (element.hasResource()) {
32702        composeReference("resource", element.getResource());
32703      }
32704  }
32705
32706  protected void composeListResource(String name, ListResource element) throws IOException {
32707    if (element != null) {
32708      prop("resourceType", name);
32709      composeListResourceInner(element);
32710    }
32711  }
32712
32713  protected void composeListResourceInner(ListResource element) throws IOException {
32714      composeDomainResourceElements(element);
32715      if (element.hasIdentifier()) {
32716        openArray("identifier");
32717        for (Identifier e : element.getIdentifier()) 
32718          composeIdentifier(null, e);
32719        closeArray();
32720      };
32721      if (element.hasStatusElement()) {
32722        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
32723        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
32724      }
32725      if (element.hasModeElement()) {
32726        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
32727        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
32728      }
32729      if (element.hasTitleElement()) {
32730        composeStringCore("title", element.getTitleElement(), false);
32731        composeStringExtras("title", element.getTitleElement(), false);
32732      }
32733      if (element.hasCode()) {
32734        composeCodeableConcept("code", element.getCode());
32735      }
32736      if (element.hasSubject()) {
32737        composeReference("subject", element.getSubject());
32738      }
32739      if (element.hasEncounter()) {
32740        composeReference("encounter", element.getEncounter());
32741      }
32742      if (element.hasDateElement()) {
32743        composeDateTimeCore("date", element.getDateElement(), false);
32744        composeDateTimeExtras("date", element.getDateElement(), false);
32745      }
32746      if (element.hasSource()) {
32747        composeReference("source", element.getSource());
32748      }
32749      if (element.hasOrderedBy()) {
32750        composeCodeableConcept("orderedBy", element.getOrderedBy());
32751      }
32752      if (element.hasNote()) {
32753        openArray("note");
32754        for (Annotation e : element.getNote()) 
32755          composeAnnotation(null, e);
32756        closeArray();
32757      };
32758      if (element.hasEntry()) {
32759        openArray("entry");
32760        for (ListResource.ListEntryComponent e : element.getEntry()) 
32761          composeListResourceListEntryComponent(null, e);
32762        closeArray();
32763      };
32764      if (element.hasEmptyReason()) {
32765        composeCodeableConcept("emptyReason", element.getEmptyReason());
32766      }
32767  }
32768
32769  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
32770    if (element != null) {
32771      open(name);
32772      composeListResourceListEntryComponentInner(element);
32773      close();
32774    }
32775  }
32776
32777  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
32778      composeBackbone(element);
32779      if (element.hasFlag()) {
32780        composeCodeableConcept("flag", element.getFlag());
32781      }
32782      if (element.hasDeletedElement()) {
32783        composeBooleanCore("deleted", element.getDeletedElement(), false);
32784        composeBooleanExtras("deleted", element.getDeletedElement(), false);
32785      }
32786      if (element.hasDateElement()) {
32787        composeDateTimeCore("date", element.getDateElement(), false);
32788        composeDateTimeExtras("date", element.getDateElement(), false);
32789      }
32790      if (element.hasItem()) {
32791        composeReference("item", element.getItem());
32792      }
32793  }
32794
32795  protected void composeLocation(String name, Location element) throws IOException {
32796    if (element != null) {
32797      prop("resourceType", name);
32798      composeLocationInner(element);
32799    }
32800  }
32801
32802  protected void composeLocationInner(Location element) throws IOException {
32803      composeDomainResourceElements(element);
32804      if (element.hasIdentifier()) {
32805        openArray("identifier");
32806        for (Identifier e : element.getIdentifier()) 
32807          composeIdentifier(null, e);
32808        closeArray();
32809      };
32810      if (element.hasStatusElement()) {
32811        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
32812        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
32813      }
32814      if (element.hasOperationalStatus()) {
32815        composeCoding("operationalStatus", element.getOperationalStatus());
32816      }
32817      if (element.hasNameElement()) {
32818        composeStringCore("name", element.getNameElement(), false);
32819        composeStringExtras("name", element.getNameElement(), false);
32820      }
32821      if (element.hasAlias()) {
32822        openArray("alias");
32823        for (StringType e : element.getAlias()) 
32824          composeStringCore(null, e, true);
32825        closeArray();
32826        if (anyHasExtras(element.getAlias())) {
32827          openArray("_alias");
32828          for (StringType e : element.getAlias()) 
32829            composeStringExtras(null, e, true);
32830          closeArray();
32831        }
32832      };
32833      if (element.hasDescriptionElement()) {
32834        composeStringCore("description", element.getDescriptionElement(), false);
32835        composeStringExtras("description", element.getDescriptionElement(), false);
32836      }
32837      if (element.hasModeElement()) {
32838        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
32839        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
32840      }
32841      if (element.hasType()) {
32842        composeCodeableConcept("type", element.getType());
32843      }
32844      if (element.hasTelecom()) {
32845        openArray("telecom");
32846        for (ContactPoint e : element.getTelecom()) 
32847          composeContactPoint(null, e);
32848        closeArray();
32849      };
32850      if (element.hasAddress()) {
32851        composeAddress("address", element.getAddress());
32852      }
32853      if (element.hasPhysicalType()) {
32854        composeCodeableConcept("physicalType", element.getPhysicalType());
32855      }
32856      if (element.hasPosition()) {
32857        composeLocationLocationPositionComponent("position", element.getPosition());
32858      }
32859      if (element.hasManagingOrganization()) {
32860        composeReference("managingOrganization", element.getManagingOrganization());
32861      }
32862      if (element.hasPartOf()) {
32863        composeReference("partOf", element.getPartOf());
32864      }
32865      if (element.hasEndpoint()) {
32866        openArray("endpoint");
32867        for (Reference e : element.getEndpoint()) 
32868          composeReference(null, e);
32869        closeArray();
32870      };
32871  }
32872
32873  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
32874    if (element != null) {
32875      open(name);
32876      composeLocationLocationPositionComponentInner(element);
32877      close();
32878    }
32879  }
32880
32881  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
32882      composeBackbone(element);
32883      if (element.hasLongitudeElement()) {
32884        composeDecimalCore("longitude", element.getLongitudeElement(), false);
32885        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
32886      }
32887      if (element.hasLatitudeElement()) {
32888        composeDecimalCore("latitude", element.getLatitudeElement(), false);
32889        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
32890      }
32891      if (element.hasAltitudeElement()) {
32892        composeDecimalCore("altitude", element.getAltitudeElement(), false);
32893        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
32894      }
32895  }
32896
32897  protected void composeMeasure(String name, Measure element) throws IOException {
32898    if (element != null) {
32899      prop("resourceType", name);
32900      composeMeasureInner(element);
32901    }
32902  }
32903
32904  protected void composeMeasureInner(Measure element) throws IOException {
32905      composeDomainResourceElements(element);
32906      if (element.hasUrlElement()) {
32907        composeUriCore("url", element.getUrlElement(), false);
32908        composeUriExtras("url", element.getUrlElement(), false);
32909      }
32910      if (element.hasIdentifier()) {
32911        openArray("identifier");
32912        for (Identifier e : element.getIdentifier()) 
32913          composeIdentifier(null, e);
32914        closeArray();
32915      };
32916      if (element.hasVersionElement()) {
32917        composeStringCore("version", element.getVersionElement(), false);
32918        composeStringExtras("version", element.getVersionElement(), false);
32919      }
32920      if (element.hasNameElement()) {
32921        composeStringCore("name", element.getNameElement(), false);
32922        composeStringExtras("name", element.getNameElement(), false);
32923      }
32924      if (element.hasTitleElement()) {
32925        composeStringCore("title", element.getTitleElement(), false);
32926        composeStringExtras("title", element.getTitleElement(), false);
32927      }
32928      if (element.hasStatusElement()) {
32929        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32930        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32931      }
32932      if (element.hasExperimentalElement()) {
32933        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32934        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32935      }
32936      if (element.hasDateElement()) {
32937        composeDateTimeCore("date", element.getDateElement(), false);
32938        composeDateTimeExtras("date", element.getDateElement(), false);
32939      }
32940      if (element.hasPublisherElement()) {
32941        composeStringCore("publisher", element.getPublisherElement(), false);
32942        composeStringExtras("publisher", element.getPublisherElement(), false);
32943      }
32944      if (element.hasDescriptionElement()) {
32945        composeMarkdownCore("description", element.getDescriptionElement(), false);
32946        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32947      }
32948      if (element.hasPurposeElement()) {
32949        composeMarkdownCore("purpose", element.getPurposeElement(), false);
32950        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
32951      }
32952      if (element.hasUsageElement()) {
32953        composeStringCore("usage", element.getUsageElement(), false);
32954        composeStringExtras("usage", element.getUsageElement(), false);
32955      }
32956      if (element.hasApprovalDateElement()) {
32957        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32958        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32959      }
32960      if (element.hasLastReviewDateElement()) {
32961        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32962        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32963      }
32964      if (element.hasEffectivePeriod()) {
32965        composePeriod("effectivePeriod", element.getEffectivePeriod());
32966      }
32967      if (element.hasUseContext()) {
32968        openArray("useContext");
32969        for (UsageContext e : element.getUseContext()) 
32970          composeUsageContext(null, e);
32971        closeArray();
32972      };
32973      if (element.hasJurisdiction()) {
32974        openArray("jurisdiction");
32975        for (CodeableConcept e : element.getJurisdiction()) 
32976          composeCodeableConcept(null, e);
32977        closeArray();
32978      };
32979      if (element.hasTopic()) {
32980        openArray("topic");
32981        for (CodeableConcept e : element.getTopic()) 
32982          composeCodeableConcept(null, e);
32983        closeArray();
32984      };
32985      if (element.hasContributor()) {
32986        openArray("contributor");
32987        for (Contributor e : element.getContributor()) 
32988          composeContributor(null, e);
32989        closeArray();
32990      };
32991      if (element.hasContact()) {
32992        openArray("contact");
32993        for (ContactDetail e : element.getContact()) 
32994          composeContactDetail(null, e);
32995        closeArray();
32996      };
32997      if (element.hasCopyrightElement()) {
32998        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32999        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33000      }
33001      if (element.hasRelatedArtifact()) {
33002        openArray("relatedArtifact");
33003        for (RelatedArtifact e : element.getRelatedArtifact()) 
33004          composeRelatedArtifact(null, e);
33005        closeArray();
33006      };
33007      if (element.hasLibrary()) {
33008        openArray("library");
33009        for (Reference e : element.getLibrary()) 
33010          composeReference(null, e);
33011        closeArray();
33012      };
33013      if (element.hasDisclaimerElement()) {
33014        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
33015        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
33016      }
33017      if (element.hasScoring()) {
33018        composeCodeableConcept("scoring", element.getScoring());
33019      }
33020      if (element.hasCompositeScoring()) {
33021        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
33022      }
33023      if (element.hasType()) {
33024        openArray("type");
33025        for (CodeableConcept e : element.getType()) 
33026          composeCodeableConcept(null, e);
33027        closeArray();
33028      };
33029      if (element.hasRiskAdjustmentElement()) {
33030        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
33031        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
33032      }
33033      if (element.hasRateAggregationElement()) {
33034        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
33035        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
33036      }
33037      if (element.hasRationaleElement()) {
33038        composeMarkdownCore("rationale", element.getRationaleElement(), false);
33039        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
33040      }
33041      if (element.hasClinicalRecommendationStatementElement()) {
33042        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33043        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
33044      }
33045      if (element.hasImprovementNotationElement()) {
33046        composeStringCore("improvementNotation", element.getImprovementNotationElement(), false);
33047        composeStringExtras("improvementNotation", element.getImprovementNotationElement(), false);
33048      }
33049      if (element.hasDefinition()) {
33050        openArray("definition");
33051        for (MarkdownType e : element.getDefinition()) 
33052          composeMarkdownCore(null, e, true);
33053        closeArray();
33054        if (anyHasExtras(element.getDefinition())) {
33055          openArray("_definition");
33056          for (MarkdownType e : element.getDefinition()) 
33057            composeMarkdownExtras(null, e, true);
33058          closeArray();
33059        }
33060      };
33061      if (element.hasGuidanceElement()) {
33062        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
33063        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
33064      }
33065      if (element.hasSetElement()) {
33066        composeStringCore("set", element.getSetElement(), false);
33067        composeStringExtras("set", element.getSetElement(), false);
33068      }
33069      if (element.hasGroup()) {
33070        openArray("group");
33071        for (Measure.MeasureGroupComponent e : element.getGroup()) 
33072          composeMeasureMeasureGroupComponent(null, e);
33073        closeArray();
33074      };
33075      if (element.hasSupplementalData()) {
33076        openArray("supplementalData");
33077        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
33078          composeMeasureMeasureSupplementalDataComponent(null, e);
33079        closeArray();
33080      };
33081  }
33082
33083  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
33084    if (element != null) {
33085      open(name);
33086      composeMeasureMeasureGroupComponentInner(element);
33087      close();
33088    }
33089  }
33090
33091  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
33092      composeBackbone(element);
33093      if (element.hasIdentifier()) {
33094        composeIdentifier("identifier", element.getIdentifier());
33095      }
33096      if (element.hasNameElement()) {
33097        composeStringCore("name", element.getNameElement(), false);
33098        composeStringExtras("name", element.getNameElement(), false);
33099      }
33100      if (element.hasDescriptionElement()) {
33101        composeStringCore("description", element.getDescriptionElement(), false);
33102        composeStringExtras("description", element.getDescriptionElement(), false);
33103      }
33104      if (element.hasPopulation()) {
33105        openArray("population");
33106        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
33107          composeMeasureMeasureGroupPopulationComponent(null, e);
33108        closeArray();
33109      };
33110      if (element.hasStratifier()) {
33111        openArray("stratifier");
33112        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
33113          composeMeasureMeasureGroupStratifierComponent(null, e);
33114        closeArray();
33115      };
33116  }
33117
33118  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
33119    if (element != null) {
33120      open(name);
33121      composeMeasureMeasureGroupPopulationComponentInner(element);
33122      close();
33123    }
33124  }
33125
33126  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
33127      composeBackbone(element);
33128      if (element.hasIdentifier()) {
33129        composeIdentifier("identifier", element.getIdentifier());
33130      }
33131      if (element.hasCode()) {
33132        composeCodeableConcept("code", element.getCode());
33133      }
33134      if (element.hasNameElement()) {
33135        composeStringCore("name", element.getNameElement(), false);
33136        composeStringExtras("name", element.getNameElement(), false);
33137      }
33138      if (element.hasDescriptionElement()) {
33139        composeStringCore("description", element.getDescriptionElement(), false);
33140        composeStringExtras("description", element.getDescriptionElement(), false);
33141      }
33142      if (element.hasCriteriaElement()) {
33143        composeStringCore("criteria", element.getCriteriaElement(), false);
33144        composeStringExtras("criteria", element.getCriteriaElement(), false);
33145      }
33146  }
33147
33148  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
33149    if (element != null) {
33150      open(name);
33151      composeMeasureMeasureGroupStratifierComponentInner(element);
33152      close();
33153    }
33154  }
33155
33156  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
33157      composeBackbone(element);
33158      if (element.hasIdentifier()) {
33159        composeIdentifier("identifier", element.getIdentifier());
33160      }
33161      if (element.hasCriteriaElement()) {
33162        composeStringCore("criteria", element.getCriteriaElement(), false);
33163        composeStringExtras("criteria", element.getCriteriaElement(), false);
33164      }
33165      if (element.hasPathElement()) {
33166        composeStringCore("path", element.getPathElement(), false);
33167        composeStringExtras("path", element.getPathElement(), false);
33168      }
33169  }
33170
33171  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
33172    if (element != null) {
33173      open(name);
33174      composeMeasureMeasureSupplementalDataComponentInner(element);
33175      close();
33176    }
33177  }
33178
33179  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
33180      composeBackbone(element);
33181      if (element.hasIdentifier()) {
33182        composeIdentifier("identifier", element.getIdentifier());
33183      }
33184      if (element.hasUsage()) {
33185        openArray("usage");
33186        for (CodeableConcept e : element.getUsage()) 
33187          composeCodeableConcept(null, e);
33188        closeArray();
33189      };
33190      if (element.hasCriteriaElement()) {
33191        composeStringCore("criteria", element.getCriteriaElement(), false);
33192        composeStringExtras("criteria", element.getCriteriaElement(), false);
33193      }
33194      if (element.hasPathElement()) {
33195        composeStringCore("path", element.getPathElement(), false);
33196        composeStringExtras("path", element.getPathElement(), false);
33197      }
33198  }
33199
33200  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
33201    if (element != null) {
33202      prop("resourceType", name);
33203      composeMeasureReportInner(element);
33204    }
33205  }
33206
33207  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
33208      composeDomainResourceElements(element);
33209      if (element.hasIdentifier()) {
33210        composeIdentifier("identifier", element.getIdentifier());
33211      }
33212      if (element.hasStatusElement()) {
33213        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33214        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
33215      }
33216      if (element.hasTypeElement()) {
33217        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33218        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
33219      }
33220      if (element.hasMeasure()) {
33221        composeReference("measure", element.getMeasure());
33222      }
33223      if (element.hasPatient()) {
33224        composeReference("patient", element.getPatient());
33225      }
33226      if (element.hasDateElement()) {
33227        composeDateTimeCore("date", element.getDateElement(), false);
33228        composeDateTimeExtras("date", element.getDateElement(), false);
33229      }
33230      if (element.hasReportingOrganization()) {
33231        composeReference("reportingOrganization", element.getReportingOrganization());
33232      }
33233      if (element.hasPeriod()) {
33234        composePeriod("period", element.getPeriod());
33235      }
33236      if (element.hasGroup()) {
33237        openArray("group");
33238        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
33239          composeMeasureReportMeasureReportGroupComponent(null, e);
33240        closeArray();
33241      };
33242      if (element.hasEvaluatedResources()) {
33243        composeReference("evaluatedResources", element.getEvaluatedResources());
33244      }
33245  }
33246
33247  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
33248    if (element != null) {
33249      open(name);
33250      composeMeasureReportMeasureReportGroupComponentInner(element);
33251      close();
33252    }
33253  }
33254
33255  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
33256      composeBackbone(element);
33257      if (element.hasIdentifier()) {
33258        composeIdentifier("identifier", element.getIdentifier());
33259      }
33260      if (element.hasPopulation()) {
33261        openArray("population");
33262        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
33263          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
33264        closeArray();
33265      };
33266      if (element.hasMeasureScoreElement()) {
33267        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33268        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33269      }
33270      if (element.hasStratifier()) {
33271        openArray("stratifier");
33272        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
33273          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
33274        closeArray();
33275      };
33276  }
33277
33278  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33279    if (element != null) {
33280      open(name);
33281      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
33282      close();
33283    }
33284  }
33285
33286  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
33287      composeBackbone(element);
33288      if (element.hasIdentifier()) {
33289        composeIdentifier("identifier", element.getIdentifier());
33290      }
33291      if (element.hasCode()) {
33292        composeCodeableConcept("code", element.getCode());
33293      }
33294      if (element.hasCountElement()) {
33295        composeIntegerCore("count", element.getCountElement(), false);
33296        composeIntegerExtras("count", element.getCountElement(), false);
33297      }
33298      if (element.hasPatients()) {
33299        composeReference("patients", element.getPatients());
33300      }
33301  }
33302
33303  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33304    if (element != null) {
33305      open(name);
33306      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
33307      close();
33308    }
33309  }
33310
33311  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
33312      composeBackbone(element);
33313      if (element.hasIdentifier()) {
33314        composeIdentifier("identifier", element.getIdentifier());
33315      }
33316      if (element.hasStratum()) {
33317        openArray("stratum");
33318        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
33319          composeMeasureReportStratifierGroupComponent(null, e);
33320        closeArray();
33321      };
33322  }
33323
33324  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
33325    if (element != null) {
33326      open(name);
33327      composeMeasureReportStratifierGroupComponentInner(element);
33328      close();
33329    }
33330  }
33331
33332  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
33333      composeBackbone(element);
33334      if (element.hasValueElement()) {
33335        composeStringCore("value", element.getValueElement(), false);
33336        composeStringExtras("value", element.getValueElement(), false);
33337      }
33338      if (element.hasPopulation()) {
33339        openArray("population");
33340        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
33341          composeMeasureReportStratifierGroupPopulationComponent(null, e);
33342        closeArray();
33343      };
33344      if (element.hasMeasureScoreElement()) {
33345        composeDecimalCore("measureScore", element.getMeasureScoreElement(), false);
33346        composeDecimalExtras("measureScore", element.getMeasureScoreElement(), false);
33347      }
33348  }
33349
33350  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33351    if (element != null) {
33352      open(name);
33353      composeMeasureReportStratifierGroupPopulationComponentInner(element);
33354      close();
33355    }
33356  }
33357
33358  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
33359      composeBackbone(element);
33360      if (element.hasIdentifier()) {
33361        composeIdentifier("identifier", element.getIdentifier());
33362      }
33363      if (element.hasCode()) {
33364        composeCodeableConcept("code", element.getCode());
33365      }
33366      if (element.hasCountElement()) {
33367        composeIntegerCore("count", element.getCountElement(), false);
33368        composeIntegerExtras("count", element.getCountElement(), false);
33369      }
33370      if (element.hasPatients()) {
33371        composeReference("patients", element.getPatients());
33372      }
33373  }
33374
33375  protected void composeMedia(String name, Media element) throws IOException {
33376    if (element != null) {
33377      prop("resourceType", name);
33378      composeMediaInner(element);
33379    }
33380  }
33381
33382  protected void composeMediaInner(Media element) throws IOException {
33383      composeDomainResourceElements(element);
33384      if (element.hasIdentifier()) {
33385        openArray("identifier");
33386        for (Identifier e : element.getIdentifier()) 
33387          composeIdentifier(null, e);
33388        closeArray();
33389      };
33390      if (element.hasBasedOn()) {
33391        openArray("basedOn");
33392        for (Reference e : element.getBasedOn()) 
33393          composeReference(null, e);
33394        closeArray();
33395      };
33396      if (element.hasTypeElement()) {
33397        composeEnumerationCore("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33398        composeEnumerationExtras("type", element.getTypeElement(), new Media.DigitalMediaTypeEnumFactory(), false);
33399      }
33400      if (element.hasSubtype()) {
33401        composeCodeableConcept("subtype", element.getSubtype());
33402      }
33403      if (element.hasView()) {
33404        composeCodeableConcept("view", element.getView());
33405      }
33406      if (element.hasSubject()) {
33407        composeReference("subject", element.getSubject());
33408      }
33409      if (element.hasContext()) {
33410        composeReference("context", element.getContext());
33411      }
33412      if (element.hasOccurrence()) {
33413        composeType("occurrence", element.getOccurrence());
33414      }
33415      if (element.hasOperator()) {
33416        composeReference("operator", element.getOperator());
33417      }
33418      if (element.hasReasonCode()) {
33419        openArray("reasonCode");
33420        for (CodeableConcept e : element.getReasonCode()) 
33421          composeCodeableConcept(null, e);
33422        closeArray();
33423      };
33424      if (element.hasBodySite()) {
33425        composeCodeableConcept("bodySite", element.getBodySite());
33426      }
33427      if (element.hasDevice()) {
33428        composeReference("device", element.getDevice());
33429      }
33430      if (element.hasHeightElement()) {
33431        composePositiveIntCore("height", element.getHeightElement(), false);
33432        composePositiveIntExtras("height", element.getHeightElement(), false);
33433      }
33434      if (element.hasWidthElement()) {
33435        composePositiveIntCore("width", element.getWidthElement(), false);
33436        composePositiveIntExtras("width", element.getWidthElement(), false);
33437      }
33438      if (element.hasFramesElement()) {
33439        composePositiveIntCore("frames", element.getFramesElement(), false);
33440        composePositiveIntExtras("frames", element.getFramesElement(), false);
33441      }
33442      if (element.hasDurationElement()) {
33443        composeUnsignedIntCore("duration", element.getDurationElement(), false);
33444        composeUnsignedIntExtras("duration", element.getDurationElement(), false);
33445      }
33446      if (element.hasContent()) {
33447        composeAttachment("content", element.getContent());
33448      }
33449      if (element.hasNote()) {
33450        openArray("note");
33451        for (Annotation e : element.getNote()) 
33452          composeAnnotation(null, e);
33453        closeArray();
33454      };
33455  }
33456
33457  protected void composeMedication(String name, Medication element) throws IOException {
33458    if (element != null) {
33459      prop("resourceType", name);
33460      composeMedicationInner(element);
33461    }
33462  }
33463
33464  protected void composeMedicationInner(Medication element) throws IOException {
33465      composeDomainResourceElements(element);
33466      if (element.hasCode()) {
33467        composeCodeableConcept("code", element.getCode());
33468      }
33469      if (element.hasStatusElement()) {
33470        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33471        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
33472      }
33473      if (element.hasIsBrandElement()) {
33474        composeBooleanCore("isBrand", element.getIsBrandElement(), false);
33475        composeBooleanExtras("isBrand", element.getIsBrandElement(), false);
33476      }
33477      if (element.hasIsOverTheCounterElement()) {
33478        composeBooleanCore("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33479        composeBooleanExtras("isOverTheCounter", element.getIsOverTheCounterElement(), false);
33480      }
33481      if (element.hasManufacturer()) {
33482        composeReference("manufacturer", element.getManufacturer());
33483      }
33484      if (element.hasForm()) {
33485        composeCodeableConcept("form", element.getForm());
33486      }
33487      if (element.hasIngredient()) {
33488        openArray("ingredient");
33489        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
33490          composeMedicationMedicationIngredientComponent(null, e);
33491        closeArray();
33492      };
33493      if (element.hasPackage()) {
33494        composeMedicationMedicationPackageComponent("package", element.getPackage());
33495      }
33496      if (element.hasImage()) {
33497        openArray("image");
33498        for (Attachment e : element.getImage()) 
33499          composeAttachment(null, e);
33500        closeArray();
33501      };
33502  }
33503
33504  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
33505    if (element != null) {
33506      open(name);
33507      composeMedicationMedicationIngredientComponentInner(element);
33508      close();
33509    }
33510  }
33511
33512  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
33513      composeBackbone(element);
33514      if (element.hasItem()) {
33515        composeType("item", element.getItem());
33516      }
33517      if (element.hasIsActiveElement()) {
33518        composeBooleanCore("isActive", element.getIsActiveElement(), false);
33519        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
33520      }
33521      if (element.hasAmount()) {
33522        composeRatio("amount", element.getAmount());
33523      }
33524  }
33525
33526  protected void composeMedicationMedicationPackageComponent(String name, Medication.MedicationPackageComponent element) throws IOException {
33527    if (element != null) {
33528      open(name);
33529      composeMedicationMedicationPackageComponentInner(element);
33530      close();
33531    }
33532  }
33533
33534  protected void composeMedicationMedicationPackageComponentInner(Medication.MedicationPackageComponent element) throws IOException {
33535      composeBackbone(element);
33536      if (element.hasContainer()) {
33537        composeCodeableConcept("container", element.getContainer());
33538      }
33539      if (element.hasContent()) {
33540        openArray("content");
33541        for (Medication.MedicationPackageContentComponent e : element.getContent()) 
33542          composeMedicationMedicationPackageContentComponent(null, e);
33543        closeArray();
33544      };
33545      if (element.hasBatch()) {
33546        openArray("batch");
33547        for (Medication.MedicationPackageBatchComponent e : element.getBatch()) 
33548          composeMedicationMedicationPackageBatchComponent(null, e);
33549        closeArray();
33550      };
33551  }
33552
33553  protected void composeMedicationMedicationPackageContentComponent(String name, Medication.MedicationPackageContentComponent element) throws IOException {
33554    if (element != null) {
33555      open(name);
33556      composeMedicationMedicationPackageContentComponentInner(element);
33557      close();
33558    }
33559  }
33560
33561  protected void composeMedicationMedicationPackageContentComponentInner(Medication.MedicationPackageContentComponent element) throws IOException {
33562      composeBackbone(element);
33563      if (element.hasItem()) {
33564        composeType("item", element.getItem());
33565      }
33566      if (element.hasAmount()) {
33567        composeSimpleQuantity("amount", element.getAmount());
33568      }
33569  }
33570
33571  protected void composeMedicationMedicationPackageBatchComponent(String name, Medication.MedicationPackageBatchComponent element) throws IOException {
33572    if (element != null) {
33573      open(name);
33574      composeMedicationMedicationPackageBatchComponentInner(element);
33575      close();
33576    }
33577  }
33578
33579  protected void composeMedicationMedicationPackageBatchComponentInner(Medication.MedicationPackageBatchComponent element) throws IOException {
33580      composeBackbone(element);
33581      if (element.hasLotNumberElement()) {
33582        composeStringCore("lotNumber", element.getLotNumberElement(), false);
33583        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
33584      }
33585      if (element.hasExpirationDateElement()) {
33586        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
33587        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
33588      }
33589  }
33590
33591  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
33592    if (element != null) {
33593      prop("resourceType", name);
33594      composeMedicationAdministrationInner(element);
33595    }
33596  }
33597
33598  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
33599      composeDomainResourceElements(element);
33600      if (element.hasIdentifier()) {
33601        openArray("identifier");
33602        for (Identifier e : element.getIdentifier()) 
33603          composeIdentifier(null, e);
33604        closeArray();
33605      };
33606      if (element.hasDefinition()) {
33607        openArray("definition");
33608        for (Reference e : element.getDefinition()) 
33609          composeReference(null, e);
33610        closeArray();
33611      };
33612      if (element.hasPartOf()) {
33613        openArray("partOf");
33614        for (Reference e : element.getPartOf()) 
33615          composeReference(null, e);
33616        closeArray();
33617      };
33618      if (element.hasStatusElement()) {
33619        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33620        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
33621      }
33622      if (element.hasCategory()) {
33623        composeCodeableConcept("category", element.getCategory());
33624      }
33625      if (element.hasMedication()) {
33626        composeType("medication", element.getMedication());
33627      }
33628      if (element.hasSubject()) {
33629        composeReference("subject", element.getSubject());
33630      }
33631      if (element.hasContext()) {
33632        composeReference("context", element.getContext());
33633      }
33634      if (element.hasSupportingInformation()) {
33635        openArray("supportingInformation");
33636        for (Reference e : element.getSupportingInformation()) 
33637          composeReference(null, e);
33638        closeArray();
33639      };
33640      if (element.hasEffective()) {
33641        composeType("effective", element.getEffective());
33642      }
33643      if (element.hasPerformer()) {
33644        openArray("performer");
33645        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
33646          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
33647        closeArray();
33648      };
33649      if (element.hasNotGivenElement()) {
33650        composeBooleanCore("notGiven", element.getNotGivenElement(), false);
33651        composeBooleanExtras("notGiven", element.getNotGivenElement(), false);
33652      }
33653      if (element.hasReasonNotGiven()) {
33654        openArray("reasonNotGiven");
33655        for (CodeableConcept e : element.getReasonNotGiven()) 
33656          composeCodeableConcept(null, e);
33657        closeArray();
33658      };
33659      if (element.hasReasonCode()) {
33660        openArray("reasonCode");
33661        for (CodeableConcept e : element.getReasonCode()) 
33662          composeCodeableConcept(null, e);
33663        closeArray();
33664      };
33665      if (element.hasReasonReference()) {
33666        openArray("reasonReference");
33667        for (Reference e : element.getReasonReference()) 
33668          composeReference(null, e);
33669        closeArray();
33670      };
33671      if (element.hasPrescription()) {
33672        composeReference("prescription", element.getPrescription());
33673      }
33674      if (element.hasDevice()) {
33675        openArray("device");
33676        for (Reference e : element.getDevice()) 
33677          composeReference(null, e);
33678        closeArray();
33679      };
33680      if (element.hasNote()) {
33681        openArray("note");
33682        for (Annotation e : element.getNote()) 
33683          composeAnnotation(null, e);
33684        closeArray();
33685      };
33686      if (element.hasDosage()) {
33687        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
33688      }
33689      if (element.hasEventHistory()) {
33690        openArray("eventHistory");
33691        for (Reference e : element.getEventHistory()) 
33692          composeReference(null, e);
33693        closeArray();
33694      };
33695  }
33696
33697  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
33698    if (element != null) {
33699      open(name);
33700      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
33701      close();
33702    }
33703  }
33704
33705  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
33706      composeBackbone(element);
33707      if (element.hasActor()) {
33708        composeReference("actor", element.getActor());
33709      }
33710      if (element.hasOnBehalfOf()) {
33711        composeReference("onBehalfOf", element.getOnBehalfOf());
33712      }
33713  }
33714
33715  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
33716    if (element != null) {
33717      open(name);
33718      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
33719      close();
33720    }
33721  }
33722
33723  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
33724      composeBackbone(element);
33725      if (element.hasTextElement()) {
33726        composeStringCore("text", element.getTextElement(), false);
33727        composeStringExtras("text", element.getTextElement(), false);
33728      }
33729      if (element.hasSite()) {
33730        composeCodeableConcept("site", element.getSite());
33731      }
33732      if (element.hasRoute()) {
33733        composeCodeableConcept("route", element.getRoute());
33734      }
33735      if (element.hasMethod()) {
33736        composeCodeableConcept("method", element.getMethod());
33737      }
33738      if (element.hasDose()) {
33739        composeSimpleQuantity("dose", element.getDose());
33740      }
33741      if (element.hasRate()) {
33742        composeType("rate", element.getRate());
33743      }
33744  }
33745
33746  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
33747    if (element != null) {
33748      prop("resourceType", name);
33749      composeMedicationDispenseInner(element);
33750    }
33751  }
33752
33753  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
33754      composeDomainResourceElements(element);
33755      if (element.hasIdentifier()) {
33756        openArray("identifier");
33757        for (Identifier e : element.getIdentifier()) 
33758          composeIdentifier(null, e);
33759        closeArray();
33760      };
33761      if (element.hasPartOf()) {
33762        openArray("partOf");
33763        for (Reference e : element.getPartOf()) 
33764          composeReference(null, e);
33765        closeArray();
33766      };
33767      if (element.hasStatusElement()) {
33768        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
33769        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
33770      }
33771      if (element.hasCategory()) {
33772        composeCodeableConcept("category", element.getCategory());
33773      }
33774      if (element.hasMedication()) {
33775        composeType("medication", element.getMedication());
33776      }
33777      if (element.hasSubject()) {
33778        composeReference("subject", element.getSubject());
33779      }
33780      if (element.hasContext()) {
33781        composeReference("context", element.getContext());
33782      }
33783      if (element.hasSupportingInformation()) {
33784        openArray("supportingInformation");
33785        for (Reference e : element.getSupportingInformation()) 
33786          composeReference(null, e);
33787        closeArray();
33788      };
33789      if (element.hasPerformer()) {
33790        openArray("performer");
33791        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
33792          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
33793        closeArray();
33794      };
33795      if (element.hasAuthorizingPrescription()) {
33796        openArray("authorizingPrescription");
33797        for (Reference e : element.getAuthorizingPrescription()) 
33798          composeReference(null, e);
33799        closeArray();
33800      };
33801      if (element.hasType()) {
33802        composeCodeableConcept("type", element.getType());
33803      }
33804      if (element.hasQuantity()) {
33805        composeSimpleQuantity("quantity", element.getQuantity());
33806      }
33807      if (element.hasDaysSupply()) {
33808        composeSimpleQuantity("daysSupply", element.getDaysSupply());
33809      }
33810      if (element.hasWhenPreparedElement()) {
33811        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
33812        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
33813      }
33814      if (element.hasWhenHandedOverElement()) {
33815        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
33816        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
33817      }
33818      if (element.hasDestination()) {
33819        composeReference("destination", element.getDestination());
33820      }
33821      if (element.hasReceiver()) {
33822        openArray("receiver");
33823        for (Reference e : element.getReceiver()) 
33824          composeReference(null, e);
33825        closeArray();
33826      };
33827      if (element.hasNote()) {
33828        openArray("note");
33829        for (Annotation e : element.getNote()) 
33830          composeAnnotation(null, e);
33831        closeArray();
33832      };
33833      if (element.hasDosageInstruction()) {
33834        openArray("dosageInstruction");
33835        for (Dosage e : element.getDosageInstruction()) 
33836          composeDosage(null, e);
33837        closeArray();
33838      };
33839      if (element.hasSubstitution()) {
33840        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
33841      }
33842      if (element.hasDetectedIssue()) {
33843        openArray("detectedIssue");
33844        for (Reference e : element.getDetectedIssue()) 
33845          composeReference(null, e);
33846        closeArray();
33847      };
33848      if (element.hasNotDoneElement()) {
33849        composeBooleanCore("notDone", element.getNotDoneElement(), false);
33850        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
33851      }
33852      if (element.hasNotDoneReason()) {
33853        composeType("notDoneReason", element.getNotDoneReason());
33854      }
33855      if (element.hasEventHistory()) {
33856        openArray("eventHistory");
33857        for (Reference e : element.getEventHistory()) 
33858          composeReference(null, e);
33859        closeArray();
33860      };
33861  }
33862
33863  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
33864    if (element != null) {
33865      open(name);
33866      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
33867      close();
33868    }
33869  }
33870
33871  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
33872      composeBackbone(element);
33873      if (element.hasActor()) {
33874        composeReference("actor", element.getActor());
33875      }
33876      if (element.hasOnBehalfOf()) {
33877        composeReference("onBehalfOf", element.getOnBehalfOf());
33878      }
33879  }
33880
33881  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
33882    if (element != null) {
33883      open(name);
33884      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
33885      close();
33886    }
33887  }
33888
33889  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
33890      composeBackbone(element);
33891      if (element.hasWasSubstitutedElement()) {
33892        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
33893        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
33894      }
33895      if (element.hasType()) {
33896        composeCodeableConcept("type", element.getType());
33897      }
33898      if (element.hasReason()) {
33899        openArray("reason");
33900        for (CodeableConcept e : element.getReason()) 
33901          composeCodeableConcept(null, e);
33902        closeArray();
33903      };
33904      if (element.hasResponsibleParty()) {
33905        openArray("responsibleParty");
33906        for (Reference e : element.getResponsibleParty()) 
33907          composeReference(null, e);
33908        closeArray();
33909      };
33910  }
33911
33912  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
33913    if (element != null) {
33914      prop("resourceType", name);
33915      composeMedicationRequestInner(element);
33916    }
33917  }
33918
33919  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
33920      composeDomainResourceElements(element);
33921      if (element.hasIdentifier()) {
33922        openArray("identifier");
33923        for (Identifier e : element.getIdentifier()) 
33924          composeIdentifier(null, e);
33925        closeArray();
33926      };
33927      if (element.hasDefinition()) {
33928        openArray("definition");
33929        for (Reference e : element.getDefinition()) 
33930          composeReference(null, e);
33931        closeArray();
33932      };
33933      if (element.hasBasedOn()) {
33934        openArray("basedOn");
33935        for (Reference e : element.getBasedOn()) 
33936          composeReference(null, e);
33937        closeArray();
33938      };
33939      if (element.hasGroupIdentifier()) {
33940        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
33941      }
33942      if (element.hasStatusElement()) {
33943        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
33944        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
33945      }
33946      if (element.hasIntentElement()) {
33947        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
33948        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
33949      }
33950      if (element.hasCategory()) {
33951        composeCodeableConcept("category", element.getCategory());
33952      }
33953      if (element.hasPriorityElement()) {
33954        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
33955        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
33956      }
33957      if (element.hasMedication()) {
33958        composeType("medication", element.getMedication());
33959      }
33960      if (element.hasSubject()) {
33961        composeReference("subject", element.getSubject());
33962      }
33963      if (element.hasContext()) {
33964        composeReference("context", element.getContext());
33965      }
33966      if (element.hasSupportingInformation()) {
33967        openArray("supportingInformation");
33968        for (Reference e : element.getSupportingInformation()) 
33969          composeReference(null, e);
33970        closeArray();
33971      };
33972      if (element.hasAuthoredOnElement()) {
33973        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
33974        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
33975      }
33976      if (element.hasRequester()) {
33977        composeMedicationRequestMedicationRequestRequesterComponent("requester", element.getRequester());
33978      }
33979      if (element.hasRecorder()) {
33980        composeReference("recorder", element.getRecorder());
33981      }
33982      if (element.hasReasonCode()) {
33983        openArray("reasonCode");
33984        for (CodeableConcept e : element.getReasonCode()) 
33985          composeCodeableConcept(null, e);
33986        closeArray();
33987      };
33988      if (element.hasReasonReference()) {
33989        openArray("reasonReference");
33990        for (Reference e : element.getReasonReference()) 
33991          composeReference(null, e);
33992        closeArray();
33993      };
33994      if (element.hasNote()) {
33995        openArray("note");
33996        for (Annotation e : element.getNote()) 
33997          composeAnnotation(null, e);
33998        closeArray();
33999      };
34000      if (element.hasDosageInstruction()) {
34001        openArray("dosageInstruction");
34002        for (Dosage e : element.getDosageInstruction()) 
34003          composeDosage(null, e);
34004        closeArray();
34005      };
34006      if (element.hasDispenseRequest()) {
34007        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
34008      }
34009      if (element.hasSubstitution()) {
34010        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
34011      }
34012      if (element.hasPriorPrescription()) {
34013        composeReference("priorPrescription", element.getPriorPrescription());
34014      }
34015      if (element.hasDetectedIssue()) {
34016        openArray("detectedIssue");
34017        for (Reference e : element.getDetectedIssue()) 
34018          composeReference(null, e);
34019        closeArray();
34020      };
34021      if (element.hasEventHistory()) {
34022        openArray("eventHistory");
34023        for (Reference e : element.getEventHistory()) 
34024          composeReference(null, e);
34025        closeArray();
34026      };
34027  }
34028
34029  protected void composeMedicationRequestMedicationRequestRequesterComponent(String name, MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34030    if (element != null) {
34031      open(name);
34032      composeMedicationRequestMedicationRequestRequesterComponentInner(element);
34033      close();
34034    }
34035  }
34036
34037  protected void composeMedicationRequestMedicationRequestRequesterComponentInner(MedicationRequest.MedicationRequestRequesterComponent element) throws IOException {
34038      composeBackbone(element);
34039      if (element.hasAgent()) {
34040        composeReference("agent", element.getAgent());
34041      }
34042      if (element.hasOnBehalfOf()) {
34043        composeReference("onBehalfOf", element.getOnBehalfOf());
34044      }
34045  }
34046
34047  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34048    if (element != null) {
34049      open(name);
34050      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
34051      close();
34052    }
34053  }
34054
34055  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
34056      composeBackbone(element);
34057      if (element.hasValidityPeriod()) {
34058        composePeriod("validityPeriod", element.getValidityPeriod());
34059      }
34060      if (element.hasNumberOfRepeatsAllowedElement()) {
34061        composePositiveIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34062        composePositiveIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
34063      }
34064      if (element.hasQuantity()) {
34065        composeSimpleQuantity("quantity", element.getQuantity());
34066      }
34067      if (element.hasExpectedSupplyDuration()) {
34068        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
34069      }
34070      if (element.hasPerformer()) {
34071        composeReference("performer", element.getPerformer());
34072      }
34073  }
34074
34075  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34076    if (element != null) {
34077      open(name);
34078      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
34079      close();
34080    }
34081  }
34082
34083  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
34084      composeBackbone(element);
34085      if (element.hasAllowedElement()) {
34086        composeBooleanCore("allowed", element.getAllowedElement(), false);
34087        composeBooleanExtras("allowed", element.getAllowedElement(), false);
34088      }
34089      if (element.hasReason()) {
34090        composeCodeableConcept("reason", element.getReason());
34091      }
34092  }
34093
34094  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
34095    if (element != null) {
34096      prop("resourceType", name);
34097      composeMedicationStatementInner(element);
34098    }
34099  }
34100
34101  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
34102      composeDomainResourceElements(element);
34103      if (element.hasIdentifier()) {
34104        openArray("identifier");
34105        for (Identifier e : element.getIdentifier()) 
34106          composeIdentifier(null, e);
34107        closeArray();
34108      };
34109      if (element.hasBasedOn()) {
34110        openArray("basedOn");
34111        for (Reference e : element.getBasedOn()) 
34112          composeReference(null, e);
34113        closeArray();
34114      };
34115      if (element.hasPartOf()) {
34116        openArray("partOf");
34117        for (Reference e : element.getPartOf()) 
34118          composeReference(null, e);
34119        closeArray();
34120      };
34121      if (element.hasContext()) {
34122        composeReference("context", element.getContext());
34123      }
34124      if (element.hasStatusElement()) {
34125        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34126        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
34127      }
34128      if (element.hasCategory()) {
34129        composeCodeableConcept("category", element.getCategory());
34130      }
34131      if (element.hasMedication()) {
34132        composeType("medication", element.getMedication());
34133      }
34134      if (element.hasEffective()) {
34135        composeType("effective", element.getEffective());
34136      }
34137      if (element.hasDateAssertedElement()) {
34138        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
34139        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
34140      }
34141      if (element.hasInformationSource()) {
34142        composeReference("informationSource", element.getInformationSource());
34143      }
34144      if (element.hasSubject()) {
34145        composeReference("subject", element.getSubject());
34146      }
34147      if (element.hasDerivedFrom()) {
34148        openArray("derivedFrom");
34149        for (Reference e : element.getDerivedFrom()) 
34150          composeReference(null, e);
34151        closeArray();
34152      };
34153      if (element.hasTakenElement()) {
34154        composeEnumerationCore("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34155        composeEnumerationExtras("taken", element.getTakenElement(), new MedicationStatement.MedicationStatementTakenEnumFactory(), false);
34156      }
34157      if (element.hasReasonNotTaken()) {
34158        openArray("reasonNotTaken");
34159        for (CodeableConcept e : element.getReasonNotTaken()) 
34160          composeCodeableConcept(null, e);
34161        closeArray();
34162      };
34163      if (element.hasReasonCode()) {
34164        openArray("reasonCode");
34165        for (CodeableConcept e : element.getReasonCode()) 
34166          composeCodeableConcept(null, e);
34167        closeArray();
34168      };
34169      if (element.hasReasonReference()) {
34170        openArray("reasonReference");
34171        for (Reference e : element.getReasonReference()) 
34172          composeReference(null, e);
34173        closeArray();
34174      };
34175      if (element.hasNote()) {
34176        openArray("note");
34177        for (Annotation e : element.getNote()) 
34178          composeAnnotation(null, e);
34179        closeArray();
34180      };
34181      if (element.hasDosage()) {
34182        openArray("dosage");
34183        for (Dosage e : element.getDosage()) 
34184          composeDosage(null, e);
34185        closeArray();
34186      };
34187  }
34188
34189  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
34190    if (element != null) {
34191      prop("resourceType", name);
34192      composeMessageDefinitionInner(element);
34193    }
34194  }
34195
34196  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
34197      composeDomainResourceElements(element);
34198      if (element.hasUrlElement()) {
34199        composeUriCore("url", element.getUrlElement(), false);
34200        composeUriExtras("url", element.getUrlElement(), false);
34201      }
34202      if (element.hasIdentifier()) {
34203        composeIdentifier("identifier", element.getIdentifier());
34204      }
34205      if (element.hasVersionElement()) {
34206        composeStringCore("version", element.getVersionElement(), false);
34207        composeStringExtras("version", element.getVersionElement(), false);
34208      }
34209      if (element.hasNameElement()) {
34210        composeStringCore("name", element.getNameElement(), false);
34211        composeStringExtras("name", element.getNameElement(), false);
34212      }
34213      if (element.hasTitleElement()) {
34214        composeStringCore("title", element.getTitleElement(), false);
34215        composeStringExtras("title", element.getTitleElement(), false);
34216      }
34217      if (element.hasStatusElement()) {
34218        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34219        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34220      }
34221      if (element.hasExperimentalElement()) {
34222        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34223        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34224      }
34225      if (element.hasDateElement()) {
34226        composeDateTimeCore("date", element.getDateElement(), false);
34227        composeDateTimeExtras("date", element.getDateElement(), false);
34228      }
34229      if (element.hasPublisherElement()) {
34230        composeStringCore("publisher", element.getPublisherElement(), false);
34231        composeStringExtras("publisher", element.getPublisherElement(), false);
34232      }
34233      if (element.hasContact()) {
34234        openArray("contact");
34235        for (ContactDetail e : element.getContact()) 
34236          composeContactDetail(null, e);
34237        closeArray();
34238      };
34239      if (element.hasDescriptionElement()) {
34240        composeMarkdownCore("description", element.getDescriptionElement(), false);
34241        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34242      }
34243      if (element.hasUseContext()) {
34244        openArray("useContext");
34245        for (UsageContext e : element.getUseContext()) 
34246          composeUsageContext(null, e);
34247        closeArray();
34248      };
34249      if (element.hasJurisdiction()) {
34250        openArray("jurisdiction");
34251        for (CodeableConcept e : element.getJurisdiction()) 
34252          composeCodeableConcept(null, e);
34253        closeArray();
34254      };
34255      if (element.hasPurposeElement()) {
34256        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34257        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34258      }
34259      if (element.hasCopyrightElement()) {
34260        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34261        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34262      }
34263      if (element.hasBase()) {
34264        composeReference("base", element.getBase());
34265      }
34266      if (element.hasParent()) {
34267        openArray("parent");
34268        for (Reference e : element.getParent()) 
34269          composeReference(null, e);
34270        closeArray();
34271      };
34272      if (element.hasReplaces()) {
34273        openArray("replaces");
34274        for (Reference e : element.getReplaces()) 
34275          composeReference(null, e);
34276        closeArray();
34277      };
34278      if (element.hasEvent()) {
34279        composeCoding("event", element.getEvent());
34280      }
34281      if (element.hasCategoryElement()) {
34282        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34283        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
34284      }
34285      if (element.hasFocus()) {
34286        openArray("focus");
34287        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
34288          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
34289        closeArray();
34290      };
34291      if (element.hasResponseRequiredElement()) {
34292        composeBooleanCore("responseRequired", element.getResponseRequiredElement(), false);
34293        composeBooleanExtras("responseRequired", element.getResponseRequiredElement(), false);
34294      }
34295      if (element.hasAllowedResponse()) {
34296        openArray("allowedResponse");
34297        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
34298          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
34299        closeArray();
34300      };
34301  }
34302
34303  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34304    if (element != null) {
34305      open(name);
34306      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
34307      close();
34308    }
34309  }
34310
34311  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
34312      composeBackbone(element);
34313      if (element.hasCodeElement()) {
34314        composeCodeCore("code", element.getCodeElement(), false);
34315        composeCodeExtras("code", element.getCodeElement(), false);
34316      }
34317      if (element.hasProfile()) {
34318        composeReference("profile", element.getProfile());
34319      }
34320      if (element.hasMinElement()) {
34321        composeUnsignedIntCore("min", element.getMinElement(), false);
34322        composeUnsignedIntExtras("min", element.getMinElement(), false);
34323      }
34324      if (element.hasMaxElement()) {
34325        composeStringCore("max", element.getMaxElement(), false);
34326        composeStringExtras("max", element.getMaxElement(), false);
34327      }
34328  }
34329
34330  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34331    if (element != null) {
34332      open(name);
34333      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
34334      close();
34335    }
34336  }
34337
34338  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
34339      composeBackbone(element);
34340      if (element.hasMessage()) {
34341        composeReference("message", element.getMessage());
34342      }
34343      if (element.hasSituationElement()) {
34344        composeMarkdownCore("situation", element.getSituationElement(), false);
34345        composeMarkdownExtras("situation", element.getSituationElement(), false);
34346      }
34347  }
34348
34349  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
34350    if (element != null) {
34351      prop("resourceType", name);
34352      composeMessageHeaderInner(element);
34353    }
34354  }
34355
34356  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
34357      composeDomainResourceElements(element);
34358      if (element.hasEvent()) {
34359        composeCoding("event", element.getEvent());
34360      }
34361      if (element.hasDestination()) {
34362        openArray("destination");
34363        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
34364          composeMessageHeaderMessageDestinationComponent(null, e);
34365        closeArray();
34366      };
34367      if (element.hasReceiver()) {
34368        composeReference("receiver", element.getReceiver());
34369      }
34370      if (element.hasSender()) {
34371        composeReference("sender", element.getSender());
34372      }
34373      if (element.hasTimestampElement()) {
34374        composeInstantCore("timestamp", element.getTimestampElement(), false);
34375        composeInstantExtras("timestamp", element.getTimestampElement(), false);
34376      }
34377      if (element.hasEnterer()) {
34378        composeReference("enterer", element.getEnterer());
34379      }
34380      if (element.hasAuthor()) {
34381        composeReference("author", element.getAuthor());
34382      }
34383      if (element.hasSource()) {
34384        composeMessageHeaderMessageSourceComponent("source", element.getSource());
34385      }
34386      if (element.hasResponsible()) {
34387        composeReference("responsible", element.getResponsible());
34388      }
34389      if (element.hasReason()) {
34390        composeCodeableConcept("reason", element.getReason());
34391      }
34392      if (element.hasResponse()) {
34393        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
34394      }
34395      if (element.hasFocus()) {
34396        openArray("focus");
34397        for (Reference e : element.getFocus()) 
34398          composeReference(null, e);
34399        closeArray();
34400      };
34401  }
34402
34403  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
34404    if (element != null) {
34405      open(name);
34406      composeMessageHeaderMessageDestinationComponentInner(element);
34407      close();
34408    }
34409  }
34410
34411  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
34412      composeBackbone(element);
34413      if (element.hasNameElement()) {
34414        composeStringCore("name", element.getNameElement(), false);
34415        composeStringExtras("name", element.getNameElement(), false);
34416      }
34417      if (element.hasTarget()) {
34418        composeReference("target", element.getTarget());
34419      }
34420      if (element.hasEndpointElement()) {
34421        composeUriCore("endpoint", element.getEndpointElement(), false);
34422        composeUriExtras("endpoint", element.getEndpointElement(), false);
34423      }
34424  }
34425
34426  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
34427    if (element != null) {
34428      open(name);
34429      composeMessageHeaderMessageSourceComponentInner(element);
34430      close();
34431    }
34432  }
34433
34434  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
34435      composeBackbone(element);
34436      if (element.hasNameElement()) {
34437        composeStringCore("name", element.getNameElement(), false);
34438        composeStringExtras("name", element.getNameElement(), false);
34439      }
34440      if (element.hasSoftwareElement()) {
34441        composeStringCore("software", element.getSoftwareElement(), false);
34442        composeStringExtras("software", element.getSoftwareElement(), false);
34443      }
34444      if (element.hasVersionElement()) {
34445        composeStringCore("version", element.getVersionElement(), false);
34446        composeStringExtras("version", element.getVersionElement(), false);
34447      }
34448      if (element.hasContact()) {
34449        composeContactPoint("contact", element.getContact());
34450      }
34451      if (element.hasEndpointElement()) {
34452        composeUriCore("endpoint", element.getEndpointElement(), false);
34453        composeUriExtras("endpoint", element.getEndpointElement(), false);
34454      }
34455  }
34456
34457  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34458    if (element != null) {
34459      open(name);
34460      composeMessageHeaderMessageHeaderResponseComponentInner(element);
34461      close();
34462    }
34463  }
34464
34465  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
34466      composeBackbone(element);
34467      if (element.hasIdentifierElement()) {
34468        composeIdCore("identifier", element.getIdentifierElement(), false);
34469        composeIdExtras("identifier", element.getIdentifierElement(), false);
34470      }
34471      if (element.hasCodeElement()) {
34472        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34473        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
34474      }
34475      if (element.hasDetails()) {
34476        composeReference("details", element.getDetails());
34477      }
34478  }
34479
34480  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
34481    if (element != null) {
34482      prop("resourceType", name);
34483      composeNamingSystemInner(element);
34484    }
34485  }
34486
34487  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
34488      composeDomainResourceElements(element);
34489      if (element.hasNameElement()) {
34490        composeStringCore("name", element.getNameElement(), false);
34491        composeStringExtras("name", element.getNameElement(), false);
34492      }
34493      if (element.hasStatusElement()) {
34494        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34495        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34496      }
34497      if (element.hasKindElement()) {
34498        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34499        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
34500      }
34501      if (element.hasDateElement()) {
34502        composeDateTimeCore("date", element.getDateElement(), false);
34503        composeDateTimeExtras("date", element.getDateElement(), false);
34504      }
34505      if (element.hasPublisherElement()) {
34506        composeStringCore("publisher", element.getPublisherElement(), false);
34507        composeStringExtras("publisher", element.getPublisherElement(), false);
34508      }
34509      if (element.hasContact()) {
34510        openArray("contact");
34511        for (ContactDetail e : element.getContact()) 
34512          composeContactDetail(null, e);
34513        closeArray();
34514      };
34515      if (element.hasResponsibleElement()) {
34516        composeStringCore("responsible", element.getResponsibleElement(), false);
34517        composeStringExtras("responsible", element.getResponsibleElement(), false);
34518      }
34519      if (element.hasType()) {
34520        composeCodeableConcept("type", element.getType());
34521      }
34522      if (element.hasDescriptionElement()) {
34523        composeMarkdownCore("description", element.getDescriptionElement(), false);
34524        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34525      }
34526      if (element.hasUseContext()) {
34527        openArray("useContext");
34528        for (UsageContext e : element.getUseContext()) 
34529          composeUsageContext(null, e);
34530        closeArray();
34531      };
34532      if (element.hasJurisdiction()) {
34533        openArray("jurisdiction");
34534        for (CodeableConcept e : element.getJurisdiction()) 
34535          composeCodeableConcept(null, e);
34536        closeArray();
34537      };
34538      if (element.hasUsageElement()) {
34539        composeStringCore("usage", element.getUsageElement(), false);
34540        composeStringExtras("usage", element.getUsageElement(), false);
34541      }
34542      if (element.hasUniqueId()) {
34543        openArray("uniqueId");
34544        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
34545          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
34546        closeArray();
34547      };
34548      if (element.hasReplacedBy()) {
34549        composeReference("replacedBy", element.getReplacedBy());
34550      }
34551  }
34552
34553  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34554    if (element != null) {
34555      open(name);
34556      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
34557      close();
34558    }
34559  }
34560
34561  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
34562      composeBackbone(element);
34563      if (element.hasTypeElement()) {
34564        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34565        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
34566      }
34567      if (element.hasValueElement()) {
34568        composeStringCore("value", element.getValueElement(), false);
34569        composeStringExtras("value", element.getValueElement(), false);
34570      }
34571      if (element.hasPreferredElement()) {
34572        composeBooleanCore("preferred", element.getPreferredElement(), false);
34573        composeBooleanExtras("preferred", element.getPreferredElement(), false);
34574      }
34575      if (element.hasCommentElement()) {
34576        composeStringCore("comment", element.getCommentElement(), false);
34577        composeStringExtras("comment", element.getCommentElement(), false);
34578      }
34579      if (element.hasPeriod()) {
34580        composePeriod("period", element.getPeriod());
34581      }
34582  }
34583
34584  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
34585    if (element != null) {
34586      prop("resourceType", name);
34587      composeNutritionOrderInner(element);
34588    }
34589  }
34590
34591  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
34592      composeDomainResourceElements(element);
34593      if (element.hasIdentifier()) {
34594        openArray("identifier");
34595        for (Identifier e : element.getIdentifier()) 
34596          composeIdentifier(null, e);
34597        closeArray();
34598      };
34599      if (element.hasStatusElement()) {
34600        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34601        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
34602      }
34603      if (element.hasPatient()) {
34604        composeReference("patient", element.getPatient());
34605      }
34606      if (element.hasEncounter()) {
34607        composeReference("encounter", element.getEncounter());
34608      }
34609      if (element.hasDateTimeElement()) {
34610        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
34611        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
34612      }
34613      if (element.hasOrderer()) {
34614        composeReference("orderer", element.getOrderer());
34615      }
34616      if (element.hasAllergyIntolerance()) {
34617        openArray("allergyIntolerance");
34618        for (Reference e : element.getAllergyIntolerance()) 
34619          composeReference(null, e);
34620        closeArray();
34621      };
34622      if (element.hasFoodPreferenceModifier()) {
34623        openArray("foodPreferenceModifier");
34624        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
34625          composeCodeableConcept(null, e);
34626        closeArray();
34627      };
34628      if (element.hasExcludeFoodModifier()) {
34629        openArray("excludeFoodModifier");
34630        for (CodeableConcept e : element.getExcludeFoodModifier()) 
34631          composeCodeableConcept(null, e);
34632        closeArray();
34633      };
34634      if (element.hasOralDiet()) {
34635        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
34636      }
34637      if (element.hasSupplement()) {
34638        openArray("supplement");
34639        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
34640          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
34641        closeArray();
34642      };
34643      if (element.hasEnteralFormula()) {
34644        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
34645      }
34646  }
34647
34648  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34649    if (element != null) {
34650      open(name);
34651      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
34652      close();
34653    }
34654  }
34655
34656  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
34657      composeBackbone(element);
34658      if (element.hasType()) {
34659        openArray("type");
34660        for (CodeableConcept e : element.getType()) 
34661          composeCodeableConcept(null, e);
34662        closeArray();
34663      };
34664      if (element.hasSchedule()) {
34665        openArray("schedule");
34666        for (Timing e : element.getSchedule()) 
34667          composeTiming(null, e);
34668        closeArray();
34669      };
34670      if (element.hasNutrient()) {
34671        openArray("nutrient");
34672        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
34673          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
34674        closeArray();
34675      };
34676      if (element.hasTexture()) {
34677        openArray("texture");
34678        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
34679          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
34680        closeArray();
34681      };
34682      if (element.hasFluidConsistencyType()) {
34683        openArray("fluidConsistencyType");
34684        for (CodeableConcept e : element.getFluidConsistencyType()) 
34685          composeCodeableConcept(null, e);
34686        closeArray();
34687      };
34688      if (element.hasInstructionElement()) {
34689        composeStringCore("instruction", element.getInstructionElement(), false);
34690        composeStringExtras("instruction", element.getInstructionElement(), false);
34691      }
34692  }
34693
34694  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
34695    if (element != null) {
34696      open(name);
34697      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
34698      close();
34699    }
34700  }
34701
34702  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
34703      composeBackbone(element);
34704      if (element.hasModifier()) {
34705        composeCodeableConcept("modifier", element.getModifier());
34706      }
34707      if (element.hasAmount()) {
34708        composeSimpleQuantity("amount", element.getAmount());
34709      }
34710  }
34711
34712  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
34713    if (element != null) {
34714      open(name);
34715      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
34716      close();
34717    }
34718  }
34719
34720  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
34721      composeBackbone(element);
34722      if (element.hasModifier()) {
34723        composeCodeableConcept("modifier", element.getModifier());
34724      }
34725      if (element.hasFoodType()) {
34726        composeCodeableConcept("foodType", element.getFoodType());
34727      }
34728  }
34729
34730  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
34731    if (element != null) {
34732      open(name);
34733      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
34734      close();
34735    }
34736  }
34737
34738  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
34739      composeBackbone(element);
34740      if (element.hasType()) {
34741        composeCodeableConcept("type", element.getType());
34742      }
34743      if (element.hasProductNameElement()) {
34744        composeStringCore("productName", element.getProductNameElement(), false);
34745        composeStringExtras("productName", element.getProductNameElement(), false);
34746      }
34747      if (element.hasSchedule()) {
34748        openArray("schedule");
34749        for (Timing e : element.getSchedule()) 
34750          composeTiming(null, e);
34751        closeArray();
34752      };
34753      if (element.hasQuantity()) {
34754        composeSimpleQuantity("quantity", element.getQuantity());
34755      }
34756      if (element.hasInstructionElement()) {
34757        composeStringCore("instruction", element.getInstructionElement(), false);
34758        composeStringExtras("instruction", element.getInstructionElement(), false);
34759      }
34760  }
34761
34762  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
34763    if (element != null) {
34764      open(name);
34765      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
34766      close();
34767    }
34768  }
34769
34770  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
34771      composeBackbone(element);
34772      if (element.hasBaseFormulaType()) {
34773        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
34774      }
34775      if (element.hasBaseFormulaProductNameElement()) {
34776        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
34777        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
34778      }
34779      if (element.hasAdditiveType()) {
34780        composeCodeableConcept("additiveType", element.getAdditiveType());
34781      }
34782      if (element.hasAdditiveProductNameElement()) {
34783        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
34784        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
34785      }
34786      if (element.hasCaloricDensity()) {
34787        composeSimpleQuantity("caloricDensity", element.getCaloricDensity());
34788      }
34789      if (element.hasRouteofAdministration()) {
34790        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
34791      }
34792      if (element.hasAdministration()) {
34793        openArray("administration");
34794        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
34795          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
34796        closeArray();
34797      };
34798      if (element.hasMaxVolumeToDeliver()) {
34799        composeSimpleQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
34800      }
34801      if (element.hasAdministrationInstructionElement()) {
34802        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
34803        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
34804      }
34805  }
34806
34807  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
34808    if (element != null) {
34809      open(name);
34810      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
34811      close();
34812    }
34813  }
34814
34815  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
34816      composeBackbone(element);
34817      if (element.hasSchedule()) {
34818        composeTiming("schedule", element.getSchedule());
34819      }
34820      if (element.hasQuantity()) {
34821        composeSimpleQuantity("quantity", element.getQuantity());
34822      }
34823      if (element.hasRate()) {
34824        composeType("rate", element.getRate());
34825      }
34826  }
34827
34828  protected void composeObservation(String name, Observation element) throws IOException {
34829    if (element != null) {
34830      prop("resourceType", name);
34831      composeObservationInner(element);
34832    }
34833  }
34834
34835  protected void composeObservationInner(Observation element) throws IOException {
34836      composeDomainResourceElements(element);
34837      if (element.hasIdentifier()) {
34838        openArray("identifier");
34839        for (Identifier e : element.getIdentifier()) 
34840          composeIdentifier(null, e);
34841        closeArray();
34842      };
34843      if (element.hasBasedOn()) {
34844        openArray("basedOn");
34845        for (Reference e : element.getBasedOn()) 
34846          composeReference(null, e);
34847        closeArray();
34848      };
34849      if (element.hasStatusElement()) {
34850        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
34851        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
34852      }
34853      if (element.hasCategory()) {
34854        openArray("category");
34855        for (CodeableConcept e : element.getCategory()) 
34856          composeCodeableConcept(null, e);
34857        closeArray();
34858      };
34859      if (element.hasCode()) {
34860        composeCodeableConcept("code", element.getCode());
34861      }
34862      if (element.hasSubject()) {
34863        composeReference("subject", element.getSubject());
34864      }
34865      if (element.hasContext()) {
34866        composeReference("context", element.getContext());
34867      }
34868      if (element.hasEffective()) {
34869        composeType("effective", element.getEffective());
34870      }
34871      if (element.hasIssuedElement()) {
34872        composeInstantCore("issued", element.getIssuedElement(), false);
34873        composeInstantExtras("issued", element.getIssuedElement(), false);
34874      }
34875      if (element.hasPerformer()) {
34876        openArray("performer");
34877        for (Reference e : element.getPerformer()) 
34878          composeReference(null, e);
34879        closeArray();
34880      };
34881      if (element.hasValue()) {
34882        composeType("value", element.getValue());
34883      }
34884      if (element.hasDataAbsentReason()) {
34885        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
34886      }
34887      if (element.hasInterpretation()) {
34888        composeCodeableConcept("interpretation", element.getInterpretation());
34889      }
34890      if (element.hasCommentElement()) {
34891        composeStringCore("comment", element.getCommentElement(), false);
34892        composeStringExtras("comment", element.getCommentElement(), false);
34893      }
34894      if (element.hasBodySite()) {
34895        composeCodeableConcept("bodySite", element.getBodySite());
34896      }
34897      if (element.hasMethod()) {
34898        composeCodeableConcept("method", element.getMethod());
34899      }
34900      if (element.hasSpecimen()) {
34901        composeReference("specimen", element.getSpecimen());
34902      }
34903      if (element.hasDevice()) {
34904        composeReference("device", element.getDevice());
34905      }
34906      if (element.hasReferenceRange()) {
34907        openArray("referenceRange");
34908        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
34909          composeObservationObservationReferenceRangeComponent(null, e);
34910        closeArray();
34911      };
34912      if (element.hasRelated()) {
34913        openArray("related");
34914        for (Observation.ObservationRelatedComponent e : element.getRelated()) 
34915          composeObservationObservationRelatedComponent(null, e);
34916        closeArray();
34917      };
34918      if (element.hasComponent()) {
34919        openArray("component");
34920        for (Observation.ObservationComponentComponent e : element.getComponent()) 
34921          composeObservationObservationComponentComponent(null, e);
34922        closeArray();
34923      };
34924  }
34925
34926  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
34927    if (element != null) {
34928      open(name);
34929      composeObservationObservationReferenceRangeComponentInner(element);
34930      close();
34931    }
34932  }
34933
34934  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
34935      composeBackbone(element);
34936      if (element.hasLow()) {
34937        composeSimpleQuantity("low", element.getLow());
34938      }
34939      if (element.hasHigh()) {
34940        composeSimpleQuantity("high", element.getHigh());
34941      }
34942      if (element.hasType()) {
34943        composeCodeableConcept("type", element.getType());
34944      }
34945      if (element.hasAppliesTo()) {
34946        openArray("appliesTo");
34947        for (CodeableConcept e : element.getAppliesTo()) 
34948          composeCodeableConcept(null, e);
34949        closeArray();
34950      };
34951      if (element.hasAge()) {
34952        composeRange("age", element.getAge());
34953      }
34954      if (element.hasTextElement()) {
34955        composeStringCore("text", element.getTextElement(), false);
34956        composeStringExtras("text", element.getTextElement(), false);
34957      }
34958  }
34959
34960  protected void composeObservationObservationRelatedComponent(String name, Observation.ObservationRelatedComponent element) throws IOException {
34961    if (element != null) {
34962      open(name);
34963      composeObservationObservationRelatedComponentInner(element);
34964      close();
34965    }
34966  }
34967
34968  protected void composeObservationObservationRelatedComponentInner(Observation.ObservationRelatedComponent element) throws IOException {
34969      composeBackbone(element);
34970      if (element.hasTypeElement()) {
34971        composeEnumerationCore("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
34972        composeEnumerationExtras("type", element.getTypeElement(), new Observation.ObservationRelationshipTypeEnumFactory(), false);
34973      }
34974      if (element.hasTarget()) {
34975        composeReference("target", element.getTarget());
34976      }
34977  }
34978
34979  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
34980    if (element != null) {
34981      open(name);
34982      composeObservationObservationComponentComponentInner(element);
34983      close();
34984    }
34985  }
34986
34987  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
34988      composeBackbone(element);
34989      if (element.hasCode()) {
34990        composeCodeableConcept("code", element.getCode());
34991      }
34992      if (element.hasValue()) {
34993        composeType("value", element.getValue());
34994      }
34995      if (element.hasDataAbsentReason()) {
34996        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
34997      }
34998      if (element.hasInterpretation()) {
34999        composeCodeableConcept("interpretation", element.getInterpretation());
35000      }
35001      if (element.hasReferenceRange()) {
35002        openArray("referenceRange");
35003        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
35004          composeObservationObservationReferenceRangeComponent(null, e);
35005        closeArray();
35006      };
35007  }
35008
35009  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
35010    if (element != null) {
35011      prop("resourceType", name);
35012      composeOperationDefinitionInner(element);
35013    }
35014  }
35015
35016  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
35017      composeDomainResourceElements(element);
35018      if (element.hasUrlElement()) {
35019        composeUriCore("url", element.getUrlElement(), false);
35020        composeUriExtras("url", element.getUrlElement(), false);
35021      }
35022      if (element.hasVersionElement()) {
35023        composeStringCore("version", element.getVersionElement(), false);
35024        composeStringExtras("version", element.getVersionElement(), false);
35025      }
35026      if (element.hasNameElement()) {
35027        composeStringCore("name", element.getNameElement(), false);
35028        composeStringExtras("name", element.getNameElement(), false);
35029      }
35030      if (element.hasStatusElement()) {
35031        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35032        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35033      }
35034      if (element.hasKindElement()) {
35035        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35036        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
35037      }
35038      if (element.hasExperimentalElement()) {
35039        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35040        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35041      }
35042      if (element.hasDateElement()) {
35043        composeDateTimeCore("date", element.getDateElement(), false);
35044        composeDateTimeExtras("date", element.getDateElement(), false);
35045      }
35046      if (element.hasPublisherElement()) {
35047        composeStringCore("publisher", element.getPublisherElement(), false);
35048        composeStringExtras("publisher", element.getPublisherElement(), false);
35049      }
35050      if (element.hasContact()) {
35051        openArray("contact");
35052        for (ContactDetail e : element.getContact()) 
35053          composeContactDetail(null, e);
35054        closeArray();
35055      };
35056      if (element.hasDescriptionElement()) {
35057        composeMarkdownCore("description", element.getDescriptionElement(), false);
35058        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35059      }
35060      if (element.hasUseContext()) {
35061        openArray("useContext");
35062        for (UsageContext e : element.getUseContext()) 
35063          composeUsageContext(null, e);
35064        closeArray();
35065      };
35066      if (element.hasJurisdiction()) {
35067        openArray("jurisdiction");
35068        for (CodeableConcept e : element.getJurisdiction()) 
35069          composeCodeableConcept(null, e);
35070        closeArray();
35071      };
35072      if (element.hasPurposeElement()) {
35073        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35074        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35075      }
35076      if (element.hasIdempotentElement()) {
35077        composeBooleanCore("idempotent", element.getIdempotentElement(), false);
35078        composeBooleanExtras("idempotent", element.getIdempotentElement(), false);
35079      }
35080      if (element.hasCodeElement()) {
35081        composeCodeCore("code", element.getCodeElement(), false);
35082        composeCodeExtras("code", element.getCodeElement(), false);
35083      }
35084      if (element.hasCommentElement()) {
35085        composeStringCore("comment", element.getCommentElement(), false);
35086        composeStringExtras("comment", element.getCommentElement(), false);
35087      }
35088      if (element.hasBase()) {
35089        composeReference("base", element.getBase());
35090      }
35091      if (element.hasResource()) {
35092        openArray("resource");
35093        for (CodeType e : element.getResource()) 
35094          composeCodeCore(null, e, true);
35095        closeArray();
35096        if (anyHasExtras(element.getResource())) {
35097          openArray("_resource");
35098          for (CodeType e : element.getResource()) 
35099            composeCodeExtras(null, e, true);
35100          closeArray();
35101        }
35102      };
35103      if (element.hasSystemElement()) {
35104        composeBooleanCore("system", element.getSystemElement(), false);
35105        composeBooleanExtras("system", element.getSystemElement(), false);
35106      }
35107      if (element.hasTypeElement()) {
35108        composeBooleanCore("type", element.getTypeElement(), false);
35109        composeBooleanExtras("type", element.getTypeElement(), false);
35110      }
35111      if (element.hasInstanceElement()) {
35112        composeBooleanCore("instance", element.getInstanceElement(), false);
35113        composeBooleanExtras("instance", element.getInstanceElement(), false);
35114      }
35115      if (element.hasParameter()) {
35116        openArray("parameter");
35117        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
35118          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35119        closeArray();
35120      };
35121      if (element.hasOverload()) {
35122        openArray("overload");
35123        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
35124          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
35125        closeArray();
35126      };
35127  }
35128
35129  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35130    if (element != null) {
35131      open(name);
35132      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
35133      close();
35134    }
35135  }
35136
35137  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
35138      composeBackbone(element);
35139      if (element.hasNameElement()) {
35140        composeCodeCore("name", element.getNameElement(), false);
35141        composeCodeExtras("name", element.getNameElement(), false);
35142      }
35143      if (element.hasUseElement()) {
35144        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35145        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
35146      }
35147      if (element.hasMinElement()) {
35148        composeIntegerCore("min", element.getMinElement(), false);
35149        composeIntegerExtras("min", element.getMinElement(), false);
35150      }
35151      if (element.hasMaxElement()) {
35152        composeStringCore("max", element.getMaxElement(), false);
35153        composeStringExtras("max", element.getMaxElement(), false);
35154      }
35155      if (element.hasDocumentationElement()) {
35156        composeStringCore("documentation", element.getDocumentationElement(), false);
35157        composeStringExtras("documentation", element.getDocumentationElement(), false);
35158      }
35159      if (element.hasTypeElement()) {
35160        composeCodeCore("type", element.getTypeElement(), false);
35161        composeCodeExtras("type", element.getTypeElement(), false);
35162      }
35163      if (element.hasSearchTypeElement()) {
35164        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35165        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
35166      }
35167      if (element.hasProfile()) {
35168        composeReference("profile", element.getProfile());
35169      }
35170      if (element.hasBinding()) {
35171        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
35172      }
35173      if (element.hasPart()) {
35174        openArray("part");
35175        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
35176          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
35177        closeArray();
35178      };
35179  }
35180
35181  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35182    if (element != null) {
35183      open(name);
35184      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
35185      close();
35186    }
35187  }
35188
35189  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
35190      composeBackbone(element);
35191      if (element.hasStrengthElement()) {
35192        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35193        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
35194      }
35195      if (element.hasValueSet()) {
35196        composeType("valueSet", element.getValueSet());
35197      }
35198  }
35199
35200  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35201    if (element != null) {
35202      open(name);
35203      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
35204      close();
35205    }
35206  }
35207
35208  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
35209      composeBackbone(element);
35210      if (element.hasParameterName()) {
35211        openArray("parameterName");
35212        for (StringType e : element.getParameterName()) 
35213          composeStringCore(null, e, true);
35214        closeArray();
35215        if (anyHasExtras(element.getParameterName())) {
35216          openArray("_parameterName");
35217          for (StringType e : element.getParameterName()) 
35218            composeStringExtras(null, e, true);
35219          closeArray();
35220        }
35221      };
35222      if (element.hasCommentElement()) {
35223        composeStringCore("comment", element.getCommentElement(), false);
35224        composeStringExtras("comment", element.getCommentElement(), false);
35225      }
35226  }
35227
35228  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
35229    if (element != null) {
35230      prop("resourceType", name);
35231      composeOperationOutcomeInner(element);
35232    }
35233  }
35234
35235  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
35236      composeDomainResourceElements(element);
35237      if (element.hasIssue()) {
35238        openArray("issue");
35239        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
35240          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
35241        closeArray();
35242      };
35243  }
35244
35245  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35246    if (element != null) {
35247      open(name);
35248      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
35249      close();
35250    }
35251  }
35252
35253  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
35254      composeBackbone(element);
35255      if (element.hasSeverityElement()) {
35256        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35257        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
35258      }
35259      if (element.hasCodeElement()) {
35260        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35261        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
35262      }
35263      if (element.hasDetails()) {
35264        composeCodeableConcept("details", element.getDetails());
35265      }
35266      if (element.hasDiagnosticsElement()) {
35267        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
35268        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
35269      }
35270      if (element.hasLocation()) {
35271        openArray("location");
35272        for (StringType e : element.getLocation()) 
35273          composeStringCore(null, e, true);
35274        closeArray();
35275        if (anyHasExtras(element.getLocation())) {
35276          openArray("_location");
35277          for (StringType e : element.getLocation()) 
35278            composeStringExtras(null, e, true);
35279          closeArray();
35280        }
35281      };
35282      if (element.hasExpression()) {
35283        openArray("expression");
35284        for (StringType e : element.getExpression()) 
35285          composeStringCore(null, e, true);
35286        closeArray();
35287        if (anyHasExtras(element.getExpression())) {
35288          openArray("_expression");
35289          for (StringType e : element.getExpression()) 
35290            composeStringExtras(null, e, true);
35291          closeArray();
35292        }
35293      };
35294  }
35295
35296  protected void composeOrganization(String name, Organization element) throws IOException {
35297    if (element != null) {
35298      prop("resourceType", name);
35299      composeOrganizationInner(element);
35300    }
35301  }
35302
35303  protected void composeOrganizationInner(Organization element) throws IOException {
35304      composeDomainResourceElements(element);
35305      if (element.hasIdentifier()) {
35306        openArray("identifier");
35307        for (Identifier e : element.getIdentifier()) 
35308          composeIdentifier(null, e);
35309        closeArray();
35310      };
35311      if (element.hasActiveElement()) {
35312        composeBooleanCore("active", element.getActiveElement(), false);
35313        composeBooleanExtras("active", element.getActiveElement(), false);
35314      }
35315      if (element.hasType()) {
35316        openArray("type");
35317        for (CodeableConcept e : element.getType()) 
35318          composeCodeableConcept(null, e);
35319        closeArray();
35320      };
35321      if (element.hasNameElement()) {
35322        composeStringCore("name", element.getNameElement(), false);
35323        composeStringExtras("name", element.getNameElement(), false);
35324      }
35325      if (element.hasAlias()) {
35326        openArray("alias");
35327        for (StringType e : element.getAlias()) 
35328          composeStringCore(null, e, true);
35329        closeArray();
35330        if (anyHasExtras(element.getAlias())) {
35331          openArray("_alias");
35332          for (StringType e : element.getAlias()) 
35333            composeStringExtras(null, e, true);
35334          closeArray();
35335        }
35336      };
35337      if (element.hasTelecom()) {
35338        openArray("telecom");
35339        for (ContactPoint e : element.getTelecom()) 
35340          composeContactPoint(null, e);
35341        closeArray();
35342      };
35343      if (element.hasAddress()) {
35344        openArray("address");
35345        for (Address e : element.getAddress()) 
35346          composeAddress(null, e);
35347        closeArray();
35348      };
35349      if (element.hasPartOf()) {
35350        composeReference("partOf", element.getPartOf());
35351      }
35352      if (element.hasContact()) {
35353        openArray("contact");
35354        for (Organization.OrganizationContactComponent e : element.getContact()) 
35355          composeOrganizationOrganizationContactComponent(null, e);
35356        closeArray();
35357      };
35358      if (element.hasEndpoint()) {
35359        openArray("endpoint");
35360        for (Reference e : element.getEndpoint()) 
35361          composeReference(null, e);
35362        closeArray();
35363      };
35364  }
35365
35366  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
35367    if (element != null) {
35368      open(name);
35369      composeOrganizationOrganizationContactComponentInner(element);
35370      close();
35371    }
35372  }
35373
35374  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
35375      composeBackbone(element);
35376      if (element.hasPurpose()) {
35377        composeCodeableConcept("purpose", element.getPurpose());
35378      }
35379      if (element.hasName()) {
35380        composeHumanName("name", element.getName());
35381      }
35382      if (element.hasTelecom()) {
35383        openArray("telecom");
35384        for (ContactPoint e : element.getTelecom()) 
35385          composeContactPoint(null, e);
35386        closeArray();
35387      };
35388      if (element.hasAddress()) {
35389        composeAddress("address", element.getAddress());
35390      }
35391  }
35392
35393  protected void composePatient(String name, Patient element) throws IOException {
35394    if (element != null) {
35395      prop("resourceType", name);
35396      composePatientInner(element);
35397    }
35398  }
35399
35400  protected void composePatientInner(Patient element) throws IOException {
35401      composeDomainResourceElements(element);
35402      if (element.hasIdentifier()) {
35403        openArray("identifier");
35404        for (Identifier e : element.getIdentifier()) 
35405          composeIdentifier(null, e);
35406        closeArray();
35407      };
35408      if (element.hasActiveElement()) {
35409        composeBooleanCore("active", element.getActiveElement(), false);
35410        composeBooleanExtras("active", element.getActiveElement(), false);
35411      }
35412      if (element.hasName()) {
35413        openArray("name");
35414        for (HumanName e : element.getName()) 
35415          composeHumanName(null, e);
35416        closeArray();
35417      };
35418      if (element.hasTelecom()) {
35419        openArray("telecom");
35420        for (ContactPoint e : element.getTelecom()) 
35421          composeContactPoint(null, e);
35422        closeArray();
35423      };
35424      if (element.hasGenderElement()) {
35425        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35426        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35427      }
35428      if (element.hasBirthDateElement()) {
35429        composeDateCore("birthDate", element.getBirthDateElement(), false);
35430        composeDateExtras("birthDate", element.getBirthDateElement(), false);
35431      }
35432      if (element.hasDeceased()) {
35433        composeType("deceased", element.getDeceased());
35434      }
35435      if (element.hasAddress()) {
35436        openArray("address");
35437        for (Address e : element.getAddress()) 
35438          composeAddress(null, e);
35439        closeArray();
35440      };
35441      if (element.hasMaritalStatus()) {
35442        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
35443      }
35444      if (element.hasMultipleBirth()) {
35445        composeType("multipleBirth", element.getMultipleBirth());
35446      }
35447      if (element.hasPhoto()) {
35448        openArray("photo");
35449        for (Attachment e : element.getPhoto()) 
35450          composeAttachment(null, e);
35451        closeArray();
35452      };
35453      if (element.hasContact()) {
35454        openArray("contact");
35455        for (Patient.ContactComponent e : element.getContact()) 
35456          composePatientContactComponent(null, e);
35457        closeArray();
35458      };
35459      if (element.hasAnimal()) {
35460        composePatientAnimalComponent("animal", element.getAnimal());
35461      }
35462      if (element.hasCommunication()) {
35463        openArray("communication");
35464        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
35465          composePatientPatientCommunicationComponent(null, e);
35466        closeArray();
35467      };
35468      if (element.hasGeneralPractitioner()) {
35469        openArray("generalPractitioner");
35470        for (Reference e : element.getGeneralPractitioner()) 
35471          composeReference(null, e);
35472        closeArray();
35473      };
35474      if (element.hasManagingOrganization()) {
35475        composeReference("managingOrganization", element.getManagingOrganization());
35476      }
35477      if (element.hasLink()) {
35478        openArray("link");
35479        for (Patient.PatientLinkComponent e : element.getLink()) 
35480          composePatientPatientLinkComponent(null, e);
35481        closeArray();
35482      };
35483  }
35484
35485  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
35486    if (element != null) {
35487      open(name);
35488      composePatientContactComponentInner(element);
35489      close();
35490    }
35491  }
35492
35493  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
35494      composeBackbone(element);
35495      if (element.hasRelationship()) {
35496        openArray("relationship");
35497        for (CodeableConcept e : element.getRelationship()) 
35498          composeCodeableConcept(null, e);
35499        closeArray();
35500      };
35501      if (element.hasName()) {
35502        composeHumanName("name", element.getName());
35503      }
35504      if (element.hasTelecom()) {
35505        openArray("telecom");
35506        for (ContactPoint e : element.getTelecom()) 
35507          composeContactPoint(null, e);
35508        closeArray();
35509      };
35510      if (element.hasAddress()) {
35511        composeAddress("address", element.getAddress());
35512      }
35513      if (element.hasGenderElement()) {
35514        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35515        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35516      }
35517      if (element.hasOrganization()) {
35518        composeReference("organization", element.getOrganization());
35519      }
35520      if (element.hasPeriod()) {
35521        composePeriod("period", element.getPeriod());
35522      }
35523  }
35524
35525  protected void composePatientAnimalComponent(String name, Patient.AnimalComponent element) throws IOException {
35526    if (element != null) {
35527      open(name);
35528      composePatientAnimalComponentInner(element);
35529      close();
35530    }
35531  }
35532
35533  protected void composePatientAnimalComponentInner(Patient.AnimalComponent element) throws IOException {
35534      composeBackbone(element);
35535      if (element.hasSpecies()) {
35536        composeCodeableConcept("species", element.getSpecies());
35537      }
35538      if (element.hasBreed()) {
35539        composeCodeableConcept("breed", element.getBreed());
35540      }
35541      if (element.hasGenderStatus()) {
35542        composeCodeableConcept("genderStatus", element.getGenderStatus());
35543      }
35544  }
35545
35546  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
35547    if (element != null) {
35548      open(name);
35549      composePatientPatientCommunicationComponentInner(element);
35550      close();
35551    }
35552  }
35553
35554  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
35555      composeBackbone(element);
35556      if (element.hasLanguage()) {
35557        composeCodeableConcept("language", element.getLanguage());
35558      }
35559      if (element.hasPreferredElement()) {
35560        composeBooleanCore("preferred", element.getPreferredElement(), false);
35561        composeBooleanExtras("preferred", element.getPreferredElement(), false);
35562      }
35563  }
35564
35565  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
35566    if (element != null) {
35567      open(name);
35568      composePatientPatientLinkComponentInner(element);
35569      close();
35570    }
35571  }
35572
35573  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
35574      composeBackbone(element);
35575      if (element.hasOther()) {
35576        composeReference("other", element.getOther());
35577      }
35578      if (element.hasTypeElement()) {
35579        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35580        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
35581      }
35582  }
35583
35584  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
35585    if (element != null) {
35586      prop("resourceType", name);
35587      composePaymentNoticeInner(element);
35588    }
35589  }
35590
35591  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
35592      composeDomainResourceElements(element);
35593      if (element.hasIdentifier()) {
35594        openArray("identifier");
35595        for (Identifier e : element.getIdentifier()) 
35596          composeIdentifier(null, e);
35597        closeArray();
35598      };
35599      if (element.hasStatusElement()) {
35600        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35601        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
35602      }
35603      if (element.hasRequest()) {
35604        composeReference("request", element.getRequest());
35605      }
35606      if (element.hasResponse()) {
35607        composeReference("response", element.getResponse());
35608      }
35609      if (element.hasStatusDateElement()) {
35610        composeDateCore("statusDate", element.getStatusDateElement(), false);
35611        composeDateExtras("statusDate", element.getStatusDateElement(), false);
35612      }
35613      if (element.hasCreatedElement()) {
35614        composeDateTimeCore("created", element.getCreatedElement(), false);
35615        composeDateTimeExtras("created", element.getCreatedElement(), false);
35616      }
35617      if (element.hasTarget()) {
35618        composeReference("target", element.getTarget());
35619      }
35620      if (element.hasProvider()) {
35621        composeReference("provider", element.getProvider());
35622      }
35623      if (element.hasOrganization()) {
35624        composeReference("organization", element.getOrganization());
35625      }
35626      if (element.hasPaymentStatus()) {
35627        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
35628      }
35629  }
35630
35631  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
35632    if (element != null) {
35633      prop("resourceType", name);
35634      composePaymentReconciliationInner(element);
35635    }
35636  }
35637
35638  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
35639      composeDomainResourceElements(element);
35640      if (element.hasIdentifier()) {
35641        openArray("identifier");
35642        for (Identifier e : element.getIdentifier()) 
35643          composeIdentifier(null, e);
35644        closeArray();
35645      };
35646      if (element.hasStatusElement()) {
35647        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35648        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
35649      }
35650      if (element.hasPeriod()) {
35651        composePeriod("period", element.getPeriod());
35652      }
35653      if (element.hasCreatedElement()) {
35654        composeDateTimeCore("created", element.getCreatedElement(), false);
35655        composeDateTimeExtras("created", element.getCreatedElement(), false);
35656      }
35657      if (element.hasOrganization()) {
35658        composeReference("organization", element.getOrganization());
35659      }
35660      if (element.hasRequest()) {
35661        composeReference("request", element.getRequest());
35662      }
35663      if (element.hasOutcome()) {
35664        composeCodeableConcept("outcome", element.getOutcome());
35665      }
35666      if (element.hasDispositionElement()) {
35667        composeStringCore("disposition", element.getDispositionElement(), false);
35668        composeStringExtras("disposition", element.getDispositionElement(), false);
35669      }
35670      if (element.hasRequestProvider()) {
35671        composeReference("requestProvider", element.getRequestProvider());
35672      }
35673      if (element.hasRequestOrganization()) {
35674        composeReference("requestOrganization", element.getRequestOrganization());
35675      }
35676      if (element.hasDetail()) {
35677        openArray("detail");
35678        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
35679          composePaymentReconciliationDetailsComponent(null, e);
35680        closeArray();
35681      };
35682      if (element.hasForm()) {
35683        composeCodeableConcept("form", element.getForm());
35684      }
35685      if (element.hasTotal()) {
35686        composeMoney("total", element.getTotal());
35687      }
35688      if (element.hasProcessNote()) {
35689        openArray("processNote");
35690        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
35691          composePaymentReconciliationNotesComponent(null, e);
35692        closeArray();
35693      };
35694  }
35695
35696  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
35697    if (element != null) {
35698      open(name);
35699      composePaymentReconciliationDetailsComponentInner(element);
35700      close();
35701    }
35702  }
35703
35704  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
35705      composeBackbone(element);
35706      if (element.hasType()) {
35707        composeCodeableConcept("type", element.getType());
35708      }
35709      if (element.hasRequest()) {
35710        composeReference("request", element.getRequest());
35711      }
35712      if (element.hasResponse()) {
35713        composeReference("response", element.getResponse());
35714      }
35715      if (element.hasSubmitter()) {
35716        composeReference("submitter", element.getSubmitter());
35717      }
35718      if (element.hasPayee()) {
35719        composeReference("payee", element.getPayee());
35720      }
35721      if (element.hasDateElement()) {
35722        composeDateCore("date", element.getDateElement(), false);
35723        composeDateExtras("date", element.getDateElement(), false);
35724      }
35725      if (element.hasAmount()) {
35726        composeMoney("amount", element.getAmount());
35727      }
35728  }
35729
35730  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
35731    if (element != null) {
35732      open(name);
35733      composePaymentReconciliationNotesComponentInner(element);
35734      close();
35735    }
35736  }
35737
35738  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
35739      composeBackbone(element);
35740      if (element.hasType()) {
35741        composeCodeableConcept("type", element.getType());
35742      }
35743      if (element.hasTextElement()) {
35744        composeStringCore("text", element.getTextElement(), false);
35745        composeStringExtras("text", element.getTextElement(), false);
35746      }
35747  }
35748
35749  protected void composePerson(String name, Person element) throws IOException {
35750    if (element != null) {
35751      prop("resourceType", name);
35752      composePersonInner(element);
35753    }
35754  }
35755
35756  protected void composePersonInner(Person element) throws IOException {
35757      composeDomainResourceElements(element);
35758      if (element.hasIdentifier()) {
35759        openArray("identifier");
35760        for (Identifier e : element.getIdentifier()) 
35761          composeIdentifier(null, e);
35762        closeArray();
35763      };
35764      if (element.hasName()) {
35765        openArray("name");
35766        for (HumanName e : element.getName()) 
35767          composeHumanName(null, e);
35768        closeArray();
35769      };
35770      if (element.hasTelecom()) {
35771        openArray("telecom");
35772        for (ContactPoint e : element.getTelecom()) 
35773          composeContactPoint(null, e);
35774        closeArray();
35775      };
35776      if (element.hasGenderElement()) {
35777        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35778        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
35779      }
35780      if (element.hasBirthDateElement()) {
35781        composeDateCore("birthDate", element.getBirthDateElement(), false);
35782        composeDateExtras("birthDate", element.getBirthDateElement(), false);
35783      }
35784      if (element.hasAddress()) {
35785        openArray("address");
35786        for (Address e : element.getAddress()) 
35787          composeAddress(null, e);
35788        closeArray();
35789      };
35790      if (element.hasPhoto()) {
35791        composeAttachment("photo", element.getPhoto());
35792      }
35793      if (element.hasManagingOrganization()) {
35794        composeReference("managingOrganization", element.getManagingOrganization());
35795      }
35796      if (element.hasActiveElement()) {
35797        composeBooleanCore("active", element.getActiveElement(), false);
35798        composeBooleanExtras("active", element.getActiveElement(), false);
35799      }
35800      if (element.hasLink()) {
35801        openArray("link");
35802        for (Person.PersonLinkComponent e : element.getLink()) 
35803          composePersonPersonLinkComponent(null, e);
35804        closeArray();
35805      };
35806  }
35807
35808  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
35809    if (element != null) {
35810      open(name);
35811      composePersonPersonLinkComponentInner(element);
35812      close();
35813    }
35814  }
35815
35816  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
35817      composeBackbone(element);
35818      if (element.hasTarget()) {
35819        composeReference("target", element.getTarget());
35820      }
35821      if (element.hasAssuranceElement()) {
35822        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
35823        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
35824      }
35825  }
35826
35827  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
35828    if (element != null) {
35829      prop("resourceType", name);
35830      composePlanDefinitionInner(element);
35831    }
35832  }
35833
35834  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
35835      composeDomainResourceElements(element);
35836      if (element.hasUrlElement()) {
35837        composeUriCore("url", element.getUrlElement(), false);
35838        composeUriExtras("url", element.getUrlElement(), false);
35839      }
35840      if (element.hasIdentifier()) {
35841        openArray("identifier");
35842        for (Identifier e : element.getIdentifier()) 
35843          composeIdentifier(null, e);
35844        closeArray();
35845      };
35846      if (element.hasVersionElement()) {
35847        composeStringCore("version", element.getVersionElement(), false);
35848        composeStringExtras("version", element.getVersionElement(), false);
35849      }
35850      if (element.hasNameElement()) {
35851        composeStringCore("name", element.getNameElement(), false);
35852        composeStringExtras("name", element.getNameElement(), false);
35853      }
35854      if (element.hasTitleElement()) {
35855        composeStringCore("title", element.getTitleElement(), false);
35856        composeStringExtras("title", element.getTitleElement(), false);
35857      }
35858      if (element.hasType()) {
35859        composeCodeableConcept("type", element.getType());
35860      }
35861      if (element.hasStatusElement()) {
35862        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35863        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
35864      }
35865      if (element.hasExperimentalElement()) {
35866        composeBooleanCore("experimental", element.getExperimentalElement(), false);
35867        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
35868      }
35869      if (element.hasDateElement()) {
35870        composeDateTimeCore("date", element.getDateElement(), false);
35871        composeDateTimeExtras("date", element.getDateElement(), false);
35872      }
35873      if (element.hasPublisherElement()) {
35874        composeStringCore("publisher", element.getPublisherElement(), false);
35875        composeStringExtras("publisher", element.getPublisherElement(), false);
35876      }
35877      if (element.hasDescriptionElement()) {
35878        composeMarkdownCore("description", element.getDescriptionElement(), false);
35879        composeMarkdownExtras("description", element.getDescriptionElement(), false);
35880      }
35881      if (element.hasPurposeElement()) {
35882        composeMarkdownCore("purpose", element.getPurposeElement(), false);
35883        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
35884      }
35885      if (element.hasUsageElement()) {
35886        composeStringCore("usage", element.getUsageElement(), false);
35887        composeStringExtras("usage", element.getUsageElement(), false);
35888      }
35889      if (element.hasApprovalDateElement()) {
35890        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
35891        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
35892      }
35893      if (element.hasLastReviewDateElement()) {
35894        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
35895        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
35896      }
35897      if (element.hasEffectivePeriod()) {
35898        composePeriod("effectivePeriod", element.getEffectivePeriod());
35899      }
35900      if (element.hasUseContext()) {
35901        openArray("useContext");
35902        for (UsageContext e : element.getUseContext()) 
35903          composeUsageContext(null, e);
35904        closeArray();
35905      };
35906      if (element.hasJurisdiction()) {
35907        openArray("jurisdiction");
35908        for (CodeableConcept e : element.getJurisdiction()) 
35909          composeCodeableConcept(null, e);
35910        closeArray();
35911      };
35912      if (element.hasTopic()) {
35913        openArray("topic");
35914        for (CodeableConcept e : element.getTopic()) 
35915          composeCodeableConcept(null, e);
35916        closeArray();
35917      };
35918      if (element.hasContributor()) {
35919        openArray("contributor");
35920        for (Contributor e : element.getContributor()) 
35921          composeContributor(null, e);
35922        closeArray();
35923      };
35924      if (element.hasContact()) {
35925        openArray("contact");
35926        for (ContactDetail e : element.getContact()) 
35927          composeContactDetail(null, e);
35928        closeArray();
35929      };
35930      if (element.hasCopyrightElement()) {
35931        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35932        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35933      }
35934      if (element.hasRelatedArtifact()) {
35935        openArray("relatedArtifact");
35936        for (RelatedArtifact e : element.getRelatedArtifact()) 
35937          composeRelatedArtifact(null, e);
35938        closeArray();
35939      };
35940      if (element.hasLibrary()) {
35941        openArray("library");
35942        for (Reference e : element.getLibrary()) 
35943          composeReference(null, e);
35944        closeArray();
35945      };
35946      if (element.hasGoal()) {
35947        openArray("goal");
35948        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
35949          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
35950        closeArray();
35951      };
35952      if (element.hasAction()) {
35953        openArray("action");
35954        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
35955          composePlanDefinitionPlanDefinitionActionComponent(null, e);
35956        closeArray();
35957      };
35958  }
35959
35960  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
35961    if (element != null) {
35962      open(name);
35963      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
35964      close();
35965    }
35966  }
35967
35968  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
35969      composeBackbone(element);
35970      if (element.hasCategory()) {
35971        composeCodeableConcept("category", element.getCategory());
35972      }
35973      if (element.hasDescription()) {
35974        composeCodeableConcept("description", element.getDescription());
35975      }
35976      if (element.hasPriority()) {
35977        composeCodeableConcept("priority", element.getPriority());
35978      }
35979      if (element.hasStart()) {
35980        composeCodeableConcept("start", element.getStart());
35981      }
35982      if (element.hasAddresses()) {
35983        openArray("addresses");
35984        for (CodeableConcept e : element.getAddresses()) 
35985          composeCodeableConcept(null, e);
35986        closeArray();
35987      };
35988      if (element.hasDocumentation()) {
35989        openArray("documentation");
35990        for (RelatedArtifact e : element.getDocumentation()) 
35991          composeRelatedArtifact(null, e);
35992        closeArray();
35993      };
35994      if (element.hasTarget()) {
35995        openArray("target");
35996        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
35997          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
35998        closeArray();
35999      };
36000  }
36001
36002  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
36003    if (element != null) {
36004      open(name);
36005      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
36006      close();
36007    }
36008  }
36009
36010  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
36011      composeBackbone(element);
36012      if (element.hasMeasure()) {
36013        composeCodeableConcept("measure", element.getMeasure());
36014      }
36015      if (element.hasDetail()) {
36016        composeType("detail", element.getDetail());
36017      }
36018      if (element.hasDue()) {
36019        composeDuration("due", element.getDue());
36020      }
36021  }
36022
36023  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36024    if (element != null) {
36025      open(name);
36026      composePlanDefinitionPlanDefinitionActionComponentInner(element);
36027      close();
36028    }
36029  }
36030
36031  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
36032      composeBackbone(element);
36033      if (element.hasLabelElement()) {
36034        composeStringCore("label", element.getLabelElement(), false);
36035        composeStringExtras("label", element.getLabelElement(), false);
36036      }
36037      if (element.hasTitleElement()) {
36038        composeStringCore("title", element.getTitleElement(), false);
36039        composeStringExtras("title", element.getTitleElement(), false);
36040      }
36041      if (element.hasDescriptionElement()) {
36042        composeStringCore("description", element.getDescriptionElement(), false);
36043        composeStringExtras("description", element.getDescriptionElement(), false);
36044      }
36045      if (element.hasTextEquivalentElement()) {
36046        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
36047        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
36048      }
36049      if (element.hasCode()) {
36050        openArray("code");
36051        for (CodeableConcept e : element.getCode()) 
36052          composeCodeableConcept(null, e);
36053        closeArray();
36054      };
36055      if (element.hasReason()) {
36056        openArray("reason");
36057        for (CodeableConcept e : element.getReason()) 
36058          composeCodeableConcept(null, e);
36059        closeArray();
36060      };
36061      if (element.hasDocumentation()) {
36062        openArray("documentation");
36063        for (RelatedArtifact e : element.getDocumentation()) 
36064          composeRelatedArtifact(null, e);
36065        closeArray();
36066      };
36067      if (element.hasGoalId()) {
36068        openArray("goalId");
36069        for (IdType e : element.getGoalId()) 
36070          composeIdCore(null, e, true);
36071        closeArray();
36072        if (anyHasExtras(element.getGoalId())) {
36073          openArray("_goalId");
36074          for (IdType e : element.getGoalId()) 
36075            composeIdExtras(null, e, true);
36076          closeArray();
36077        }
36078      };
36079      if (element.hasTriggerDefinition()) {
36080        openArray("triggerDefinition");
36081        for (TriggerDefinition e : element.getTriggerDefinition()) 
36082          composeTriggerDefinition(null, e);
36083        closeArray();
36084      };
36085      if (element.hasCondition()) {
36086        openArray("condition");
36087        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
36088          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
36089        closeArray();
36090      };
36091      if (element.hasInput()) {
36092        openArray("input");
36093        for (DataRequirement e : element.getInput()) 
36094          composeDataRequirement(null, e);
36095        closeArray();
36096      };
36097      if (element.hasOutput()) {
36098        openArray("output");
36099        for (DataRequirement e : element.getOutput()) 
36100          composeDataRequirement(null, e);
36101        closeArray();
36102      };
36103      if (element.hasRelatedAction()) {
36104        openArray("relatedAction");
36105        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
36106          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
36107        closeArray();
36108      };
36109      if (element.hasTiming()) {
36110        composeType("timing", element.getTiming());
36111      }
36112      if (element.hasParticipant()) {
36113        openArray("participant");
36114        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
36115          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
36116        closeArray();
36117      };
36118      if (element.hasType()) {
36119        composeCoding("type", element.getType());
36120      }
36121      if (element.hasGroupingBehaviorElement()) {
36122        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36123        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
36124      }
36125      if (element.hasSelectionBehaviorElement()) {
36126        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36127        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
36128      }
36129      if (element.hasRequiredBehaviorElement()) {
36130        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36131        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
36132      }
36133      if (element.hasPrecheckBehaviorElement()) {
36134        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36135        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
36136      }
36137      if (element.hasCardinalityBehaviorElement()) {
36138        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36139        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
36140      }
36141      if (element.hasDefinition()) {
36142        composeReference("definition", element.getDefinition());
36143      }
36144      if (element.hasTransform()) {
36145        composeReference("transform", element.getTransform());
36146      }
36147      if (element.hasDynamicValue()) {
36148        openArray("dynamicValue");
36149        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
36150          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
36151        closeArray();
36152      };
36153      if (element.hasAction()) {
36154        openArray("action");
36155        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
36156          composePlanDefinitionPlanDefinitionActionComponent(null, e);
36157        closeArray();
36158      };
36159  }
36160
36161  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36162    if (element != null) {
36163      open(name);
36164      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
36165      close();
36166    }
36167  }
36168
36169  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
36170      composeBackbone(element);
36171      if (element.hasKindElement()) {
36172        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36173        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
36174      }
36175      if (element.hasDescriptionElement()) {
36176        composeStringCore("description", element.getDescriptionElement(), false);
36177        composeStringExtras("description", element.getDescriptionElement(), false);
36178      }
36179      if (element.hasLanguageElement()) {
36180        composeStringCore("language", element.getLanguageElement(), false);
36181        composeStringExtras("language", element.getLanguageElement(), false);
36182      }
36183      if (element.hasExpressionElement()) {
36184        composeStringCore("expression", element.getExpressionElement(), false);
36185        composeStringExtras("expression", element.getExpressionElement(), false);
36186      }
36187  }
36188
36189  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36190    if (element != null) {
36191      open(name);
36192      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
36193      close();
36194    }
36195  }
36196
36197  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
36198      composeBackbone(element);
36199      if (element.hasActionIdElement()) {
36200        composeIdCore("actionId", element.getActionIdElement(), false);
36201        composeIdExtras("actionId", element.getActionIdElement(), false);
36202      }
36203      if (element.hasRelationshipElement()) {
36204        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36205        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
36206      }
36207      if (element.hasOffset()) {
36208        composeType("offset", element.getOffset());
36209      }
36210  }
36211
36212  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36213    if (element != null) {
36214      open(name);
36215      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
36216      close();
36217    }
36218  }
36219
36220  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
36221      composeBackbone(element);
36222      if (element.hasTypeElement()) {
36223        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36224        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
36225      }
36226      if (element.hasRole()) {
36227        composeCodeableConcept("role", element.getRole());
36228      }
36229  }
36230
36231  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36232    if (element != null) {
36233      open(name);
36234      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
36235      close();
36236    }
36237  }
36238
36239  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
36240      composeBackbone(element);
36241      if (element.hasDescriptionElement()) {
36242        composeStringCore("description", element.getDescriptionElement(), false);
36243        composeStringExtras("description", element.getDescriptionElement(), false);
36244      }
36245      if (element.hasPathElement()) {
36246        composeStringCore("path", element.getPathElement(), false);
36247        composeStringExtras("path", element.getPathElement(), false);
36248      }
36249      if (element.hasLanguageElement()) {
36250        composeStringCore("language", element.getLanguageElement(), false);
36251        composeStringExtras("language", element.getLanguageElement(), false);
36252      }
36253      if (element.hasExpressionElement()) {
36254        composeStringCore("expression", element.getExpressionElement(), false);
36255        composeStringExtras("expression", element.getExpressionElement(), false);
36256      }
36257  }
36258
36259  protected void composePractitioner(String name, Practitioner element) throws IOException {
36260    if (element != null) {
36261      prop("resourceType", name);
36262      composePractitionerInner(element);
36263    }
36264  }
36265
36266  protected void composePractitionerInner(Practitioner element) throws IOException {
36267      composeDomainResourceElements(element);
36268      if (element.hasIdentifier()) {
36269        openArray("identifier");
36270        for (Identifier e : element.getIdentifier()) 
36271          composeIdentifier(null, e);
36272        closeArray();
36273      };
36274      if (element.hasActiveElement()) {
36275        composeBooleanCore("active", element.getActiveElement(), false);
36276        composeBooleanExtras("active", element.getActiveElement(), false);
36277      }
36278      if (element.hasName()) {
36279        openArray("name");
36280        for (HumanName e : element.getName()) 
36281          composeHumanName(null, e);
36282        closeArray();
36283      };
36284      if (element.hasTelecom()) {
36285        openArray("telecom");
36286        for (ContactPoint e : element.getTelecom()) 
36287          composeContactPoint(null, e);
36288        closeArray();
36289      };
36290      if (element.hasAddress()) {
36291        openArray("address");
36292        for (Address e : element.getAddress()) 
36293          composeAddress(null, e);
36294        closeArray();
36295      };
36296      if (element.hasGenderElement()) {
36297        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36298        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
36299      }
36300      if (element.hasBirthDateElement()) {
36301        composeDateCore("birthDate", element.getBirthDateElement(), false);
36302        composeDateExtras("birthDate", element.getBirthDateElement(), false);
36303      }
36304      if (element.hasPhoto()) {
36305        openArray("photo");
36306        for (Attachment e : element.getPhoto()) 
36307          composeAttachment(null, e);
36308        closeArray();
36309      };
36310      if (element.hasQualification()) {
36311        openArray("qualification");
36312        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
36313          composePractitionerPractitionerQualificationComponent(null, e);
36314        closeArray();
36315      };
36316      if (element.hasCommunication()) {
36317        openArray("communication");
36318        for (CodeableConcept e : element.getCommunication()) 
36319          composeCodeableConcept(null, e);
36320        closeArray();
36321      };
36322  }
36323
36324  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
36325    if (element != null) {
36326      open(name);
36327      composePractitionerPractitionerQualificationComponentInner(element);
36328      close();
36329    }
36330  }
36331
36332  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
36333      composeBackbone(element);
36334      if (element.hasIdentifier()) {
36335        openArray("identifier");
36336        for (Identifier e : element.getIdentifier()) 
36337          composeIdentifier(null, e);
36338        closeArray();
36339      };
36340      if (element.hasCode()) {
36341        composeCodeableConcept("code", element.getCode());
36342      }
36343      if (element.hasPeriod()) {
36344        composePeriod("period", element.getPeriod());
36345      }
36346      if (element.hasIssuer()) {
36347        composeReference("issuer", element.getIssuer());
36348      }
36349  }
36350
36351  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
36352    if (element != null) {
36353      prop("resourceType", name);
36354      composePractitionerRoleInner(element);
36355    }
36356  }
36357
36358  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
36359      composeDomainResourceElements(element);
36360      if (element.hasIdentifier()) {
36361        openArray("identifier");
36362        for (Identifier e : element.getIdentifier()) 
36363          composeIdentifier(null, e);
36364        closeArray();
36365      };
36366      if (element.hasActiveElement()) {
36367        composeBooleanCore("active", element.getActiveElement(), false);
36368        composeBooleanExtras("active", element.getActiveElement(), false);
36369      }
36370      if (element.hasPeriod()) {
36371        composePeriod("period", element.getPeriod());
36372      }
36373      if (element.hasPractitioner()) {
36374        composeReference("practitioner", element.getPractitioner());
36375      }
36376      if (element.hasOrganization()) {
36377        composeReference("organization", element.getOrganization());
36378      }
36379      if (element.hasCode()) {
36380        openArray("code");
36381        for (CodeableConcept e : element.getCode()) 
36382          composeCodeableConcept(null, e);
36383        closeArray();
36384      };
36385      if (element.hasSpecialty()) {
36386        openArray("specialty");
36387        for (CodeableConcept e : element.getSpecialty()) 
36388          composeCodeableConcept(null, e);
36389        closeArray();
36390      };
36391      if (element.hasLocation()) {
36392        openArray("location");
36393        for (Reference e : element.getLocation()) 
36394          composeReference(null, e);
36395        closeArray();
36396      };
36397      if (element.hasHealthcareService()) {
36398        openArray("healthcareService");
36399        for (Reference e : element.getHealthcareService()) 
36400          composeReference(null, e);
36401        closeArray();
36402      };
36403      if (element.hasTelecom()) {
36404        openArray("telecom");
36405        for (ContactPoint e : element.getTelecom()) 
36406          composeContactPoint(null, e);
36407        closeArray();
36408      };
36409      if (element.hasAvailableTime()) {
36410        openArray("availableTime");
36411        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
36412          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
36413        closeArray();
36414      };
36415      if (element.hasNotAvailable()) {
36416        openArray("notAvailable");
36417        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
36418          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
36419        closeArray();
36420      };
36421      if (element.hasAvailabilityExceptionsElement()) {
36422        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36423        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
36424      }
36425      if (element.hasEndpoint()) {
36426        openArray("endpoint");
36427        for (Reference e : element.getEndpoint()) 
36428          composeReference(null, e);
36429        closeArray();
36430      };
36431  }
36432
36433  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36434    if (element != null) {
36435      open(name);
36436      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
36437      close();
36438    }
36439  }
36440
36441  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
36442      composeBackbone(element);
36443      if (element.hasDaysOfWeek()) {
36444        openArray("daysOfWeek");
36445        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36446          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36447        closeArray();
36448        if (anyHasExtras(element.getDaysOfWeek())) {
36449          openArray("_daysOfWeek");
36450          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
36451            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
36452          closeArray();
36453        }
36454      };
36455      if (element.hasAllDayElement()) {
36456        composeBooleanCore("allDay", element.getAllDayElement(), false);
36457        composeBooleanExtras("allDay", element.getAllDayElement(), false);
36458      }
36459      if (element.hasAvailableStartTimeElement()) {
36460        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
36461        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
36462      }
36463      if (element.hasAvailableEndTimeElement()) {
36464        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
36465        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
36466      }
36467  }
36468
36469  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36470    if (element != null) {
36471      open(name);
36472      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
36473      close();
36474    }
36475  }
36476
36477  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
36478      composeBackbone(element);
36479      if (element.hasDescriptionElement()) {
36480        composeStringCore("description", element.getDescriptionElement(), false);
36481        composeStringExtras("description", element.getDescriptionElement(), false);
36482      }
36483      if (element.hasDuring()) {
36484        composePeriod("during", element.getDuring());
36485      }
36486  }
36487
36488  protected void composeProcedure(String name, Procedure element) throws IOException {
36489    if (element != null) {
36490      prop("resourceType", name);
36491      composeProcedureInner(element);
36492    }
36493  }
36494
36495  protected void composeProcedureInner(Procedure element) throws IOException {
36496      composeDomainResourceElements(element);
36497      if (element.hasIdentifier()) {
36498        openArray("identifier");
36499        for (Identifier e : element.getIdentifier()) 
36500          composeIdentifier(null, e);
36501        closeArray();
36502      };
36503      if (element.hasDefinition()) {
36504        openArray("definition");
36505        for (Reference e : element.getDefinition()) 
36506          composeReference(null, e);
36507        closeArray();
36508      };
36509      if (element.hasBasedOn()) {
36510        openArray("basedOn");
36511        for (Reference e : element.getBasedOn()) 
36512          composeReference(null, e);
36513        closeArray();
36514      };
36515      if (element.hasPartOf()) {
36516        openArray("partOf");
36517        for (Reference e : element.getPartOf()) 
36518          composeReference(null, e);
36519        closeArray();
36520      };
36521      if (element.hasStatusElement()) {
36522        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36523        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
36524      }
36525      if (element.hasNotDoneElement()) {
36526        composeBooleanCore("notDone", element.getNotDoneElement(), false);
36527        composeBooleanExtras("notDone", element.getNotDoneElement(), false);
36528      }
36529      if (element.hasNotDoneReason()) {
36530        composeCodeableConcept("notDoneReason", element.getNotDoneReason());
36531      }
36532      if (element.hasCategory()) {
36533        composeCodeableConcept("category", element.getCategory());
36534      }
36535      if (element.hasCode()) {
36536        composeCodeableConcept("code", element.getCode());
36537      }
36538      if (element.hasSubject()) {
36539        composeReference("subject", element.getSubject());
36540      }
36541      if (element.hasContext()) {
36542        composeReference("context", element.getContext());
36543      }
36544      if (element.hasPerformed()) {
36545        composeType("performed", element.getPerformed());
36546      }
36547      if (element.hasPerformer()) {
36548        openArray("performer");
36549        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
36550          composeProcedureProcedurePerformerComponent(null, e);
36551        closeArray();
36552      };
36553      if (element.hasLocation()) {
36554        composeReference("location", element.getLocation());
36555      }
36556      if (element.hasReasonCode()) {
36557        openArray("reasonCode");
36558        for (CodeableConcept e : element.getReasonCode()) 
36559          composeCodeableConcept(null, e);
36560        closeArray();
36561      };
36562      if (element.hasReasonReference()) {
36563        openArray("reasonReference");
36564        for (Reference e : element.getReasonReference()) 
36565          composeReference(null, e);
36566        closeArray();
36567      };
36568      if (element.hasBodySite()) {
36569        openArray("bodySite");
36570        for (CodeableConcept e : element.getBodySite()) 
36571          composeCodeableConcept(null, e);
36572        closeArray();
36573      };
36574      if (element.hasOutcome()) {
36575        composeCodeableConcept("outcome", element.getOutcome());
36576      }
36577      if (element.hasReport()) {
36578        openArray("report");
36579        for (Reference e : element.getReport()) 
36580          composeReference(null, e);
36581        closeArray();
36582      };
36583      if (element.hasComplication()) {
36584        openArray("complication");
36585        for (CodeableConcept e : element.getComplication()) 
36586          composeCodeableConcept(null, e);
36587        closeArray();
36588      };
36589      if (element.hasComplicationDetail()) {
36590        openArray("complicationDetail");
36591        for (Reference e : element.getComplicationDetail()) 
36592          composeReference(null, e);
36593        closeArray();
36594      };
36595      if (element.hasFollowUp()) {
36596        openArray("followUp");
36597        for (CodeableConcept e : element.getFollowUp()) 
36598          composeCodeableConcept(null, e);
36599        closeArray();
36600      };
36601      if (element.hasNote()) {
36602        openArray("note");
36603        for (Annotation e : element.getNote()) 
36604          composeAnnotation(null, e);
36605        closeArray();
36606      };
36607      if (element.hasFocalDevice()) {
36608        openArray("focalDevice");
36609        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
36610          composeProcedureProcedureFocalDeviceComponent(null, e);
36611        closeArray();
36612      };
36613      if (element.hasUsedReference()) {
36614        openArray("usedReference");
36615        for (Reference e : element.getUsedReference()) 
36616          composeReference(null, e);
36617        closeArray();
36618      };
36619      if (element.hasUsedCode()) {
36620        openArray("usedCode");
36621        for (CodeableConcept e : element.getUsedCode()) 
36622          composeCodeableConcept(null, e);
36623        closeArray();
36624      };
36625  }
36626
36627  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
36628    if (element != null) {
36629      open(name);
36630      composeProcedureProcedurePerformerComponentInner(element);
36631      close();
36632    }
36633  }
36634
36635  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
36636      composeBackbone(element);
36637      if (element.hasRole()) {
36638        composeCodeableConcept("role", element.getRole());
36639      }
36640      if (element.hasActor()) {
36641        composeReference("actor", element.getActor());
36642      }
36643      if (element.hasOnBehalfOf()) {
36644        composeReference("onBehalfOf", element.getOnBehalfOf());
36645      }
36646  }
36647
36648  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36649    if (element != null) {
36650      open(name);
36651      composeProcedureProcedureFocalDeviceComponentInner(element);
36652      close();
36653    }
36654  }
36655
36656  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
36657      composeBackbone(element);
36658      if (element.hasAction()) {
36659        composeCodeableConcept("action", element.getAction());
36660      }
36661      if (element.hasManipulated()) {
36662        composeReference("manipulated", element.getManipulated());
36663      }
36664  }
36665
36666  protected void composeProcedureRequest(String name, ProcedureRequest element) throws IOException {
36667    if (element != null) {
36668      prop("resourceType", name);
36669      composeProcedureRequestInner(element);
36670    }
36671  }
36672
36673  protected void composeProcedureRequestInner(ProcedureRequest element) throws IOException {
36674      composeDomainResourceElements(element);
36675      if (element.hasIdentifier()) {
36676        openArray("identifier");
36677        for (Identifier e : element.getIdentifier()) 
36678          composeIdentifier(null, e);
36679        closeArray();
36680      };
36681      if (element.hasDefinition()) {
36682        openArray("definition");
36683        for (Reference e : element.getDefinition()) 
36684          composeReference(null, e);
36685        closeArray();
36686      };
36687      if (element.hasBasedOn()) {
36688        openArray("basedOn");
36689        for (Reference e : element.getBasedOn()) 
36690          composeReference(null, e);
36691        closeArray();
36692      };
36693      if (element.hasReplaces()) {
36694        openArray("replaces");
36695        for (Reference e : element.getReplaces()) 
36696          composeReference(null, e);
36697        closeArray();
36698      };
36699      if (element.hasRequisition()) {
36700        composeIdentifier("requisition", element.getRequisition());
36701      }
36702      if (element.hasStatusElement()) {
36703        composeEnumerationCore("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
36704        composeEnumerationExtras("status", element.getStatusElement(), new ProcedureRequest.ProcedureRequestStatusEnumFactory(), false);
36705      }
36706      if (element.hasIntentElement()) {
36707        composeEnumerationCore("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
36708        composeEnumerationExtras("intent", element.getIntentElement(), new ProcedureRequest.ProcedureRequestIntentEnumFactory(), false);
36709      }
36710      if (element.hasPriorityElement()) {
36711        composeEnumerationCore("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
36712        composeEnumerationExtras("priority", element.getPriorityElement(), new ProcedureRequest.ProcedureRequestPriorityEnumFactory(), false);
36713      }
36714      if (element.hasDoNotPerformElement()) {
36715        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
36716        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
36717      }
36718      if (element.hasCategory()) {
36719        openArray("category");
36720        for (CodeableConcept e : element.getCategory()) 
36721          composeCodeableConcept(null, e);
36722        closeArray();
36723      };
36724      if (element.hasCode()) {
36725        composeCodeableConcept("code", element.getCode());
36726      }
36727      if (element.hasSubject()) {
36728        composeReference("subject", element.getSubject());
36729      }
36730      if (element.hasContext()) {
36731        composeReference("context", element.getContext());
36732      }
36733      if (element.hasOccurrence()) {
36734        composeType("occurrence", element.getOccurrence());
36735      }
36736      if (element.hasAsNeeded()) {
36737        composeType("asNeeded", element.getAsNeeded());
36738      }
36739      if (element.hasAuthoredOnElement()) {
36740        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
36741        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
36742      }
36743      if (element.hasRequester()) {
36744        composeProcedureRequestProcedureRequestRequesterComponent("requester", element.getRequester());
36745      }
36746      if (element.hasPerformerType()) {
36747        composeCodeableConcept("performerType", element.getPerformerType());
36748      }
36749      if (element.hasPerformer()) {
36750        composeReference("performer", element.getPerformer());
36751      }
36752      if (element.hasReasonCode()) {
36753        openArray("reasonCode");
36754        for (CodeableConcept e : element.getReasonCode()) 
36755          composeCodeableConcept(null, e);
36756        closeArray();
36757      };
36758      if (element.hasReasonReference()) {
36759        openArray("reasonReference");
36760        for (Reference e : element.getReasonReference()) 
36761          composeReference(null, e);
36762        closeArray();
36763      };
36764      if (element.hasSupportingInfo()) {
36765        openArray("supportingInfo");
36766        for (Reference e : element.getSupportingInfo()) 
36767          composeReference(null, e);
36768        closeArray();
36769      };
36770      if (element.hasSpecimen()) {
36771        openArray("specimen");
36772        for (Reference e : element.getSpecimen()) 
36773          composeReference(null, e);
36774        closeArray();
36775      };
36776      if (element.hasBodySite()) {
36777        openArray("bodySite");
36778        for (CodeableConcept e : element.getBodySite()) 
36779          composeCodeableConcept(null, e);
36780        closeArray();
36781      };
36782      if (element.hasNote()) {
36783        openArray("note");
36784        for (Annotation e : element.getNote()) 
36785          composeAnnotation(null, e);
36786        closeArray();
36787      };
36788      if (element.hasRelevantHistory()) {
36789        openArray("relevantHistory");
36790        for (Reference e : element.getRelevantHistory()) 
36791          composeReference(null, e);
36792        closeArray();
36793      };
36794  }
36795
36796  protected void composeProcedureRequestProcedureRequestRequesterComponent(String name, ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
36797    if (element != null) {
36798      open(name);
36799      composeProcedureRequestProcedureRequestRequesterComponentInner(element);
36800      close();
36801    }
36802  }
36803
36804  protected void composeProcedureRequestProcedureRequestRequesterComponentInner(ProcedureRequest.ProcedureRequestRequesterComponent element) throws IOException {
36805      composeBackbone(element);
36806      if (element.hasAgent()) {
36807        composeReference("agent", element.getAgent());
36808      }
36809      if (element.hasOnBehalfOf()) {
36810        composeReference("onBehalfOf", element.getOnBehalfOf());
36811      }
36812  }
36813
36814  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
36815    if (element != null) {
36816      prop("resourceType", name);
36817      composeProcessRequestInner(element);
36818    }
36819  }
36820
36821  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
36822      composeDomainResourceElements(element);
36823      if (element.hasIdentifier()) {
36824        openArray("identifier");
36825        for (Identifier e : element.getIdentifier()) 
36826          composeIdentifier(null, e);
36827        closeArray();
36828      };
36829      if (element.hasStatusElement()) {
36830        composeEnumerationCore("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
36831        composeEnumerationExtras("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
36832      }
36833      if (element.hasActionElement()) {
36834        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
36835        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
36836      }
36837      if (element.hasTarget()) {
36838        composeReference("target", element.getTarget());
36839      }
36840      if (element.hasCreatedElement()) {
36841        composeDateTimeCore("created", element.getCreatedElement(), false);
36842        composeDateTimeExtras("created", element.getCreatedElement(), false);
36843      }
36844      if (element.hasProvider()) {
36845        composeReference("provider", element.getProvider());
36846      }
36847      if (element.hasOrganization()) {
36848        composeReference("organization", element.getOrganization());
36849      }
36850      if (element.hasRequest()) {
36851        composeReference("request", element.getRequest());
36852      }
36853      if (element.hasResponse()) {
36854        composeReference("response", element.getResponse());
36855      }
36856      if (element.hasNullifyElement()) {
36857        composeBooleanCore("nullify", element.getNullifyElement(), false);
36858        composeBooleanExtras("nullify", element.getNullifyElement(), false);
36859      }
36860      if (element.hasReferenceElement()) {
36861        composeStringCore("reference", element.getReferenceElement(), false);
36862        composeStringExtras("reference", element.getReferenceElement(), false);
36863      }
36864      if (element.hasItem()) {
36865        openArray("item");
36866        for (ProcessRequest.ItemsComponent e : element.getItem()) 
36867          composeProcessRequestItemsComponent(null, e);
36868        closeArray();
36869      };
36870      if (element.hasInclude()) {
36871        openArray("include");
36872        for (StringType e : element.getInclude()) 
36873          composeStringCore(null, e, true);
36874        closeArray();
36875        if (anyHasExtras(element.getInclude())) {
36876          openArray("_include");
36877          for (StringType e : element.getInclude()) 
36878            composeStringExtras(null, e, true);
36879          closeArray();
36880        }
36881      };
36882      if (element.hasExclude()) {
36883        openArray("exclude");
36884        for (StringType e : element.getExclude()) 
36885          composeStringCore(null, e, true);
36886        closeArray();
36887        if (anyHasExtras(element.getExclude())) {
36888          openArray("_exclude");
36889          for (StringType e : element.getExclude()) 
36890            composeStringExtras(null, e, true);
36891          closeArray();
36892        }
36893      };
36894      if (element.hasPeriod()) {
36895        composePeriod("period", element.getPeriod());
36896      }
36897  }
36898
36899  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
36900    if (element != null) {
36901      open(name);
36902      composeProcessRequestItemsComponentInner(element);
36903      close();
36904    }
36905  }
36906
36907  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
36908      composeBackbone(element);
36909      if (element.hasSequenceLinkIdElement()) {
36910        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
36911        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
36912      }
36913  }
36914
36915  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
36916    if (element != null) {
36917      prop("resourceType", name);
36918      composeProcessResponseInner(element);
36919    }
36920  }
36921
36922  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
36923      composeDomainResourceElements(element);
36924      if (element.hasIdentifier()) {
36925        openArray("identifier");
36926        for (Identifier e : element.getIdentifier()) 
36927          composeIdentifier(null, e);
36928        closeArray();
36929      };
36930      if (element.hasStatusElement()) {
36931        composeEnumerationCore("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
36932        composeEnumerationExtras("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
36933      }
36934      if (element.hasCreatedElement()) {
36935        composeDateTimeCore("created", element.getCreatedElement(), false);
36936        composeDateTimeExtras("created", element.getCreatedElement(), false);
36937      }
36938      if (element.hasOrganization()) {
36939        composeReference("organization", element.getOrganization());
36940      }
36941      if (element.hasRequest()) {
36942        composeReference("request", element.getRequest());
36943      }
36944      if (element.hasOutcome()) {
36945        composeCodeableConcept("outcome", element.getOutcome());
36946      }
36947      if (element.hasDispositionElement()) {
36948        composeStringCore("disposition", element.getDispositionElement(), false);
36949        composeStringExtras("disposition", element.getDispositionElement(), false);
36950      }
36951      if (element.hasRequestProvider()) {
36952        composeReference("requestProvider", element.getRequestProvider());
36953      }
36954      if (element.hasRequestOrganization()) {
36955        composeReference("requestOrganization", element.getRequestOrganization());
36956      }
36957      if (element.hasForm()) {
36958        composeCodeableConcept("form", element.getForm());
36959      }
36960      if (element.hasProcessNote()) {
36961        openArray("processNote");
36962        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
36963          composeProcessResponseProcessResponseProcessNoteComponent(null, e);
36964        closeArray();
36965      };
36966      if (element.hasError()) {
36967        openArray("error");
36968        for (CodeableConcept e : element.getError()) 
36969          composeCodeableConcept(null, e);
36970        closeArray();
36971      };
36972      if (element.hasCommunicationRequest()) {
36973        openArray("communicationRequest");
36974        for (Reference e : element.getCommunicationRequest()) 
36975          composeReference(null, e);
36976        closeArray();
36977      };
36978  }
36979
36980  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
36981    if (element != null) {
36982      open(name);
36983      composeProcessResponseProcessResponseProcessNoteComponentInner(element);
36984      close();
36985    }
36986  }
36987
36988  protected void composeProcessResponseProcessResponseProcessNoteComponentInner(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
36989      composeBackbone(element);
36990      if (element.hasType()) {
36991        composeCodeableConcept("type", element.getType());
36992      }
36993      if (element.hasTextElement()) {
36994        composeStringCore("text", element.getTextElement(), false);
36995        composeStringExtras("text", element.getTextElement(), false);
36996      }
36997  }
36998
36999  protected void composeProvenance(String name, Provenance element) throws IOException {
37000    if (element != null) {
37001      prop("resourceType", name);
37002      composeProvenanceInner(element);
37003    }
37004  }
37005
37006  protected void composeProvenanceInner(Provenance element) throws IOException {
37007      composeDomainResourceElements(element);
37008      if (element.hasTarget()) {
37009        openArray("target");
37010        for (Reference e : element.getTarget()) 
37011          composeReference(null, e);
37012        closeArray();
37013      };
37014      if (element.hasPeriod()) {
37015        composePeriod("period", element.getPeriod());
37016      }
37017      if (element.hasRecordedElement()) {
37018        composeInstantCore("recorded", element.getRecordedElement(), false);
37019        composeInstantExtras("recorded", element.getRecordedElement(), false);
37020      }
37021      if (element.hasPolicy()) {
37022        openArray("policy");
37023        for (UriType e : element.getPolicy()) 
37024          composeUriCore(null, e, true);
37025        closeArray();
37026        if (anyHasExtras(element.getPolicy())) {
37027          openArray("_policy");
37028          for (UriType e : element.getPolicy()) 
37029            composeUriExtras(null, e, true);
37030          closeArray();
37031        }
37032      };
37033      if (element.hasLocation()) {
37034        composeReference("location", element.getLocation());
37035      }
37036      if (element.hasReason()) {
37037        openArray("reason");
37038        for (Coding e : element.getReason()) 
37039          composeCoding(null, e);
37040        closeArray();
37041      };
37042      if (element.hasActivity()) {
37043        composeCoding("activity", element.getActivity());
37044      }
37045      if (element.hasAgent()) {
37046        openArray("agent");
37047        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37048          composeProvenanceProvenanceAgentComponent(null, e);
37049        closeArray();
37050      };
37051      if (element.hasEntity()) {
37052        openArray("entity");
37053        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
37054          composeProvenanceProvenanceEntityComponent(null, e);
37055        closeArray();
37056      };
37057      if (element.hasSignature()) {
37058        openArray("signature");
37059        for (Signature e : element.getSignature()) 
37060          composeSignature(null, e);
37061        closeArray();
37062      };
37063  }
37064
37065  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
37066    if (element != null) {
37067      open(name);
37068      composeProvenanceProvenanceAgentComponentInner(element);
37069      close();
37070    }
37071  }
37072
37073  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
37074      composeBackbone(element);
37075      if (element.hasRole()) {
37076        openArray("role");
37077        for (CodeableConcept e : element.getRole()) 
37078          composeCodeableConcept(null, e);
37079        closeArray();
37080      };
37081      if (element.hasWho()) {
37082        composeType("who", element.getWho());
37083      }
37084      if (element.hasOnBehalfOf()) {
37085        composeType("onBehalfOf", element.getOnBehalfOf());
37086      }
37087      if (element.hasRelatedAgentType()) {
37088        composeCodeableConcept("relatedAgentType", element.getRelatedAgentType());
37089      }
37090  }
37091
37092  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
37093    if (element != null) {
37094      open(name);
37095      composeProvenanceProvenanceEntityComponentInner(element);
37096      close();
37097    }
37098  }
37099
37100  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
37101      composeBackbone(element);
37102      if (element.hasRoleElement()) {
37103        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37104        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
37105      }
37106      if (element.hasWhat()) {
37107        composeType("what", element.getWhat());
37108      }
37109      if (element.hasAgent()) {
37110        openArray("agent");
37111        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
37112          composeProvenanceProvenanceAgentComponent(null, e);
37113        closeArray();
37114      };
37115  }
37116
37117  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
37118    if (element != null) {
37119      prop("resourceType", name);
37120      composeQuestionnaireInner(element);
37121    }
37122  }
37123
37124  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
37125      composeDomainResourceElements(element);
37126      if (element.hasUrlElement()) {
37127        composeUriCore("url", element.getUrlElement(), false);
37128        composeUriExtras("url", element.getUrlElement(), false);
37129      }
37130      if (element.hasIdentifier()) {
37131        openArray("identifier");
37132        for (Identifier e : element.getIdentifier()) 
37133          composeIdentifier(null, e);
37134        closeArray();
37135      };
37136      if (element.hasVersionElement()) {
37137        composeStringCore("version", element.getVersionElement(), false);
37138        composeStringExtras("version", element.getVersionElement(), false);
37139      }
37140      if (element.hasNameElement()) {
37141        composeStringCore("name", element.getNameElement(), false);
37142        composeStringExtras("name", element.getNameElement(), false);
37143      }
37144      if (element.hasTitleElement()) {
37145        composeStringCore("title", element.getTitleElement(), false);
37146        composeStringExtras("title", element.getTitleElement(), false);
37147      }
37148      if (element.hasStatusElement()) {
37149        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37150        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
37151      }
37152      if (element.hasExperimentalElement()) {
37153        composeBooleanCore("experimental", element.getExperimentalElement(), false);
37154        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
37155      }
37156      if (element.hasDateElement()) {
37157        composeDateTimeCore("date", element.getDateElement(), false);
37158        composeDateTimeExtras("date", element.getDateElement(), false);
37159      }
37160      if (element.hasPublisherElement()) {
37161        composeStringCore("publisher", element.getPublisherElement(), false);
37162        composeStringExtras("publisher", element.getPublisherElement(), false);
37163      }
37164      if (element.hasDescriptionElement()) {
37165        composeMarkdownCore("description", element.getDescriptionElement(), false);
37166        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37167      }
37168      if (element.hasPurposeElement()) {
37169        composeMarkdownCore("purpose", element.getPurposeElement(), false);
37170        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
37171      }
37172      if (element.hasApprovalDateElement()) {
37173        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
37174        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
37175      }
37176      if (element.hasLastReviewDateElement()) {
37177        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
37178        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
37179      }
37180      if (element.hasEffectivePeriod()) {
37181        composePeriod("effectivePeriod", element.getEffectivePeriod());
37182      }
37183      if (element.hasUseContext()) {
37184        openArray("useContext");
37185        for (UsageContext e : element.getUseContext()) 
37186          composeUsageContext(null, e);
37187        closeArray();
37188      };
37189      if (element.hasJurisdiction()) {
37190        openArray("jurisdiction");
37191        for (CodeableConcept e : element.getJurisdiction()) 
37192          composeCodeableConcept(null, e);
37193        closeArray();
37194      };
37195      if (element.hasContact()) {
37196        openArray("contact");
37197        for (ContactDetail e : element.getContact()) 
37198          composeContactDetail(null, e);
37199        closeArray();
37200      };
37201      if (element.hasCopyrightElement()) {
37202        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
37203        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
37204      }
37205      if (element.hasCode()) {
37206        openArray("code");
37207        for (Coding e : element.getCode()) 
37208          composeCoding(null, e);
37209        closeArray();
37210      };
37211      if (element.hasSubjectType()) {
37212        openArray("subjectType");
37213        for (CodeType e : element.getSubjectType()) 
37214          composeCodeCore(null, e, true);
37215        closeArray();
37216        if (anyHasExtras(element.getSubjectType())) {
37217          openArray("_subjectType");
37218          for (CodeType e : element.getSubjectType()) 
37219            composeCodeExtras(null, e, true);
37220          closeArray();
37221        }
37222      };
37223      if (element.hasItem()) {
37224        openArray("item");
37225        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37226          composeQuestionnaireQuestionnaireItemComponent(null, e);
37227        closeArray();
37228      };
37229  }
37230
37231  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
37232    if (element != null) {
37233      open(name);
37234      composeQuestionnaireQuestionnaireItemComponentInner(element);
37235      close();
37236    }
37237  }
37238
37239  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
37240      composeBackbone(element);
37241      if (element.hasLinkIdElement()) {
37242        composeStringCore("linkId", element.getLinkIdElement(), false);
37243        composeStringExtras("linkId", element.getLinkIdElement(), false);
37244      }
37245      if (element.hasDefinitionElement()) {
37246        composeUriCore("definition", element.getDefinitionElement(), false);
37247        composeUriExtras("definition", element.getDefinitionElement(), false);
37248      }
37249      if (element.hasCode()) {
37250        openArray("code");
37251        for (Coding e : element.getCode()) 
37252          composeCoding(null, e);
37253        closeArray();
37254      };
37255      if (element.hasPrefixElement()) {
37256        composeStringCore("prefix", element.getPrefixElement(), false);
37257        composeStringExtras("prefix", element.getPrefixElement(), false);
37258      }
37259      if (element.hasTextElement()) {
37260        composeStringCore("text", element.getTextElement(), false);
37261        composeStringExtras("text", element.getTextElement(), false);
37262      }
37263      if (element.hasTypeElement()) {
37264        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37265        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
37266      }
37267      if (element.hasEnableWhen()) {
37268        openArray("enableWhen");
37269        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
37270          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
37271        closeArray();
37272      };
37273      if (element.hasRequiredElement()) {
37274        composeBooleanCore("required", element.getRequiredElement(), false);
37275        composeBooleanExtras("required", element.getRequiredElement(), false);
37276      }
37277      if (element.hasRepeatsElement()) {
37278        composeBooleanCore("repeats", element.getRepeatsElement(), false);
37279        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
37280      }
37281      if (element.hasReadOnlyElement()) {
37282        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
37283        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
37284      }
37285      if (element.hasMaxLengthElement()) {
37286        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
37287        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
37288      }
37289      if (element.hasOptions()) {
37290        composeReference("options", element.getOptions());
37291      }
37292      if (element.hasOption()) {
37293        openArray("option");
37294        for (Questionnaire.QuestionnaireItemOptionComponent e : element.getOption()) 
37295          composeQuestionnaireQuestionnaireItemOptionComponent(null, e);
37296        closeArray();
37297      };
37298      if (element.hasInitial()) {
37299        composeType("initial", element.getInitial());
37300      }
37301      if (element.hasItem()) {
37302        openArray("item");
37303        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
37304          composeQuestionnaireQuestionnaireItemComponent(null, e);
37305        closeArray();
37306      };
37307  }
37308
37309  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37310    if (element != null) {
37311      open(name);
37312      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
37313      close();
37314    }
37315  }
37316
37317  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
37318      composeBackbone(element);
37319      if (element.hasQuestionElement()) {
37320        composeStringCore("question", element.getQuestionElement(), false);
37321        composeStringExtras("question", element.getQuestionElement(), false);
37322      }
37323      if (element.hasHasAnswerElement()) {
37324        composeBooleanCore("hasAnswer", element.getHasAnswerElement(), false);
37325        composeBooleanExtras("hasAnswer", element.getHasAnswerElement(), false);
37326      }
37327      if (element.hasAnswer()) {
37328        composeType("answer", element.getAnswer());
37329      }
37330  }
37331
37332  protected void composeQuestionnaireQuestionnaireItemOptionComponent(String name, Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37333    if (element != null) {
37334      open(name);
37335      composeQuestionnaireQuestionnaireItemOptionComponentInner(element);
37336      close();
37337    }
37338  }
37339
37340  protected void composeQuestionnaireQuestionnaireItemOptionComponentInner(Questionnaire.QuestionnaireItemOptionComponent element) throws IOException {
37341      composeBackbone(element);
37342      if (element.hasValue()) {
37343        composeType("value", element.getValue());
37344      }
37345  }
37346
37347  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
37348    if (element != null) {
37349      prop("resourceType", name);
37350      composeQuestionnaireResponseInner(element);
37351    }
37352  }
37353
37354  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
37355      composeDomainResourceElements(element);
37356      if (element.hasIdentifier()) {
37357        composeIdentifier("identifier", element.getIdentifier());
37358      }
37359      if (element.hasBasedOn()) {
37360        openArray("basedOn");
37361        for (Reference e : element.getBasedOn()) 
37362          composeReference(null, e);
37363        closeArray();
37364      };
37365      if (element.hasParent()) {
37366        openArray("parent");
37367        for (Reference e : element.getParent()) 
37368          composeReference(null, e);
37369        closeArray();
37370      };
37371      if (element.hasQuestionnaire()) {
37372        composeReference("questionnaire", element.getQuestionnaire());
37373      }
37374      if (element.hasStatusElement()) {
37375        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37376        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
37377      }
37378      if (element.hasSubject()) {
37379        composeReference("subject", element.getSubject());
37380      }
37381      if (element.hasContext()) {
37382        composeReference("context", element.getContext());
37383      }
37384      if (element.hasAuthoredElement()) {
37385        composeDateTimeCore("authored", element.getAuthoredElement(), false);
37386        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
37387      }
37388      if (element.hasAuthor()) {
37389        composeReference("author", element.getAuthor());
37390      }
37391      if (element.hasSource()) {
37392        composeReference("source", element.getSource());
37393      }
37394      if (element.hasItem()) {
37395        openArray("item");
37396        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37397          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37398        closeArray();
37399      };
37400  }
37401
37402  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37403    if (element != null) {
37404      open(name);
37405      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
37406      close();
37407    }
37408  }
37409
37410  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
37411      composeBackbone(element);
37412      if (element.hasLinkIdElement()) {
37413        composeStringCore("linkId", element.getLinkIdElement(), false);
37414        composeStringExtras("linkId", element.getLinkIdElement(), false);
37415      }
37416      if (element.hasDefinitionElement()) {
37417        composeUriCore("definition", element.getDefinitionElement(), false);
37418        composeUriExtras("definition", element.getDefinitionElement(), false);
37419      }
37420      if (element.hasTextElement()) {
37421        composeStringCore("text", element.getTextElement(), false);
37422        composeStringExtras("text", element.getTextElement(), false);
37423      }
37424      if (element.hasSubject()) {
37425        composeReference("subject", element.getSubject());
37426      }
37427      if (element.hasAnswer()) {
37428        openArray("answer");
37429        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
37430          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
37431        closeArray();
37432      };
37433      if (element.hasItem()) {
37434        openArray("item");
37435        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37436          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37437        closeArray();
37438      };
37439  }
37440
37441  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37442    if (element != null) {
37443      open(name);
37444      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
37445      close();
37446    }
37447  }
37448
37449  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
37450      composeBackbone(element);
37451      if (element.hasValue()) {
37452        composeType("value", element.getValue());
37453      }
37454      if (element.hasItem()) {
37455        openArray("item");
37456        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
37457          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
37458        closeArray();
37459      };
37460  }
37461
37462  protected void composeReferralRequest(String name, ReferralRequest element) throws IOException {
37463    if (element != null) {
37464      prop("resourceType", name);
37465      composeReferralRequestInner(element);
37466    }
37467  }
37468
37469  protected void composeReferralRequestInner(ReferralRequest element) throws IOException {
37470      composeDomainResourceElements(element);
37471      if (element.hasIdentifier()) {
37472        openArray("identifier");
37473        for (Identifier e : element.getIdentifier()) 
37474          composeIdentifier(null, e);
37475        closeArray();
37476      };
37477      if (element.hasDefinition()) {
37478        openArray("definition");
37479        for (Reference e : element.getDefinition()) 
37480          composeReference(null, e);
37481        closeArray();
37482      };
37483      if (element.hasBasedOn()) {
37484        openArray("basedOn");
37485        for (Reference e : element.getBasedOn()) 
37486          composeReference(null, e);
37487        closeArray();
37488      };
37489      if (element.hasReplaces()) {
37490        openArray("replaces");
37491        for (Reference e : element.getReplaces()) 
37492          composeReference(null, e);
37493        closeArray();
37494      };
37495      if (element.hasGroupIdentifier()) {
37496        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37497      }
37498      if (element.hasStatusElement()) {
37499        composeEnumerationCore("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37500        composeEnumerationExtras("status", element.getStatusElement(), new ReferralRequest.ReferralRequestStatusEnumFactory(), false);
37501      }
37502      if (element.hasIntentElement()) {
37503        composeEnumerationCore("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37504        composeEnumerationExtras("intent", element.getIntentElement(), new ReferralRequest.ReferralCategoryEnumFactory(), false);
37505      }
37506      if (element.hasType()) {
37507        composeCodeableConcept("type", element.getType());
37508      }
37509      if (element.hasPriorityElement()) {
37510        composeEnumerationCore("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37511        composeEnumerationExtras("priority", element.getPriorityElement(), new ReferralRequest.ReferralPriorityEnumFactory(), false);
37512      }
37513      if (element.hasServiceRequested()) {
37514        openArray("serviceRequested");
37515        for (CodeableConcept e : element.getServiceRequested()) 
37516          composeCodeableConcept(null, e);
37517        closeArray();
37518      };
37519      if (element.hasSubject()) {
37520        composeReference("subject", element.getSubject());
37521      }
37522      if (element.hasContext()) {
37523        composeReference("context", element.getContext());
37524      }
37525      if (element.hasOccurrence()) {
37526        composeType("occurrence", element.getOccurrence());
37527      }
37528      if (element.hasAuthoredOnElement()) {
37529        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37530        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37531      }
37532      if (element.hasRequester()) {
37533        composeReferralRequestReferralRequestRequesterComponent("requester", element.getRequester());
37534      }
37535      if (element.hasSpecialty()) {
37536        composeCodeableConcept("specialty", element.getSpecialty());
37537      }
37538      if (element.hasRecipient()) {
37539        openArray("recipient");
37540        for (Reference e : element.getRecipient()) 
37541          composeReference(null, e);
37542        closeArray();
37543      };
37544      if (element.hasReasonCode()) {
37545        openArray("reasonCode");
37546        for (CodeableConcept e : element.getReasonCode()) 
37547          composeCodeableConcept(null, e);
37548        closeArray();
37549      };
37550      if (element.hasReasonReference()) {
37551        openArray("reasonReference");
37552        for (Reference e : element.getReasonReference()) 
37553          composeReference(null, e);
37554        closeArray();
37555      };
37556      if (element.hasDescriptionElement()) {
37557        composeStringCore("description", element.getDescriptionElement(), false);
37558        composeStringExtras("description", element.getDescriptionElement(), false);
37559      }
37560      if (element.hasSupportingInfo()) {
37561        openArray("supportingInfo");
37562        for (Reference e : element.getSupportingInfo()) 
37563          composeReference(null, e);
37564        closeArray();
37565      };
37566      if (element.hasNote()) {
37567        openArray("note");
37568        for (Annotation e : element.getNote()) 
37569          composeAnnotation(null, e);
37570        closeArray();
37571      };
37572      if (element.hasRelevantHistory()) {
37573        openArray("relevantHistory");
37574        for (Reference e : element.getRelevantHistory()) 
37575          composeReference(null, e);
37576        closeArray();
37577      };
37578  }
37579
37580  protected void composeReferralRequestReferralRequestRequesterComponent(String name, ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37581    if (element != null) {
37582      open(name);
37583      composeReferralRequestReferralRequestRequesterComponentInner(element);
37584      close();
37585    }
37586  }
37587
37588  protected void composeReferralRequestReferralRequestRequesterComponentInner(ReferralRequest.ReferralRequestRequesterComponent element) throws IOException {
37589      composeBackbone(element);
37590      if (element.hasAgent()) {
37591        composeReference("agent", element.getAgent());
37592      }
37593      if (element.hasOnBehalfOf()) {
37594        composeReference("onBehalfOf", element.getOnBehalfOf());
37595      }
37596  }
37597
37598  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
37599    if (element != null) {
37600      prop("resourceType", name);
37601      composeRelatedPersonInner(element);
37602    }
37603  }
37604
37605  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
37606      composeDomainResourceElements(element);
37607      if (element.hasIdentifier()) {
37608        openArray("identifier");
37609        for (Identifier e : element.getIdentifier()) 
37610          composeIdentifier(null, e);
37611        closeArray();
37612      };
37613      if (element.hasActiveElement()) {
37614        composeBooleanCore("active", element.getActiveElement(), false);
37615        composeBooleanExtras("active", element.getActiveElement(), false);
37616      }
37617      if (element.hasPatient()) {
37618        composeReference("patient", element.getPatient());
37619      }
37620      if (element.hasRelationship()) {
37621        composeCodeableConcept("relationship", element.getRelationship());
37622      }
37623      if (element.hasName()) {
37624        openArray("name");
37625        for (HumanName e : element.getName()) 
37626          composeHumanName(null, e);
37627        closeArray();
37628      };
37629      if (element.hasTelecom()) {
37630        openArray("telecom");
37631        for (ContactPoint e : element.getTelecom()) 
37632          composeContactPoint(null, e);
37633        closeArray();
37634      };
37635      if (element.hasGenderElement()) {
37636        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37637        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
37638      }
37639      if (element.hasBirthDateElement()) {
37640        composeDateCore("birthDate", element.getBirthDateElement(), false);
37641        composeDateExtras("birthDate", element.getBirthDateElement(), false);
37642      }
37643      if (element.hasAddress()) {
37644        openArray("address");
37645        for (Address e : element.getAddress()) 
37646          composeAddress(null, e);
37647        closeArray();
37648      };
37649      if (element.hasPhoto()) {
37650        openArray("photo");
37651        for (Attachment e : element.getPhoto()) 
37652          composeAttachment(null, e);
37653        closeArray();
37654      };
37655      if (element.hasPeriod()) {
37656        composePeriod("period", element.getPeriod());
37657      }
37658  }
37659
37660  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
37661    if (element != null) {
37662      prop("resourceType", name);
37663      composeRequestGroupInner(element);
37664    }
37665  }
37666
37667  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
37668      composeDomainResourceElements(element);
37669      if (element.hasIdentifier()) {
37670        openArray("identifier");
37671        for (Identifier e : element.getIdentifier()) 
37672          composeIdentifier(null, e);
37673        closeArray();
37674      };
37675      if (element.hasDefinition()) {
37676        openArray("definition");
37677        for (Reference e : element.getDefinition()) 
37678          composeReference(null, e);
37679        closeArray();
37680      };
37681      if (element.hasBasedOn()) {
37682        openArray("basedOn");
37683        for (Reference e : element.getBasedOn()) 
37684          composeReference(null, e);
37685        closeArray();
37686      };
37687      if (element.hasReplaces()) {
37688        openArray("replaces");
37689        for (Reference e : element.getReplaces()) 
37690          composeReference(null, e);
37691        closeArray();
37692      };
37693      if (element.hasGroupIdentifier()) {
37694        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37695      }
37696      if (element.hasStatusElement()) {
37697        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
37698        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
37699      }
37700      if (element.hasIntentElement()) {
37701        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
37702        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
37703      }
37704      if (element.hasPriorityElement()) {
37705        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
37706        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
37707      }
37708      if (element.hasSubject()) {
37709        composeReference("subject", element.getSubject());
37710      }
37711      if (element.hasContext()) {
37712        composeReference("context", element.getContext());
37713      }
37714      if (element.hasAuthoredOnElement()) {
37715        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37716        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37717      }
37718      if (element.hasAuthor()) {
37719        composeReference("author", element.getAuthor());
37720      }
37721      if (element.hasReason()) {
37722        composeType("reason", element.getReason());
37723      }
37724      if (element.hasNote()) {
37725        openArray("note");
37726        for (Annotation e : element.getNote()) 
37727          composeAnnotation(null, e);
37728        closeArray();
37729      };
37730      if (element.hasAction()) {
37731        openArray("action");
37732        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
37733          composeRequestGroupRequestGroupActionComponent(null, e);
37734        closeArray();
37735      };
37736  }
37737
37738  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
37739    if (element != null) {
37740      open(name);
37741      composeRequestGroupRequestGroupActionComponentInner(element);
37742      close();
37743    }
37744  }
37745
37746  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
37747      composeBackbone(element);
37748      if (element.hasLabelElement()) {
37749        composeStringCore("label", element.getLabelElement(), false);
37750        composeStringExtras("label", element.getLabelElement(), false);
37751      }
37752      if (element.hasTitleElement()) {
37753        composeStringCore("title", element.getTitleElement(), false);
37754        composeStringExtras("title", element.getTitleElement(), false);
37755      }
37756      if (element.hasDescriptionElement()) {
37757        composeStringCore("description", element.getDescriptionElement(), false);
37758        composeStringExtras("description", element.getDescriptionElement(), false);
37759      }
37760      if (element.hasTextEquivalentElement()) {
37761        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
37762        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
37763      }
37764      if (element.hasCode()) {
37765        openArray("code");
37766        for (CodeableConcept e : element.getCode()) 
37767          composeCodeableConcept(null, e);
37768        closeArray();
37769      };
37770      if (element.hasDocumentation()) {
37771        openArray("documentation");
37772        for (RelatedArtifact e : element.getDocumentation()) 
37773          composeRelatedArtifact(null, e);
37774        closeArray();
37775      };
37776      if (element.hasCondition()) {
37777        openArray("condition");
37778        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
37779          composeRequestGroupRequestGroupActionConditionComponent(null, e);
37780        closeArray();
37781      };
37782      if (element.hasRelatedAction()) {
37783        openArray("relatedAction");
37784        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
37785          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
37786        closeArray();
37787      };
37788      if (element.hasTiming()) {
37789        composeType("timing", element.getTiming());
37790      }
37791      if (element.hasParticipant()) {
37792        openArray("participant");
37793        for (Reference e : element.getParticipant()) 
37794          composeReference(null, e);
37795        closeArray();
37796      };
37797      if (element.hasType()) {
37798        composeCoding("type", element.getType());
37799      }
37800      if (element.hasGroupingBehaviorElement()) {
37801        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
37802        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
37803      }
37804      if (element.hasSelectionBehaviorElement()) {
37805        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
37806        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
37807      }
37808      if (element.hasRequiredBehaviorElement()) {
37809        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
37810        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
37811      }
37812      if (element.hasPrecheckBehaviorElement()) {
37813        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
37814        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
37815      }
37816      if (element.hasCardinalityBehaviorElement()) {
37817        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
37818        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
37819      }
37820      if (element.hasResource()) {
37821        composeReference("resource", element.getResource());
37822      }
37823      if (element.hasAction()) {
37824        openArray("action");
37825        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
37826          composeRequestGroupRequestGroupActionComponent(null, e);
37827        closeArray();
37828      };
37829  }
37830
37831  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
37832    if (element != null) {
37833      open(name);
37834      composeRequestGroupRequestGroupActionConditionComponentInner(element);
37835      close();
37836    }
37837  }
37838
37839  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
37840      composeBackbone(element);
37841      if (element.hasKindElement()) {
37842        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
37843        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
37844      }
37845      if (element.hasDescriptionElement()) {
37846        composeStringCore("description", element.getDescriptionElement(), false);
37847        composeStringExtras("description", element.getDescriptionElement(), false);
37848      }
37849      if (element.hasLanguageElement()) {
37850        composeStringCore("language", element.getLanguageElement(), false);
37851        composeStringExtras("language", element.getLanguageElement(), false);
37852      }
37853      if (element.hasExpressionElement()) {
37854        composeStringCore("expression", element.getExpressionElement(), false);
37855        composeStringExtras("expression", element.getExpressionElement(), false);
37856      }
37857  }
37858
37859  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
37860    if (element != null) {
37861      open(name);
37862      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
37863      close();
37864    }
37865  }
37866
37867  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
37868      composeBackbone(element);
37869      if (element.hasActionIdElement()) {
37870        composeIdCore("actionId", element.getActionIdElement(), false);
37871        composeIdExtras("actionId", element.getActionIdElement(), false);
37872      }
37873      if (element.hasRelationshipElement()) {
37874        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
37875        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
37876      }
37877      if (element.hasOffset()) {
37878        composeType("offset", element.getOffset());
37879      }
37880  }
37881
37882  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
37883    if (element != null) {
37884      prop("resourceType", name);
37885      composeResearchStudyInner(element);
37886    }
37887  }
37888
37889  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
37890      composeDomainResourceElements(element);
37891      if (element.hasIdentifier()) {
37892        openArray("identifier");
37893        for (Identifier e : element.getIdentifier()) 
37894          composeIdentifier(null, e);
37895        closeArray();
37896      };
37897      if (element.hasTitleElement()) {
37898        composeStringCore("title", element.getTitleElement(), false);
37899        composeStringExtras("title", element.getTitleElement(), false);
37900      }
37901      if (element.hasProtocol()) {
37902        openArray("protocol");
37903        for (Reference e : element.getProtocol()) 
37904          composeReference(null, e);
37905        closeArray();
37906      };
37907      if (element.hasPartOf()) {
37908        openArray("partOf");
37909        for (Reference e : element.getPartOf()) 
37910          composeReference(null, e);
37911        closeArray();
37912      };
37913      if (element.hasStatusElement()) {
37914        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
37915        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
37916      }
37917      if (element.hasCategory()) {
37918        openArray("category");
37919        for (CodeableConcept e : element.getCategory()) 
37920          composeCodeableConcept(null, e);
37921        closeArray();
37922      };
37923      if (element.hasFocus()) {
37924        openArray("focus");
37925        for (CodeableConcept e : element.getFocus()) 
37926          composeCodeableConcept(null, e);
37927        closeArray();
37928      };
37929      if (element.hasContact()) {
37930        openArray("contact");
37931        for (ContactDetail e : element.getContact()) 
37932          composeContactDetail(null, e);
37933        closeArray();
37934      };
37935      if (element.hasRelatedArtifact()) {
37936        openArray("relatedArtifact");
37937        for (RelatedArtifact e : element.getRelatedArtifact()) 
37938          composeRelatedArtifact(null, e);
37939        closeArray();
37940      };
37941      if (element.hasKeyword()) {
37942        openArray("keyword");
37943        for (CodeableConcept e : element.getKeyword()) 
37944          composeCodeableConcept(null, e);
37945        closeArray();
37946      };
37947      if (element.hasJurisdiction()) {
37948        openArray("jurisdiction");
37949        for (CodeableConcept e : element.getJurisdiction()) 
37950          composeCodeableConcept(null, e);
37951        closeArray();
37952      };
37953      if (element.hasDescriptionElement()) {
37954        composeMarkdownCore("description", element.getDescriptionElement(), false);
37955        composeMarkdownExtras("description", element.getDescriptionElement(), false);
37956      }
37957      if (element.hasEnrollment()) {
37958        openArray("enrollment");
37959        for (Reference e : element.getEnrollment()) 
37960          composeReference(null, e);
37961        closeArray();
37962      };
37963      if (element.hasPeriod()) {
37964        composePeriod("period", element.getPeriod());
37965      }
37966      if (element.hasSponsor()) {
37967        composeReference("sponsor", element.getSponsor());
37968      }
37969      if (element.hasPrincipalInvestigator()) {
37970        composeReference("principalInvestigator", element.getPrincipalInvestigator());
37971      }
37972      if (element.hasSite()) {
37973        openArray("site");
37974        for (Reference e : element.getSite()) 
37975          composeReference(null, e);
37976        closeArray();
37977      };
37978      if (element.hasReasonStopped()) {
37979        composeCodeableConcept("reasonStopped", element.getReasonStopped());
37980      }
37981      if (element.hasNote()) {
37982        openArray("note");
37983        for (Annotation e : element.getNote()) 
37984          composeAnnotation(null, e);
37985        closeArray();
37986      };
37987      if (element.hasArm()) {
37988        openArray("arm");
37989        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
37990          composeResearchStudyResearchStudyArmComponent(null, e);
37991        closeArray();
37992      };
37993  }
37994
37995  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
37996    if (element != null) {
37997      open(name);
37998      composeResearchStudyResearchStudyArmComponentInner(element);
37999      close();
38000    }
38001  }
38002
38003  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
38004      composeBackbone(element);
38005      if (element.hasNameElement()) {
38006        composeStringCore("name", element.getNameElement(), false);
38007        composeStringExtras("name", element.getNameElement(), false);
38008      }
38009      if (element.hasCode()) {
38010        composeCodeableConcept("code", element.getCode());
38011      }
38012      if (element.hasDescriptionElement()) {
38013        composeStringCore("description", element.getDescriptionElement(), false);
38014        composeStringExtras("description", element.getDescriptionElement(), false);
38015      }
38016  }
38017
38018  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
38019    if (element != null) {
38020      prop("resourceType", name);
38021      composeResearchSubjectInner(element);
38022    }
38023  }
38024
38025  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
38026      composeDomainResourceElements(element);
38027      if (element.hasIdentifier()) {
38028        composeIdentifier("identifier", element.getIdentifier());
38029      }
38030      if (element.hasStatusElement()) {
38031        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38032        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
38033      }
38034      if (element.hasPeriod()) {
38035        composePeriod("period", element.getPeriod());
38036      }
38037      if (element.hasStudy()) {
38038        composeReference("study", element.getStudy());
38039      }
38040      if (element.hasIndividual()) {
38041        composeReference("individual", element.getIndividual());
38042      }
38043      if (element.hasAssignedArmElement()) {
38044        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
38045        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
38046      }
38047      if (element.hasActualArmElement()) {
38048        composeStringCore("actualArm", element.getActualArmElement(), false);
38049        composeStringExtras("actualArm", element.getActualArmElement(), false);
38050      }
38051      if (element.hasConsent()) {
38052        composeReference("consent", element.getConsent());
38053      }
38054  }
38055
38056  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
38057    if (element != null) {
38058      prop("resourceType", name);
38059      composeRiskAssessmentInner(element);
38060    }
38061  }
38062
38063  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
38064      composeDomainResourceElements(element);
38065      if (element.hasIdentifier()) {
38066        composeIdentifier("identifier", element.getIdentifier());
38067      }
38068      if (element.hasBasedOn()) {
38069        composeReference("basedOn", element.getBasedOn());
38070      }
38071      if (element.hasParent()) {
38072        composeReference("parent", element.getParent());
38073      }
38074      if (element.hasStatusElement()) {
38075        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38076        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
38077      }
38078      if (element.hasMethod()) {
38079        composeCodeableConcept("method", element.getMethod());
38080      }
38081      if (element.hasCode()) {
38082        composeCodeableConcept("code", element.getCode());
38083      }
38084      if (element.hasSubject()) {
38085        composeReference("subject", element.getSubject());
38086      }
38087      if (element.hasContext()) {
38088        composeReference("context", element.getContext());
38089      }
38090      if (element.hasOccurrence()) {
38091        composeType("occurrence", element.getOccurrence());
38092      }
38093      if (element.hasCondition()) {
38094        composeReference("condition", element.getCondition());
38095      }
38096      if (element.hasPerformer()) {
38097        composeReference("performer", element.getPerformer());
38098      }
38099      if (element.hasReason()) {
38100        composeType("reason", element.getReason());
38101      }
38102      if (element.hasBasis()) {
38103        openArray("basis");
38104        for (Reference e : element.getBasis()) 
38105          composeReference(null, e);
38106        closeArray();
38107      };
38108      if (element.hasPrediction()) {
38109        openArray("prediction");
38110        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
38111          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
38112        closeArray();
38113      };
38114      if (element.hasMitigationElement()) {
38115        composeStringCore("mitigation", element.getMitigationElement(), false);
38116        composeStringExtras("mitigation", element.getMitigationElement(), false);
38117      }
38118      if (element.hasCommentElement()) {
38119        composeStringCore("comment", element.getCommentElement(), false);
38120        composeStringExtras("comment", element.getCommentElement(), false);
38121      }
38122  }
38123
38124  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38125    if (element != null) {
38126      open(name);
38127      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
38128      close();
38129    }
38130  }
38131
38132  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
38133      composeBackbone(element);
38134      if (element.hasOutcome()) {
38135        composeCodeableConcept("outcome", element.getOutcome());
38136      }
38137      if (element.hasProbability()) {
38138        composeType("probability", element.getProbability());
38139      }
38140      if (element.hasQualitativeRisk()) {
38141        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
38142      }
38143      if (element.hasRelativeRiskElement()) {
38144        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
38145        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
38146      }
38147      if (element.hasWhen()) {
38148        composeType("when", element.getWhen());
38149      }
38150      if (element.hasRationaleElement()) {
38151        composeStringCore("rationale", element.getRationaleElement(), false);
38152        composeStringExtras("rationale", element.getRationaleElement(), false);
38153      }
38154  }
38155
38156  protected void composeSchedule(String name, Schedule element) throws IOException {
38157    if (element != null) {
38158      prop("resourceType", name);
38159      composeScheduleInner(element);
38160    }
38161  }
38162
38163  protected void composeScheduleInner(Schedule element) throws IOException {
38164      composeDomainResourceElements(element);
38165      if (element.hasIdentifier()) {
38166        openArray("identifier");
38167        for (Identifier e : element.getIdentifier()) 
38168          composeIdentifier(null, e);
38169        closeArray();
38170      };
38171      if (element.hasActiveElement()) {
38172        composeBooleanCore("active", element.getActiveElement(), false);
38173        composeBooleanExtras("active", element.getActiveElement(), false);
38174      }
38175      if (element.hasServiceCategory()) {
38176        composeCodeableConcept("serviceCategory", element.getServiceCategory());
38177      }
38178      if (element.hasServiceType()) {
38179        openArray("serviceType");
38180        for (CodeableConcept e : element.getServiceType()) 
38181          composeCodeableConcept(null, e);
38182        closeArray();
38183      };
38184      if (element.hasSpecialty()) {
38185        openArray("specialty");
38186        for (CodeableConcept e : element.getSpecialty()) 
38187          composeCodeableConcept(null, e);
38188        closeArray();
38189      };
38190      if (element.hasActor()) {
38191        openArray("actor");
38192        for (Reference e : element.getActor()) 
38193          composeReference(null, e);
38194        closeArray();
38195      };
38196      if (element.hasPlanningHorizon()) {
38197        composePeriod("planningHorizon", element.getPlanningHorizon());
38198      }
38199      if (element.hasCommentElement()) {
38200        composeStringCore("comment", element.getCommentElement(), false);
38201        composeStringExtras("comment", element.getCommentElement(), false);
38202      }
38203  }
38204
38205  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
38206    if (element != null) {
38207      prop("resourceType", name);
38208      composeSearchParameterInner(element);
38209    }
38210  }
38211
38212  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
38213      composeDomainResourceElements(element);
38214      if (element.hasUrlElement()) {
38215        composeUriCore("url", element.getUrlElement(), false);
38216        composeUriExtras("url", element.getUrlElement(), false);
38217      }
38218      if (element.hasVersionElement()) {
38219        composeStringCore("version", element.getVersionElement(), false);
38220        composeStringExtras("version", element.getVersionElement(), false);
38221      }
38222      if (element.hasNameElement()) {
38223        composeStringCore("name", element.getNameElement(), false);
38224        composeStringExtras("name", element.getNameElement(), false);
38225      }
38226      if (element.hasStatusElement()) {
38227        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38228        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38229      }
38230      if (element.hasExperimentalElement()) {
38231        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38232        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38233      }
38234      if (element.hasDateElement()) {
38235        composeDateTimeCore("date", element.getDateElement(), false);
38236        composeDateTimeExtras("date", element.getDateElement(), false);
38237      }
38238      if (element.hasPublisherElement()) {
38239        composeStringCore("publisher", element.getPublisherElement(), false);
38240        composeStringExtras("publisher", element.getPublisherElement(), false);
38241      }
38242      if (element.hasContact()) {
38243        openArray("contact");
38244        for (ContactDetail e : element.getContact()) 
38245          composeContactDetail(null, e);
38246        closeArray();
38247      };
38248      if (element.hasUseContext()) {
38249        openArray("useContext");
38250        for (UsageContext e : element.getUseContext()) 
38251          composeUsageContext(null, e);
38252        closeArray();
38253      };
38254      if (element.hasJurisdiction()) {
38255        openArray("jurisdiction");
38256        for (CodeableConcept e : element.getJurisdiction()) 
38257          composeCodeableConcept(null, e);
38258        closeArray();
38259      };
38260      if (element.hasPurposeElement()) {
38261        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38262        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38263      }
38264      if (element.hasCodeElement()) {
38265        composeCodeCore("code", element.getCodeElement(), false);
38266        composeCodeExtras("code", element.getCodeElement(), false);
38267      }
38268      if (element.hasBase()) {
38269        openArray("base");
38270        for (CodeType e : element.getBase()) 
38271          composeCodeCore(null, e, true);
38272        closeArray();
38273        if (anyHasExtras(element.getBase())) {
38274          openArray("_base");
38275          for (CodeType e : element.getBase()) 
38276            composeCodeExtras(null, e, true);
38277          closeArray();
38278        }
38279      };
38280      if (element.hasTypeElement()) {
38281        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38282        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
38283      }
38284      if (element.hasDerivedFromElement()) {
38285        composeUriCore("derivedFrom", element.getDerivedFromElement(), false);
38286        composeUriExtras("derivedFrom", element.getDerivedFromElement(), false);
38287      }
38288      if (element.hasDescriptionElement()) {
38289        composeMarkdownCore("description", element.getDescriptionElement(), false);
38290        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38291      }
38292      if (element.hasExpressionElement()) {
38293        composeStringCore("expression", element.getExpressionElement(), false);
38294        composeStringExtras("expression", element.getExpressionElement(), false);
38295      }
38296      if (element.hasXpathElement()) {
38297        composeStringCore("xpath", element.getXpathElement(), false);
38298        composeStringExtras("xpath", element.getXpathElement(), false);
38299      }
38300      if (element.hasXpathUsageElement()) {
38301        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38302        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
38303      }
38304      if (element.hasTarget()) {
38305        openArray("target");
38306        for (CodeType e : element.getTarget()) 
38307          composeCodeCore(null, e, true);
38308        closeArray();
38309        if (anyHasExtras(element.getTarget())) {
38310          openArray("_target");
38311          for (CodeType e : element.getTarget()) 
38312            composeCodeExtras(null, e, true);
38313          closeArray();
38314        }
38315      };
38316      if (element.hasComparator()) {
38317        openArray("comparator");
38318        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38319          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38320        closeArray();
38321        if (anyHasExtras(element.getComparator())) {
38322          openArray("_comparator");
38323          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
38324            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
38325          closeArray();
38326        }
38327      };
38328      if (element.hasModifier()) {
38329        openArray("modifier");
38330        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38331          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38332        closeArray();
38333        if (anyHasExtras(element.getModifier())) {
38334          openArray("_modifier");
38335          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
38336            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
38337          closeArray();
38338        }
38339      };
38340      if (element.hasChain()) {
38341        openArray("chain");
38342        for (StringType e : element.getChain()) 
38343          composeStringCore(null, e, true);
38344        closeArray();
38345        if (anyHasExtras(element.getChain())) {
38346          openArray("_chain");
38347          for (StringType e : element.getChain()) 
38348            composeStringExtras(null, e, true);
38349          closeArray();
38350        }
38351      };
38352      if (element.hasComponent()) {
38353        openArray("component");
38354        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
38355          composeSearchParameterSearchParameterComponentComponent(null, e);
38356        closeArray();
38357      };
38358  }
38359
38360  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
38361    if (element != null) {
38362      open(name);
38363      composeSearchParameterSearchParameterComponentComponentInner(element);
38364      close();
38365    }
38366  }
38367
38368  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
38369      composeBackbone(element);
38370      if (element.hasDefinition()) {
38371        composeReference("definition", element.getDefinition());
38372      }
38373      if (element.hasExpressionElement()) {
38374        composeStringCore("expression", element.getExpressionElement(), false);
38375        composeStringExtras("expression", element.getExpressionElement(), false);
38376      }
38377  }
38378
38379  protected void composeSequence(String name, Sequence element) throws IOException {
38380    if (element != null) {
38381      prop("resourceType", name);
38382      composeSequenceInner(element);
38383    }
38384  }
38385
38386  protected void composeSequenceInner(Sequence element) throws IOException {
38387      composeDomainResourceElements(element);
38388      if (element.hasIdentifier()) {
38389        openArray("identifier");
38390        for (Identifier e : element.getIdentifier()) 
38391          composeIdentifier(null, e);
38392        closeArray();
38393      };
38394      if (element.hasTypeElement()) {
38395        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38396        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
38397      }
38398      if (element.hasCoordinateSystemElement()) {
38399        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
38400        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
38401      }
38402      if (element.hasPatient()) {
38403        composeReference("patient", element.getPatient());
38404      }
38405      if (element.hasSpecimen()) {
38406        composeReference("specimen", element.getSpecimen());
38407      }
38408      if (element.hasDevice()) {
38409        composeReference("device", element.getDevice());
38410      }
38411      if (element.hasPerformer()) {
38412        composeReference("performer", element.getPerformer());
38413      }
38414      if (element.hasQuantity()) {
38415        composeQuantity("quantity", element.getQuantity());
38416      }
38417      if (element.hasReferenceSeq()) {
38418        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
38419      }
38420      if (element.hasVariant()) {
38421        openArray("variant");
38422        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
38423          composeSequenceSequenceVariantComponent(null, e);
38424        closeArray();
38425      };
38426      if (element.hasObservedSeqElement()) {
38427        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
38428        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
38429      }
38430      if (element.hasQuality()) {
38431        openArray("quality");
38432        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
38433          composeSequenceSequenceQualityComponent(null, e);
38434        closeArray();
38435      };
38436      if (element.hasReadCoverageElement()) {
38437        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
38438        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
38439      }
38440      if (element.hasRepository()) {
38441        openArray("repository");
38442        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
38443          composeSequenceSequenceRepositoryComponent(null, e);
38444        closeArray();
38445      };
38446      if (element.hasPointer()) {
38447        openArray("pointer");
38448        for (Reference e : element.getPointer()) 
38449          composeReference(null, e);
38450        closeArray();
38451      };
38452  }
38453
38454  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
38455    if (element != null) {
38456      open(name);
38457      composeSequenceSequenceReferenceSeqComponentInner(element);
38458      close();
38459    }
38460  }
38461
38462  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
38463      composeBackbone(element);
38464      if (element.hasChromosome()) {
38465        composeCodeableConcept("chromosome", element.getChromosome());
38466      }
38467      if (element.hasGenomeBuildElement()) {
38468        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
38469        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
38470      }
38471      if (element.hasReferenceSeqId()) {
38472        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
38473      }
38474      if (element.hasReferenceSeqPointer()) {
38475        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
38476      }
38477      if (element.hasReferenceSeqStringElement()) {
38478        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
38479        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
38480      }
38481      if (element.hasStrandElement()) {
38482        composeIntegerCore("strand", element.getStrandElement(), false);
38483        composeIntegerExtras("strand", element.getStrandElement(), false);
38484      }
38485      if (element.hasWindowStartElement()) {
38486        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
38487        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
38488      }
38489      if (element.hasWindowEndElement()) {
38490        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
38491        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
38492      }
38493  }
38494
38495  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
38496    if (element != null) {
38497      open(name);
38498      composeSequenceSequenceVariantComponentInner(element);
38499      close();
38500    }
38501  }
38502
38503  protected void composeSequenceSequenceVariantComponentInner(Sequence.SequenceVariantComponent element) throws IOException {
38504      composeBackbone(element);
38505      if (element.hasStartElement()) {
38506        composeIntegerCore("start", element.getStartElement(), false);
38507        composeIntegerExtras("start", element.getStartElement(), false);
38508      }
38509      if (element.hasEndElement()) {
38510        composeIntegerCore("end", element.getEndElement(), false);
38511        composeIntegerExtras("end", element.getEndElement(), false);
38512      }
38513      if (element.hasObservedAlleleElement()) {
38514        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
38515        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
38516      }
38517      if (element.hasReferenceAlleleElement()) {
38518        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
38519        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
38520      }
38521      if (element.hasCigarElement()) {
38522        composeStringCore("cigar", element.getCigarElement(), false);
38523        composeStringExtras("cigar", element.getCigarElement(), false);
38524      }
38525      if (element.hasVariantPointer()) {
38526        composeReference("variantPointer", element.getVariantPointer());
38527      }
38528  }
38529
38530  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
38531    if (element != null) {
38532      open(name);
38533      composeSequenceSequenceQualityComponentInner(element);
38534      close();
38535    }
38536  }
38537
38538  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
38539      composeBackbone(element);
38540      if (element.hasTypeElement()) {
38541        composeEnumerationCore("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38542        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
38543      }
38544      if (element.hasStandardSequence()) {
38545        composeCodeableConcept("standardSequence", element.getStandardSequence());
38546      }
38547      if (element.hasStartElement()) {
38548        composeIntegerCore("start", element.getStartElement(), false);
38549        composeIntegerExtras("start", element.getStartElement(), false);
38550      }
38551      if (element.hasEndElement()) {
38552        composeIntegerCore("end", element.getEndElement(), false);
38553        composeIntegerExtras("end", element.getEndElement(), false);
38554      }
38555      if (element.hasScore()) {
38556        composeQuantity("score", element.getScore());
38557      }
38558      if (element.hasMethod()) {
38559        composeCodeableConcept("method", element.getMethod());
38560      }
38561      if (element.hasTruthTPElement()) {
38562        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
38563        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
38564      }
38565      if (element.hasQueryTPElement()) {
38566        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
38567        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
38568      }
38569      if (element.hasTruthFNElement()) {
38570        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
38571        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
38572      }
38573      if (element.hasQueryFPElement()) {
38574        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
38575        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
38576      }
38577      if (element.hasGtFPElement()) {
38578        composeDecimalCore("gtFP", element.getGtFPElement(), false);
38579        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
38580      }
38581      if (element.hasPrecisionElement()) {
38582        composeDecimalCore("precision", element.getPrecisionElement(), false);
38583        composeDecimalExtras("precision", element.getPrecisionElement(), false);
38584      }
38585      if (element.hasRecallElement()) {
38586        composeDecimalCore("recall", element.getRecallElement(), false);
38587        composeDecimalExtras("recall", element.getRecallElement(), false);
38588      }
38589      if (element.hasFScoreElement()) {
38590        composeDecimalCore("fScore", element.getFScoreElement(), false);
38591        composeDecimalExtras("fScore", element.getFScoreElement(), false);
38592      }
38593  }
38594
38595  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
38596    if (element != null) {
38597      open(name);
38598      composeSequenceSequenceRepositoryComponentInner(element);
38599      close();
38600    }
38601  }
38602
38603  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
38604      composeBackbone(element);
38605      if (element.hasTypeElement()) {
38606        composeEnumerationCore("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38607        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
38608      }
38609      if (element.hasUrlElement()) {
38610        composeUriCore("url", element.getUrlElement(), false);
38611        composeUriExtras("url", element.getUrlElement(), false);
38612      }
38613      if (element.hasNameElement()) {
38614        composeStringCore("name", element.getNameElement(), false);
38615        composeStringExtras("name", element.getNameElement(), false);
38616      }
38617      if (element.hasDatasetIdElement()) {
38618        composeStringCore("datasetId", element.getDatasetIdElement(), false);
38619        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
38620      }
38621      if (element.hasVariantsetIdElement()) {
38622        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
38623        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
38624      }
38625      if (element.hasReadsetIdElement()) {
38626        composeStringCore("readsetId", element.getReadsetIdElement(), false);
38627        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
38628      }
38629  }
38630
38631  protected void composeServiceDefinition(String name, ServiceDefinition element) throws IOException {
38632    if (element != null) {
38633      prop("resourceType", name);
38634      composeServiceDefinitionInner(element);
38635    }
38636  }
38637
38638  protected void composeServiceDefinitionInner(ServiceDefinition element) throws IOException {
38639      composeDomainResourceElements(element);
38640      if (element.hasUrlElement()) {
38641        composeUriCore("url", element.getUrlElement(), false);
38642        composeUriExtras("url", element.getUrlElement(), false);
38643      }
38644      if (element.hasIdentifier()) {
38645        openArray("identifier");
38646        for (Identifier e : element.getIdentifier()) 
38647          composeIdentifier(null, e);
38648        closeArray();
38649      };
38650      if (element.hasVersionElement()) {
38651        composeStringCore("version", element.getVersionElement(), false);
38652        composeStringExtras("version", element.getVersionElement(), false);
38653      }
38654      if (element.hasNameElement()) {
38655        composeStringCore("name", element.getNameElement(), false);
38656        composeStringExtras("name", element.getNameElement(), false);
38657      }
38658      if (element.hasTitleElement()) {
38659        composeStringCore("title", element.getTitleElement(), false);
38660        composeStringExtras("title", element.getTitleElement(), false);
38661      }
38662      if (element.hasStatusElement()) {
38663        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38664        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38665      }
38666      if (element.hasExperimentalElement()) {
38667        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38668        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38669      }
38670      if (element.hasDateElement()) {
38671        composeDateTimeCore("date", element.getDateElement(), false);
38672        composeDateTimeExtras("date", element.getDateElement(), false);
38673      }
38674      if (element.hasPublisherElement()) {
38675        composeStringCore("publisher", element.getPublisherElement(), false);
38676        composeStringExtras("publisher", element.getPublisherElement(), false);
38677      }
38678      if (element.hasDescriptionElement()) {
38679        composeMarkdownCore("description", element.getDescriptionElement(), false);
38680        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38681      }
38682      if (element.hasPurposeElement()) {
38683        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38684        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38685      }
38686      if (element.hasUsageElement()) {
38687        composeStringCore("usage", element.getUsageElement(), false);
38688        composeStringExtras("usage", element.getUsageElement(), false);
38689      }
38690      if (element.hasApprovalDateElement()) {
38691        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
38692        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
38693      }
38694      if (element.hasLastReviewDateElement()) {
38695        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
38696        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
38697      }
38698      if (element.hasEffectivePeriod()) {
38699        composePeriod("effectivePeriod", element.getEffectivePeriod());
38700      }
38701      if (element.hasUseContext()) {
38702        openArray("useContext");
38703        for (UsageContext e : element.getUseContext()) 
38704          composeUsageContext(null, e);
38705        closeArray();
38706      };
38707      if (element.hasJurisdiction()) {
38708        openArray("jurisdiction");
38709        for (CodeableConcept e : element.getJurisdiction()) 
38710          composeCodeableConcept(null, e);
38711        closeArray();
38712      };
38713      if (element.hasTopic()) {
38714        openArray("topic");
38715        for (CodeableConcept e : element.getTopic()) 
38716          composeCodeableConcept(null, e);
38717        closeArray();
38718      };
38719      if (element.hasContributor()) {
38720        openArray("contributor");
38721        for (Contributor e : element.getContributor()) 
38722          composeContributor(null, e);
38723        closeArray();
38724      };
38725      if (element.hasContact()) {
38726        openArray("contact");
38727        for (ContactDetail e : element.getContact()) 
38728          composeContactDetail(null, e);
38729        closeArray();
38730      };
38731      if (element.hasCopyrightElement()) {
38732        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38733        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38734      }
38735      if (element.hasRelatedArtifact()) {
38736        openArray("relatedArtifact");
38737        for (RelatedArtifact e : element.getRelatedArtifact()) 
38738          composeRelatedArtifact(null, e);
38739        closeArray();
38740      };
38741      if (element.hasTrigger()) {
38742        openArray("trigger");
38743        for (TriggerDefinition e : element.getTrigger()) 
38744          composeTriggerDefinition(null, e);
38745        closeArray();
38746      };
38747      if (element.hasDataRequirement()) {
38748        openArray("dataRequirement");
38749        for (DataRequirement e : element.getDataRequirement()) 
38750          composeDataRequirement(null, e);
38751        closeArray();
38752      };
38753      if (element.hasOperationDefinition()) {
38754        composeReference("operationDefinition", element.getOperationDefinition());
38755      }
38756  }
38757
38758  protected void composeSlot(String name, Slot element) throws IOException {
38759    if (element != null) {
38760      prop("resourceType", name);
38761      composeSlotInner(element);
38762    }
38763  }
38764
38765  protected void composeSlotInner(Slot element) throws IOException {
38766      composeDomainResourceElements(element);
38767      if (element.hasIdentifier()) {
38768        openArray("identifier");
38769        for (Identifier e : element.getIdentifier()) 
38770          composeIdentifier(null, e);
38771        closeArray();
38772      };
38773      if (element.hasServiceCategory()) {
38774        composeCodeableConcept("serviceCategory", element.getServiceCategory());
38775      }
38776      if (element.hasServiceType()) {
38777        openArray("serviceType");
38778        for (CodeableConcept e : element.getServiceType()) 
38779          composeCodeableConcept(null, e);
38780        closeArray();
38781      };
38782      if (element.hasSpecialty()) {
38783        openArray("specialty");
38784        for (CodeableConcept e : element.getSpecialty()) 
38785          composeCodeableConcept(null, e);
38786        closeArray();
38787      };
38788      if (element.hasAppointmentType()) {
38789        composeCodeableConcept("appointmentType", element.getAppointmentType());
38790      }
38791      if (element.hasSchedule()) {
38792        composeReference("schedule", element.getSchedule());
38793      }
38794      if (element.hasStatusElement()) {
38795        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
38796        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
38797      }
38798      if (element.hasStartElement()) {
38799        composeInstantCore("start", element.getStartElement(), false);
38800        composeInstantExtras("start", element.getStartElement(), false);
38801      }
38802      if (element.hasEndElement()) {
38803        composeInstantCore("end", element.getEndElement(), false);
38804        composeInstantExtras("end", element.getEndElement(), false);
38805      }
38806      if (element.hasOverbookedElement()) {
38807        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
38808        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
38809      }
38810      if (element.hasCommentElement()) {
38811        composeStringCore("comment", element.getCommentElement(), false);
38812        composeStringExtras("comment", element.getCommentElement(), false);
38813      }
38814  }
38815
38816  protected void composeSpecimen(String name, Specimen element) throws IOException {
38817    if (element != null) {
38818      prop("resourceType", name);
38819      composeSpecimenInner(element);
38820    }
38821  }
38822
38823  protected void composeSpecimenInner(Specimen element) throws IOException {
38824      composeDomainResourceElements(element);
38825      if (element.hasIdentifier()) {
38826        openArray("identifier");
38827        for (Identifier e : element.getIdentifier()) 
38828          composeIdentifier(null, e);
38829        closeArray();
38830      };
38831      if (element.hasAccessionIdentifier()) {
38832        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
38833      }
38834      if (element.hasStatusElement()) {
38835        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
38836        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
38837      }
38838      if (element.hasType()) {
38839        composeCodeableConcept("type", element.getType());
38840      }
38841      if (element.hasSubject()) {
38842        composeReference("subject", element.getSubject());
38843      }
38844      if (element.hasReceivedTimeElement()) {
38845        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
38846        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
38847      }
38848      if (element.hasParent()) {
38849        openArray("parent");
38850        for (Reference e : element.getParent()) 
38851          composeReference(null, e);
38852        closeArray();
38853      };
38854      if (element.hasRequest()) {
38855        openArray("request");
38856        for (Reference e : element.getRequest()) 
38857          composeReference(null, e);
38858        closeArray();
38859      };
38860      if (element.hasCollection()) {
38861        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
38862      }
38863      if (element.hasProcessing()) {
38864        openArray("processing");
38865        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
38866          composeSpecimenSpecimenProcessingComponent(null, e);
38867        closeArray();
38868      };
38869      if (element.hasContainer()) {
38870        openArray("container");
38871        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
38872          composeSpecimenSpecimenContainerComponent(null, e);
38873        closeArray();
38874      };
38875      if (element.hasNote()) {
38876        openArray("note");
38877        for (Annotation e : element.getNote()) 
38878          composeAnnotation(null, e);
38879        closeArray();
38880      };
38881  }
38882
38883  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
38884    if (element != null) {
38885      open(name);
38886      composeSpecimenSpecimenCollectionComponentInner(element);
38887      close();
38888    }
38889  }
38890
38891  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
38892      composeBackbone(element);
38893      if (element.hasCollector()) {
38894        composeReference("collector", element.getCollector());
38895      }
38896      if (element.hasCollected()) {
38897        composeType("collected", element.getCollected());
38898      }
38899      if (element.hasQuantity()) {
38900        composeSimpleQuantity("quantity", element.getQuantity());
38901      }
38902      if (element.hasMethod()) {
38903        composeCodeableConcept("method", element.getMethod());
38904      }
38905      if (element.hasBodySite()) {
38906        composeCodeableConcept("bodySite", element.getBodySite());
38907      }
38908  }
38909
38910  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
38911    if (element != null) {
38912      open(name);
38913      composeSpecimenSpecimenProcessingComponentInner(element);
38914      close();
38915    }
38916  }
38917
38918  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
38919      composeBackbone(element);
38920      if (element.hasDescriptionElement()) {
38921        composeStringCore("description", element.getDescriptionElement(), false);
38922        composeStringExtras("description", element.getDescriptionElement(), false);
38923      }
38924      if (element.hasProcedure()) {
38925        composeCodeableConcept("procedure", element.getProcedure());
38926      }
38927      if (element.hasAdditive()) {
38928        openArray("additive");
38929        for (Reference e : element.getAdditive()) 
38930          composeReference(null, e);
38931        closeArray();
38932      };
38933      if (element.hasTime()) {
38934        composeType("time", element.getTime());
38935      }
38936  }
38937
38938  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
38939    if (element != null) {
38940      open(name);
38941      composeSpecimenSpecimenContainerComponentInner(element);
38942      close();
38943    }
38944  }
38945
38946  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
38947      composeBackbone(element);
38948      if (element.hasIdentifier()) {
38949        openArray("identifier");
38950        for (Identifier e : element.getIdentifier()) 
38951          composeIdentifier(null, e);
38952        closeArray();
38953      };
38954      if (element.hasDescriptionElement()) {
38955        composeStringCore("description", element.getDescriptionElement(), false);
38956        composeStringExtras("description", element.getDescriptionElement(), false);
38957      }
38958      if (element.hasType()) {
38959        composeCodeableConcept("type", element.getType());
38960      }
38961      if (element.hasCapacity()) {
38962        composeSimpleQuantity("capacity", element.getCapacity());
38963      }
38964      if (element.hasSpecimenQuantity()) {
38965        composeSimpleQuantity("specimenQuantity", element.getSpecimenQuantity());
38966      }
38967      if (element.hasAdditive()) {
38968        composeType("additive", element.getAdditive());
38969      }
38970  }
38971
38972  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
38973    if (element != null) {
38974      prop("resourceType", name);
38975      composeStructureDefinitionInner(element);
38976    }
38977  }
38978
38979  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
38980      composeDomainResourceElements(element);
38981      if (element.hasUrlElement()) {
38982        composeUriCore("url", element.getUrlElement(), false);
38983        composeUriExtras("url", element.getUrlElement(), false);
38984      }
38985      if (element.hasIdentifier()) {
38986        openArray("identifier");
38987        for (Identifier e : element.getIdentifier()) 
38988          composeIdentifier(null, e);
38989        closeArray();
38990      };
38991      if (element.hasVersionElement()) {
38992        composeStringCore("version", element.getVersionElement(), false);
38993        composeStringExtras("version", element.getVersionElement(), false);
38994      }
38995      if (element.hasNameElement()) {
38996        composeStringCore("name", element.getNameElement(), false);
38997        composeStringExtras("name", element.getNameElement(), false);
38998      }
38999      if (element.hasTitleElement()) {
39000        composeStringCore("title", element.getTitleElement(), false);
39001        composeStringExtras("title", element.getTitleElement(), false);
39002      }
39003      if (element.hasStatusElement()) {
39004        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39005        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39006      }
39007      if (element.hasExperimentalElement()) {
39008        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39009        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39010      }
39011      if (element.hasDateElement()) {
39012        composeDateTimeCore("date", element.getDateElement(), false);
39013        composeDateTimeExtras("date", element.getDateElement(), false);
39014      }
39015      if (element.hasPublisherElement()) {
39016        composeStringCore("publisher", element.getPublisherElement(), false);
39017        composeStringExtras("publisher", element.getPublisherElement(), false);
39018      }
39019      if (element.hasContact()) {
39020        openArray("contact");
39021        for (ContactDetail e : element.getContact()) 
39022          composeContactDetail(null, e);
39023        closeArray();
39024      };
39025      if (element.hasDescriptionElement()) {
39026        composeMarkdownCore("description", element.getDescriptionElement(), false);
39027        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39028      }
39029      if (element.hasUseContext()) {
39030        openArray("useContext");
39031        for (UsageContext e : element.getUseContext()) 
39032          composeUsageContext(null, e);
39033        closeArray();
39034      };
39035      if (element.hasJurisdiction()) {
39036        openArray("jurisdiction");
39037        for (CodeableConcept e : element.getJurisdiction()) 
39038          composeCodeableConcept(null, e);
39039        closeArray();
39040      };
39041      if (element.hasPurposeElement()) {
39042        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39043        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39044      }
39045      if (element.hasCopyrightElement()) {
39046        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39047        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39048      }
39049      if (element.hasKeyword()) {
39050        openArray("keyword");
39051        for (Coding e : element.getKeyword()) 
39052          composeCoding(null, e);
39053        closeArray();
39054      };
39055      if (element.hasFhirVersionElement()) {
39056        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
39057        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
39058      }
39059      if (element.hasMapping()) {
39060        openArray("mapping");
39061        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
39062          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
39063        closeArray();
39064      };
39065      if (element.hasKindElement()) {
39066        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39067        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
39068      }
39069      if (element.hasAbstractElement()) {
39070        composeBooleanCore("abstract", element.getAbstractElement(), false);
39071        composeBooleanExtras("abstract", element.getAbstractElement(), false);
39072      }
39073      if (element.hasContextTypeElement()) {
39074        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39075        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureDefinition.ExtensionContextEnumFactory(), false);
39076      }
39077      if (element.hasContext()) {
39078        openArray("context");
39079        for (StringType e : element.getContext()) 
39080          composeStringCore(null, e, true);
39081        closeArray();
39082        if (anyHasExtras(element.getContext())) {
39083          openArray("_context");
39084          for (StringType e : element.getContext()) 
39085            composeStringExtras(null, e, true);
39086          closeArray();
39087        }
39088      };
39089      if (element.hasContextInvariant()) {
39090        openArray("contextInvariant");
39091        for (StringType e : element.getContextInvariant()) 
39092          composeStringCore(null, e, true);
39093        closeArray();
39094        if (anyHasExtras(element.getContextInvariant())) {
39095          openArray("_contextInvariant");
39096          for (StringType e : element.getContextInvariant()) 
39097            composeStringExtras(null, e, true);
39098          closeArray();
39099        }
39100      };
39101      if (element.hasTypeElement()) {
39102        composeCodeCore("type", element.getTypeElement(), false);
39103        composeCodeExtras("type", element.getTypeElement(), false);
39104      }
39105      if (element.hasBaseDefinitionElement()) {
39106        composeUriCore("baseDefinition", element.getBaseDefinitionElement(), false);
39107        composeUriExtras("baseDefinition", element.getBaseDefinitionElement(), false);
39108      }
39109      if (element.hasDerivationElement()) {
39110        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39111        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
39112      }
39113      if (element.hasSnapshot()) {
39114        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
39115      }
39116      if (element.hasDifferential()) {
39117        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
39118      }
39119  }
39120
39121  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39122    if (element != null) {
39123      open(name);
39124      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
39125      close();
39126    }
39127  }
39128
39129  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
39130      composeBackbone(element);
39131      if (element.hasIdentityElement()) {
39132        composeIdCore("identity", element.getIdentityElement(), false);
39133        composeIdExtras("identity", element.getIdentityElement(), false);
39134      }
39135      if (element.hasUriElement()) {
39136        composeUriCore("uri", element.getUriElement(), false);
39137        composeUriExtras("uri", element.getUriElement(), false);
39138      }
39139      if (element.hasNameElement()) {
39140        composeStringCore("name", element.getNameElement(), false);
39141        composeStringExtras("name", element.getNameElement(), false);
39142      }
39143      if (element.hasCommentElement()) {
39144        composeStringCore("comment", element.getCommentElement(), false);
39145        composeStringExtras("comment", element.getCommentElement(), false);
39146      }
39147  }
39148
39149  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39150    if (element != null) {
39151      open(name);
39152      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
39153      close();
39154    }
39155  }
39156
39157  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
39158      composeBackbone(element);
39159      if (element.hasElement()) {
39160        openArray("element");
39161        for (ElementDefinition e : element.getElement()) 
39162          composeElementDefinition(null, e);
39163        closeArray();
39164      };
39165  }
39166
39167  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39168    if (element != null) {
39169      open(name);
39170      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
39171      close();
39172    }
39173  }
39174
39175  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
39176      composeBackbone(element);
39177      if (element.hasElement()) {
39178        openArray("element");
39179        for (ElementDefinition e : element.getElement()) 
39180          composeElementDefinition(null, e);
39181        closeArray();
39182      };
39183  }
39184
39185  protected void composeStructureMap(String name, StructureMap element) throws IOException {
39186    if (element != null) {
39187      prop("resourceType", name);
39188      composeStructureMapInner(element);
39189    }
39190  }
39191
39192  protected void composeStructureMapInner(StructureMap element) throws IOException {
39193      composeDomainResourceElements(element);
39194      if (element.hasUrlElement()) {
39195        composeUriCore("url", element.getUrlElement(), false);
39196        composeUriExtras("url", element.getUrlElement(), false);
39197      }
39198      if (element.hasIdentifier()) {
39199        openArray("identifier");
39200        for (Identifier e : element.getIdentifier()) 
39201          composeIdentifier(null, e);
39202        closeArray();
39203      };
39204      if (element.hasVersionElement()) {
39205        composeStringCore("version", element.getVersionElement(), false);
39206        composeStringExtras("version", element.getVersionElement(), false);
39207      }
39208      if (element.hasNameElement()) {
39209        composeStringCore("name", element.getNameElement(), false);
39210        composeStringExtras("name", element.getNameElement(), false);
39211      }
39212      if (element.hasTitleElement()) {
39213        composeStringCore("title", element.getTitleElement(), false);
39214        composeStringExtras("title", element.getTitleElement(), false);
39215      }
39216      if (element.hasStatusElement()) {
39217        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39218        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
39219      }
39220      if (element.hasExperimentalElement()) {
39221        composeBooleanCore("experimental", element.getExperimentalElement(), false);
39222        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
39223      }
39224      if (element.hasDateElement()) {
39225        composeDateTimeCore("date", element.getDateElement(), false);
39226        composeDateTimeExtras("date", element.getDateElement(), false);
39227      }
39228      if (element.hasPublisherElement()) {
39229        composeStringCore("publisher", element.getPublisherElement(), false);
39230        composeStringExtras("publisher", element.getPublisherElement(), false);
39231      }
39232      if (element.hasContact()) {
39233        openArray("contact");
39234        for (ContactDetail e : element.getContact()) 
39235          composeContactDetail(null, e);
39236        closeArray();
39237      };
39238      if (element.hasDescriptionElement()) {
39239        composeMarkdownCore("description", element.getDescriptionElement(), false);
39240        composeMarkdownExtras("description", element.getDescriptionElement(), false);
39241      }
39242      if (element.hasUseContext()) {
39243        openArray("useContext");
39244        for (UsageContext e : element.getUseContext()) 
39245          composeUsageContext(null, e);
39246        closeArray();
39247      };
39248      if (element.hasJurisdiction()) {
39249        openArray("jurisdiction");
39250        for (CodeableConcept e : element.getJurisdiction()) 
39251          composeCodeableConcept(null, e);
39252        closeArray();
39253      };
39254      if (element.hasPurposeElement()) {
39255        composeMarkdownCore("purpose", element.getPurposeElement(), false);
39256        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
39257      }
39258      if (element.hasCopyrightElement()) {
39259        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
39260        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
39261      }
39262      if (element.hasStructure()) {
39263        openArray("structure");
39264        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
39265          composeStructureMapStructureMapStructureComponent(null, e);
39266        closeArray();
39267      };
39268      if (element.hasImport()) {
39269        openArray("import");
39270        for (UriType e : element.getImport()) 
39271          composeUriCore(null, e, true);
39272        closeArray();
39273        if (anyHasExtras(element.getImport())) {
39274          openArray("_import");
39275          for (UriType e : element.getImport()) 
39276            composeUriExtras(null, e, true);
39277          closeArray();
39278        }
39279      };
39280      if (element.hasGroup()) {
39281        openArray("group");
39282        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
39283          composeStructureMapStructureMapGroupComponent(null, e);
39284        closeArray();
39285      };
39286  }
39287
39288  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
39289    if (element != null) {
39290      open(name);
39291      composeStructureMapStructureMapStructureComponentInner(element);
39292      close();
39293    }
39294  }
39295
39296  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
39297      composeBackbone(element);
39298      if (element.hasUrlElement()) {
39299        composeUriCore("url", element.getUrlElement(), false);
39300        composeUriExtras("url", element.getUrlElement(), false);
39301      }
39302      if (element.hasModeElement()) {
39303        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39304        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
39305      }
39306      if (element.hasAliasElement()) {
39307        composeStringCore("alias", element.getAliasElement(), false);
39308        composeStringExtras("alias", element.getAliasElement(), false);
39309      }
39310      if (element.hasDocumentationElement()) {
39311        composeStringCore("documentation", element.getDocumentationElement(), false);
39312        composeStringExtras("documentation", element.getDocumentationElement(), false);
39313      }
39314  }
39315
39316  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
39317    if (element != null) {
39318      open(name);
39319      composeStructureMapStructureMapGroupComponentInner(element);
39320      close();
39321    }
39322  }
39323
39324  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
39325      composeBackbone(element);
39326      if (element.hasNameElement()) {
39327        composeIdCore("name", element.getNameElement(), false);
39328        composeIdExtras("name", element.getNameElement(), false);
39329      }
39330      if (element.hasExtendsElement()) {
39331        composeIdCore("extends", element.getExtendsElement(), false);
39332        composeIdExtras("extends", element.getExtendsElement(), false);
39333      }
39334      if (element.hasTypeModeElement()) {
39335        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39336        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
39337      }
39338      if (element.hasDocumentationElement()) {
39339        composeStringCore("documentation", element.getDocumentationElement(), false);
39340        composeStringExtras("documentation", element.getDocumentationElement(), false);
39341      }
39342      if (element.hasInput()) {
39343        openArray("input");
39344        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
39345          composeStructureMapStructureMapGroupInputComponent(null, e);
39346        closeArray();
39347      };
39348      if (element.hasRule()) {
39349        openArray("rule");
39350        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39351          composeStructureMapStructureMapGroupRuleComponent(null, e);
39352        closeArray();
39353      };
39354  }
39355
39356  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
39357    if (element != null) {
39358      open(name);
39359      composeStructureMapStructureMapGroupInputComponentInner(element);
39360      close();
39361    }
39362  }
39363
39364  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
39365      composeBackbone(element);
39366      if (element.hasNameElement()) {
39367        composeIdCore("name", element.getNameElement(), false);
39368        composeIdExtras("name", element.getNameElement(), false);
39369      }
39370      if (element.hasTypeElement()) {
39371        composeStringCore("type", element.getTypeElement(), false);
39372        composeStringExtras("type", element.getTypeElement(), false);
39373      }
39374      if (element.hasModeElement()) {
39375        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39376        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
39377      }
39378      if (element.hasDocumentationElement()) {
39379        composeStringCore("documentation", element.getDocumentationElement(), false);
39380        composeStringExtras("documentation", element.getDocumentationElement(), false);
39381      }
39382  }
39383
39384  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39385    if (element != null) {
39386      open(name);
39387      composeStructureMapStructureMapGroupRuleComponentInner(element);
39388      close();
39389    }
39390  }
39391
39392  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
39393      composeBackbone(element);
39394      if (element.hasNameElement()) {
39395        composeIdCore("name", element.getNameElement(), false);
39396        composeIdExtras("name", element.getNameElement(), false);
39397      }
39398      if (element.hasSource()) {
39399        openArray("source");
39400        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
39401          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
39402        closeArray();
39403      };
39404      if (element.hasTarget()) {
39405        openArray("target");
39406        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
39407          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
39408        closeArray();
39409      };
39410      if (element.hasRule()) {
39411        openArray("rule");
39412        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
39413          composeStructureMapStructureMapGroupRuleComponent(null, e);
39414        closeArray();
39415      };
39416      if (element.hasDependent()) {
39417        openArray("dependent");
39418        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
39419          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
39420        closeArray();
39421      };
39422      if (element.hasDocumentationElement()) {
39423        composeStringCore("documentation", element.getDocumentationElement(), false);
39424        composeStringExtras("documentation", element.getDocumentationElement(), false);
39425      }
39426  }
39427
39428  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39429    if (element != null) {
39430      open(name);
39431      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
39432      close();
39433    }
39434  }
39435
39436  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
39437      composeBackbone(element);
39438      if (element.hasContextElement()) {
39439        composeIdCore("context", element.getContextElement(), false);
39440        composeIdExtras("context", element.getContextElement(), false);
39441      }
39442      if (element.hasMinElement()) {
39443        composeIntegerCore("min", element.getMinElement(), false);
39444        composeIntegerExtras("min", element.getMinElement(), false);
39445      }
39446      if (element.hasMaxElement()) {
39447        composeStringCore("max", element.getMaxElement(), false);
39448        composeStringExtras("max", element.getMaxElement(), false);
39449      }
39450      if (element.hasTypeElement()) {
39451        composeStringCore("type", element.getTypeElement(), false);
39452        composeStringExtras("type", element.getTypeElement(), false);
39453      }
39454      if (element.hasDefaultValue()) {
39455        composeType("defaultValue", element.getDefaultValue());
39456      }
39457      if (element.hasElementElement()) {
39458        composeStringCore("element", element.getElementElement(), false);
39459        composeStringExtras("element", element.getElementElement(), false);
39460      }
39461      if (element.hasListModeElement()) {
39462        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39463        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
39464      }
39465      if (element.hasVariableElement()) {
39466        composeIdCore("variable", element.getVariableElement(), false);
39467        composeIdExtras("variable", element.getVariableElement(), false);
39468      }
39469      if (element.hasConditionElement()) {
39470        composeStringCore("condition", element.getConditionElement(), false);
39471        composeStringExtras("condition", element.getConditionElement(), false);
39472      }
39473      if (element.hasCheckElement()) {
39474        composeStringCore("check", element.getCheckElement(), false);
39475        composeStringExtras("check", element.getCheckElement(), false);
39476      }
39477  }
39478
39479  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39480    if (element != null) {
39481      open(name);
39482      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
39483      close();
39484    }
39485  }
39486
39487  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
39488      composeBackbone(element);
39489      if (element.hasContextElement()) {
39490        composeIdCore("context", element.getContextElement(), false);
39491        composeIdExtras("context", element.getContextElement(), false);
39492      }
39493      if (element.hasContextTypeElement()) {
39494        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39495        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
39496      }
39497      if (element.hasElementElement()) {
39498        composeStringCore("element", element.getElementElement(), false);
39499        composeStringExtras("element", element.getElementElement(), false);
39500      }
39501      if (element.hasVariableElement()) {
39502        composeIdCore("variable", element.getVariableElement(), false);
39503        composeIdExtras("variable", element.getVariableElement(), false);
39504      }
39505      if (element.hasListMode()) {
39506        openArray("listMode");
39507        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39508          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39509        closeArray();
39510        if (anyHasExtras(element.getListMode())) {
39511          openArray("_listMode");
39512          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
39513            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
39514          closeArray();
39515        }
39516      };
39517      if (element.hasListRuleIdElement()) {
39518        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
39519        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
39520      }
39521      if (element.hasTransformElement()) {
39522        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39523        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
39524      }
39525      if (element.hasParameter()) {
39526        openArray("parameter");
39527        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
39528          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
39529        closeArray();
39530      };
39531  }
39532
39533  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39534    if (element != null) {
39535      open(name);
39536      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
39537      close();
39538    }
39539  }
39540
39541  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
39542      composeBackbone(element);
39543      if (element.hasValue()) {
39544        composeType("value", element.getValue());
39545      }
39546  }
39547
39548  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39549    if (element != null) {
39550      open(name);
39551      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
39552      close();
39553    }
39554  }
39555
39556  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
39557      composeBackbone(element);
39558      if (element.hasNameElement()) {
39559        composeIdCore("name", element.getNameElement(), false);
39560        composeIdExtras("name", element.getNameElement(), false);
39561      }
39562      if (element.hasVariable()) {
39563        openArray("variable");
39564        for (StringType e : element.getVariable()) 
39565          composeStringCore(null, e, true);
39566        closeArray();
39567        if (anyHasExtras(element.getVariable())) {
39568          openArray("_variable");
39569          for (StringType e : element.getVariable()) 
39570            composeStringExtras(null, e, true);
39571          closeArray();
39572        }
39573      };
39574  }
39575
39576  protected void composeSubscription(String name, Subscription element) throws IOException {
39577    if (element != null) {
39578      prop("resourceType", name);
39579      composeSubscriptionInner(element);
39580    }
39581  }
39582
39583  protected void composeSubscriptionInner(Subscription element) throws IOException {
39584      composeDomainResourceElements(element);
39585      if (element.hasStatusElement()) {
39586        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39587        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
39588      }
39589      if (element.hasContact()) {
39590        openArray("contact");
39591        for (ContactPoint e : element.getContact()) 
39592          composeContactPoint(null, e);
39593        closeArray();
39594      };
39595      if (element.hasEndElement()) {
39596        composeInstantCore("end", element.getEndElement(), false);
39597        composeInstantExtras("end", element.getEndElement(), false);
39598      }
39599      if (element.hasReasonElement()) {
39600        composeStringCore("reason", element.getReasonElement(), false);
39601        composeStringExtras("reason", element.getReasonElement(), false);
39602      }
39603      if (element.hasCriteriaElement()) {
39604        composeStringCore("criteria", element.getCriteriaElement(), false);
39605        composeStringExtras("criteria", element.getCriteriaElement(), false);
39606      }
39607      if (element.hasErrorElement()) {
39608        composeStringCore("error", element.getErrorElement(), false);
39609        composeStringExtras("error", element.getErrorElement(), false);
39610      }
39611      if (element.hasChannel()) {
39612        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
39613      }
39614      if (element.hasTag()) {
39615        openArray("tag");
39616        for (Coding e : element.getTag()) 
39617          composeCoding(null, e);
39618        closeArray();
39619      };
39620  }
39621
39622  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
39623    if (element != null) {
39624      open(name);
39625      composeSubscriptionSubscriptionChannelComponentInner(element);
39626      close();
39627    }
39628  }
39629
39630  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
39631      composeBackbone(element);
39632      if (element.hasTypeElement()) {
39633        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39634        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
39635      }
39636      if (element.hasEndpointElement()) {
39637        composeUriCore("endpoint", element.getEndpointElement(), false);
39638        composeUriExtras("endpoint", element.getEndpointElement(), false);
39639      }
39640      if (element.hasPayloadElement()) {
39641        composeStringCore("payload", element.getPayloadElement(), false);
39642        composeStringExtras("payload", element.getPayloadElement(), false);
39643      }
39644      if (element.hasHeader()) {
39645        openArray("header");
39646        for (StringType e : element.getHeader()) 
39647          composeStringCore(null, e, true);
39648        closeArray();
39649        if (anyHasExtras(element.getHeader())) {
39650          openArray("_header");
39651          for (StringType e : element.getHeader()) 
39652            composeStringExtras(null, e, true);
39653          closeArray();
39654        }
39655      };
39656  }
39657
39658  protected void composeSubstance(String name, Substance element) throws IOException {
39659    if (element != null) {
39660      prop("resourceType", name);
39661      composeSubstanceInner(element);
39662    }
39663  }
39664
39665  protected void composeSubstanceInner(Substance element) throws IOException {
39666      composeDomainResourceElements(element);
39667      if (element.hasIdentifier()) {
39668        openArray("identifier");
39669        for (Identifier e : element.getIdentifier()) 
39670          composeIdentifier(null, e);
39671        closeArray();
39672      };
39673      if (element.hasStatusElement()) {
39674        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
39675        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
39676      }
39677      if (element.hasCategory()) {
39678        openArray("category");
39679        for (CodeableConcept e : element.getCategory()) 
39680          composeCodeableConcept(null, e);
39681        closeArray();
39682      };
39683      if (element.hasCode()) {
39684        composeCodeableConcept("code", element.getCode());
39685      }
39686      if (element.hasDescriptionElement()) {
39687        composeStringCore("description", element.getDescriptionElement(), false);
39688        composeStringExtras("description", element.getDescriptionElement(), false);
39689      }
39690      if (element.hasInstance()) {
39691        openArray("instance");
39692        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
39693          composeSubstanceSubstanceInstanceComponent(null, e);
39694        closeArray();
39695      };
39696      if (element.hasIngredient()) {
39697        openArray("ingredient");
39698        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
39699          composeSubstanceSubstanceIngredientComponent(null, e);
39700        closeArray();
39701      };
39702  }
39703
39704  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
39705    if (element != null) {
39706      open(name);
39707      composeSubstanceSubstanceInstanceComponentInner(element);
39708      close();
39709    }
39710  }
39711
39712  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
39713      composeBackbone(element);
39714      if (element.hasIdentifier()) {
39715        composeIdentifier("identifier", element.getIdentifier());
39716      }
39717      if (element.hasExpiryElement()) {
39718        composeDateTimeCore("expiry", element.getExpiryElement(), false);
39719        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
39720      }
39721      if (element.hasQuantity()) {
39722        composeSimpleQuantity("quantity", element.getQuantity());
39723      }
39724  }
39725
39726  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
39727    if (element != null) {
39728      open(name);
39729      composeSubstanceSubstanceIngredientComponentInner(element);
39730      close();
39731    }
39732  }
39733
39734  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
39735      composeBackbone(element);
39736      if (element.hasQuantity()) {
39737        composeRatio("quantity", element.getQuantity());
39738      }
39739      if (element.hasSubstance()) {
39740        composeType("substance", element.getSubstance());
39741      }
39742  }
39743
39744  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
39745    if (element != null) {
39746      prop("resourceType", name);
39747      composeSupplyDeliveryInner(element);
39748    }
39749  }
39750
39751  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
39752      composeDomainResourceElements(element);
39753      if (element.hasIdentifier()) {
39754        composeIdentifier("identifier", element.getIdentifier());
39755      }
39756      if (element.hasBasedOn()) {
39757        openArray("basedOn");
39758        for (Reference e : element.getBasedOn()) 
39759          composeReference(null, e);
39760        closeArray();
39761      };
39762      if (element.hasPartOf()) {
39763        openArray("partOf");
39764        for (Reference e : element.getPartOf()) 
39765          composeReference(null, e);
39766        closeArray();
39767      };
39768      if (element.hasStatusElement()) {
39769        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
39770        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
39771      }
39772      if (element.hasPatient()) {
39773        composeReference("patient", element.getPatient());
39774      }
39775      if (element.hasType()) {
39776        composeCodeableConcept("type", element.getType());
39777      }
39778      if (element.hasSuppliedItem()) {
39779        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
39780      }
39781      if (element.hasOccurrence()) {
39782        composeType("occurrence", element.getOccurrence());
39783      }
39784      if (element.hasSupplier()) {
39785        composeReference("supplier", element.getSupplier());
39786      }
39787      if (element.hasDestination()) {
39788        composeReference("destination", element.getDestination());
39789      }
39790      if (element.hasReceiver()) {
39791        openArray("receiver");
39792        for (Reference e : element.getReceiver()) 
39793          composeReference(null, e);
39794        closeArray();
39795      };
39796  }
39797
39798  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
39799    if (element != null) {
39800      open(name);
39801      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
39802      close();
39803    }
39804  }
39805
39806  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
39807      composeBackbone(element);
39808      if (element.hasQuantity()) {
39809        composeSimpleQuantity("quantity", element.getQuantity());
39810      }
39811      if (element.hasItem()) {
39812        composeType("item", element.getItem());
39813      }
39814  }
39815
39816  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
39817    if (element != null) {
39818      prop("resourceType", name);
39819      composeSupplyRequestInner(element);
39820    }
39821  }
39822
39823  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
39824      composeDomainResourceElements(element);
39825      if (element.hasIdentifier()) {
39826        composeIdentifier("identifier", element.getIdentifier());
39827      }
39828      if (element.hasStatusElement()) {
39829        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
39830        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
39831      }
39832      if (element.hasCategory()) {
39833        composeCodeableConcept("category", element.getCategory());
39834      }
39835      if (element.hasPriorityElement()) {
39836        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
39837        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
39838      }
39839      if (element.hasOrderedItem()) {
39840        composeSupplyRequestSupplyRequestOrderedItemComponent("orderedItem", element.getOrderedItem());
39841      }
39842      if (element.hasOccurrence()) {
39843        composeType("occurrence", element.getOccurrence());
39844      }
39845      if (element.hasAuthoredOnElement()) {
39846        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
39847        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
39848      }
39849      if (element.hasRequester()) {
39850        composeSupplyRequestSupplyRequestRequesterComponent("requester", element.getRequester());
39851      }
39852      if (element.hasSupplier()) {
39853        openArray("supplier");
39854        for (Reference e : element.getSupplier()) 
39855          composeReference(null, e);
39856        closeArray();
39857      };
39858      if (element.hasReason()) {
39859        composeType("reason", element.getReason());
39860      }
39861      if (element.hasDeliverFrom()) {
39862        composeReference("deliverFrom", element.getDeliverFrom());
39863      }
39864      if (element.hasDeliverTo()) {
39865        composeReference("deliverTo", element.getDeliverTo());
39866      }
39867  }
39868
39869  protected void composeSupplyRequestSupplyRequestOrderedItemComponent(String name, SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
39870    if (element != null) {
39871      open(name);
39872      composeSupplyRequestSupplyRequestOrderedItemComponentInner(element);
39873      close();
39874    }
39875  }
39876
39877  protected void composeSupplyRequestSupplyRequestOrderedItemComponentInner(SupplyRequest.SupplyRequestOrderedItemComponent element) throws IOException {
39878      composeBackbone(element);
39879      if (element.hasQuantity()) {
39880        composeQuantity("quantity", element.getQuantity());
39881      }
39882      if (element.hasItem()) {
39883        composeType("item", element.getItem());
39884      }
39885  }
39886
39887  protected void composeSupplyRequestSupplyRequestRequesterComponent(String name, SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
39888    if (element != null) {
39889      open(name);
39890      composeSupplyRequestSupplyRequestRequesterComponentInner(element);
39891      close();
39892    }
39893  }
39894
39895  protected void composeSupplyRequestSupplyRequestRequesterComponentInner(SupplyRequest.SupplyRequestRequesterComponent element) throws IOException {
39896      composeBackbone(element);
39897      if (element.hasAgent()) {
39898        composeReference("agent", element.getAgent());
39899      }
39900      if (element.hasOnBehalfOf()) {
39901        composeReference("onBehalfOf", element.getOnBehalfOf());
39902      }
39903  }
39904
39905  protected void composeTask(String name, Task element) throws IOException {
39906    if (element != null) {
39907      prop("resourceType", name);
39908      composeTaskInner(element);
39909    }
39910  }
39911
39912  protected void composeTaskInner(Task element) throws IOException {
39913      composeDomainResourceElements(element);
39914      if (element.hasIdentifier()) {
39915        openArray("identifier");
39916        for (Identifier e : element.getIdentifier()) 
39917          composeIdentifier(null, e);
39918        closeArray();
39919      };
39920      if (element.hasDefinition()) {
39921        composeType("definition", element.getDefinition());
39922      }
39923      if (element.hasBasedOn()) {
39924        openArray("basedOn");
39925        for (Reference e : element.getBasedOn()) 
39926          composeReference(null, e);
39927        closeArray();
39928      };
39929      if (element.hasGroupIdentifier()) {
39930        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
39931      }
39932      if (element.hasPartOf()) {
39933        openArray("partOf");
39934        for (Reference e : element.getPartOf()) 
39935          composeReference(null, e);
39936        closeArray();
39937      };
39938      if (element.hasStatusElement()) {
39939        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
39940        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
39941      }
39942      if (element.hasStatusReason()) {
39943        composeCodeableConcept("statusReason", element.getStatusReason());
39944      }
39945      if (element.hasBusinessStatus()) {
39946        composeCodeableConcept("businessStatus", element.getBusinessStatus());
39947      }
39948      if (element.hasIntentElement()) {
39949        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
39950        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
39951      }
39952      if (element.hasPriorityElement()) {
39953        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
39954        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
39955      }
39956      if (element.hasCode()) {
39957        composeCodeableConcept("code", element.getCode());
39958      }
39959      if (element.hasDescriptionElement()) {
39960        composeStringCore("description", element.getDescriptionElement(), false);
39961        composeStringExtras("description", element.getDescriptionElement(), false);
39962      }
39963      if (element.hasFocus()) {
39964        composeReference("focus", element.getFocus());
39965      }
39966      if (element.hasFor()) {
39967        composeReference("for", element.getFor());
39968      }
39969      if (element.hasContext()) {
39970        composeReference("context", element.getContext());
39971      }
39972      if (element.hasExecutionPeriod()) {
39973        composePeriod("executionPeriod", element.getExecutionPeriod());
39974      }
39975      if (element.hasAuthoredOnElement()) {
39976        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
39977        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
39978      }
39979      if (element.hasLastModifiedElement()) {
39980        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
39981        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
39982      }
39983      if (element.hasRequester()) {
39984        composeTaskTaskRequesterComponent("requester", element.getRequester());
39985      }
39986      if (element.hasPerformerType()) {
39987        openArray("performerType");
39988        for (CodeableConcept e : element.getPerformerType()) 
39989          composeCodeableConcept(null, e);
39990        closeArray();
39991      };
39992      if (element.hasOwner()) {
39993        composeReference("owner", element.getOwner());
39994      }
39995      if (element.hasReason()) {
39996        composeCodeableConcept("reason", element.getReason());
39997      }
39998      if (element.hasNote()) {
39999        openArray("note");
40000        for (Annotation e : element.getNote()) 
40001          composeAnnotation(null, e);
40002        closeArray();
40003      };
40004      if (element.hasRelevantHistory()) {
40005        openArray("relevantHistory");
40006        for (Reference e : element.getRelevantHistory()) 
40007          composeReference(null, e);
40008        closeArray();
40009      };
40010      if (element.hasRestriction()) {
40011        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
40012      }
40013      if (element.hasInput()) {
40014        openArray("input");
40015        for (Task.ParameterComponent e : element.getInput()) 
40016          composeTaskParameterComponent(null, e);
40017        closeArray();
40018      };
40019      if (element.hasOutput()) {
40020        openArray("output");
40021        for (Task.TaskOutputComponent e : element.getOutput()) 
40022          composeTaskTaskOutputComponent(null, e);
40023        closeArray();
40024      };
40025  }
40026
40027  protected void composeTaskTaskRequesterComponent(String name, Task.TaskRequesterComponent element) throws IOException {
40028    if (element != null) {
40029      open(name);
40030      composeTaskTaskRequesterComponentInner(element);
40031      close();
40032    }
40033  }
40034
40035  protected void composeTaskTaskRequesterComponentInner(Task.TaskRequesterComponent element) throws IOException {
40036      composeBackbone(element);
40037      if (element.hasAgent()) {
40038        composeReference("agent", element.getAgent());
40039      }
40040      if (element.hasOnBehalfOf()) {
40041        composeReference("onBehalfOf", element.getOnBehalfOf());
40042      }
40043  }
40044
40045  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
40046    if (element != null) {
40047      open(name);
40048      composeTaskTaskRestrictionComponentInner(element);
40049      close();
40050    }
40051  }
40052
40053  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
40054      composeBackbone(element);
40055      if (element.hasRepetitionsElement()) {
40056        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
40057        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
40058      }
40059      if (element.hasPeriod()) {
40060        composePeriod("period", element.getPeriod());
40061      }
40062      if (element.hasRecipient()) {
40063        openArray("recipient");
40064        for (Reference e : element.getRecipient()) 
40065          composeReference(null, e);
40066        closeArray();
40067      };
40068  }
40069
40070  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
40071    if (element != null) {
40072      open(name);
40073      composeTaskParameterComponentInner(element);
40074      close();
40075    }
40076  }
40077
40078  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
40079      composeBackbone(element);
40080      if (element.hasType()) {
40081        composeCodeableConcept("type", element.getType());
40082      }
40083      if (element.hasValue()) {
40084        composeType("value", element.getValue());
40085      }
40086  }
40087
40088  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
40089    if (element != null) {
40090      open(name);
40091      composeTaskTaskOutputComponentInner(element);
40092      close();
40093    }
40094  }
40095
40096  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
40097      composeBackbone(element);
40098      if (element.hasType()) {
40099        composeCodeableConcept("type", element.getType());
40100      }
40101      if (element.hasValue()) {
40102        composeType("value", element.getValue());
40103      }
40104  }
40105
40106  protected void composeTestReport(String name, TestReport element) throws IOException {
40107    if (element != null) {
40108      prop("resourceType", name);
40109      composeTestReportInner(element);
40110    }
40111  }
40112
40113  protected void composeTestReportInner(TestReport element) throws IOException {
40114      composeDomainResourceElements(element);
40115      if (element.hasIdentifier()) {
40116        composeIdentifier("identifier", element.getIdentifier());
40117      }
40118      if (element.hasNameElement()) {
40119        composeStringCore("name", element.getNameElement(), false);
40120        composeStringExtras("name", element.getNameElement(), false);
40121      }
40122      if (element.hasStatusElement()) {
40123        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40124        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
40125      }
40126      if (element.hasTestScript()) {
40127        composeReference("testScript", element.getTestScript());
40128      }
40129      if (element.hasResultElement()) {
40130        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40131        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
40132      }
40133      if (element.hasScoreElement()) {
40134        composeDecimalCore("score", element.getScoreElement(), false);
40135        composeDecimalExtras("score", element.getScoreElement(), false);
40136      }
40137      if (element.hasTesterElement()) {
40138        composeStringCore("tester", element.getTesterElement(), false);
40139        composeStringExtras("tester", element.getTesterElement(), false);
40140      }
40141      if (element.hasIssuedElement()) {
40142        composeDateTimeCore("issued", element.getIssuedElement(), false);
40143        composeDateTimeExtras("issued", element.getIssuedElement(), false);
40144      }
40145      if (element.hasParticipant()) {
40146        openArray("participant");
40147        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
40148          composeTestReportTestReportParticipantComponent(null, e);
40149        closeArray();
40150      };
40151      if (element.hasSetup()) {
40152        composeTestReportTestReportSetupComponent("setup", element.getSetup());
40153      }
40154      if (element.hasTest()) {
40155        openArray("test");
40156        for (TestReport.TestReportTestComponent e : element.getTest()) 
40157          composeTestReportTestReportTestComponent(null, e);
40158        closeArray();
40159      };
40160      if (element.hasTeardown()) {
40161        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
40162      }
40163  }
40164
40165  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
40166    if (element != null) {
40167      open(name);
40168      composeTestReportTestReportParticipantComponentInner(element);
40169      close();
40170    }
40171  }
40172
40173  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
40174      composeBackbone(element);
40175      if (element.hasTypeElement()) {
40176        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40177        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
40178      }
40179      if (element.hasUriElement()) {
40180        composeUriCore("uri", element.getUriElement(), false);
40181        composeUriExtras("uri", element.getUriElement(), false);
40182      }
40183      if (element.hasDisplayElement()) {
40184        composeStringCore("display", element.getDisplayElement(), false);
40185        composeStringExtras("display", element.getDisplayElement(), false);
40186      }
40187  }
40188
40189  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
40190    if (element != null) {
40191      open(name);
40192      composeTestReportTestReportSetupComponentInner(element);
40193      close();
40194    }
40195  }
40196
40197  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
40198      composeBackbone(element);
40199      if (element.hasAction()) {
40200        openArray("action");
40201        for (TestReport.SetupActionComponent e : element.getAction()) 
40202          composeTestReportSetupActionComponent(null, e);
40203        closeArray();
40204      };
40205  }
40206
40207  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
40208    if (element != null) {
40209      open(name);
40210      composeTestReportSetupActionComponentInner(element);
40211      close();
40212    }
40213  }
40214
40215  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
40216      composeBackbone(element);
40217      if (element.hasOperation()) {
40218        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40219      }
40220      if (element.hasAssert()) {
40221        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40222      }
40223  }
40224
40225  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
40226    if (element != null) {
40227      open(name);
40228      composeTestReportSetupActionOperationComponentInner(element);
40229      close();
40230    }
40231  }
40232
40233  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
40234      composeBackbone(element);
40235      if (element.hasResultElement()) {
40236        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40237        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40238      }
40239      if (element.hasMessageElement()) {
40240        composeMarkdownCore("message", element.getMessageElement(), false);
40241        composeMarkdownExtras("message", element.getMessageElement(), false);
40242      }
40243      if (element.hasDetailElement()) {
40244        composeUriCore("detail", element.getDetailElement(), false);
40245        composeUriExtras("detail", element.getDetailElement(), false);
40246      }
40247  }
40248
40249  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
40250    if (element != null) {
40251      open(name);
40252      composeTestReportSetupActionAssertComponentInner(element);
40253      close();
40254    }
40255  }
40256
40257  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
40258      composeBackbone(element);
40259      if (element.hasResultElement()) {
40260        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40261        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
40262      }
40263      if (element.hasMessageElement()) {
40264        composeMarkdownCore("message", element.getMessageElement(), false);
40265        composeMarkdownExtras("message", element.getMessageElement(), false);
40266      }
40267      if (element.hasDetailElement()) {
40268        composeStringCore("detail", element.getDetailElement(), false);
40269        composeStringExtras("detail", element.getDetailElement(), false);
40270      }
40271  }
40272
40273  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
40274    if (element != null) {
40275      open(name);
40276      composeTestReportTestReportTestComponentInner(element);
40277      close();
40278    }
40279  }
40280
40281  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
40282      composeBackbone(element);
40283      if (element.hasNameElement()) {
40284        composeStringCore("name", element.getNameElement(), false);
40285        composeStringExtras("name", element.getNameElement(), false);
40286      }
40287      if (element.hasDescriptionElement()) {
40288        composeStringCore("description", element.getDescriptionElement(), false);
40289        composeStringExtras("description", element.getDescriptionElement(), false);
40290      }
40291      if (element.hasAction()) {
40292        openArray("action");
40293        for (TestReport.TestActionComponent e : element.getAction()) 
40294          composeTestReportTestActionComponent(null, e);
40295        closeArray();
40296      };
40297  }
40298
40299  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
40300    if (element != null) {
40301      open(name);
40302      composeTestReportTestActionComponentInner(element);
40303      close();
40304    }
40305  }
40306
40307  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
40308      composeBackbone(element);
40309      if (element.hasOperation()) {
40310        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40311      }
40312      if (element.hasAssert()) {
40313        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
40314      }
40315  }
40316
40317  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
40318    if (element != null) {
40319      open(name);
40320      composeTestReportTestReportTeardownComponentInner(element);
40321      close();
40322    }
40323  }
40324
40325  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
40326      composeBackbone(element);
40327      if (element.hasAction()) {
40328        openArray("action");
40329        for (TestReport.TeardownActionComponent e : element.getAction()) 
40330          composeTestReportTeardownActionComponent(null, e);
40331        closeArray();
40332      };
40333  }
40334
40335  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
40336    if (element != null) {
40337      open(name);
40338      composeTestReportTeardownActionComponentInner(element);
40339      close();
40340    }
40341  }
40342
40343  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
40344      composeBackbone(element);
40345      if (element.hasOperation()) {
40346        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
40347      }
40348  }
40349
40350  protected void composeTestScript(String name, TestScript element) throws IOException {
40351    if (element != null) {
40352      prop("resourceType", name);
40353      composeTestScriptInner(element);
40354    }
40355  }
40356
40357  protected void composeTestScriptInner(TestScript element) throws IOException {
40358      composeDomainResourceElements(element);
40359      if (element.hasUrlElement()) {
40360        composeUriCore("url", element.getUrlElement(), false);
40361        composeUriExtras("url", element.getUrlElement(), false);
40362      }
40363      if (element.hasIdentifier()) {
40364        composeIdentifier("identifier", element.getIdentifier());
40365      }
40366      if (element.hasVersionElement()) {
40367        composeStringCore("version", element.getVersionElement(), false);
40368        composeStringExtras("version", element.getVersionElement(), false);
40369      }
40370      if (element.hasNameElement()) {
40371        composeStringCore("name", element.getNameElement(), false);
40372        composeStringExtras("name", element.getNameElement(), false);
40373      }
40374      if (element.hasTitleElement()) {
40375        composeStringCore("title", element.getTitleElement(), false);
40376        composeStringExtras("title", element.getTitleElement(), false);
40377      }
40378      if (element.hasStatusElement()) {
40379        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40380        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40381      }
40382      if (element.hasExperimentalElement()) {
40383        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40384        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40385      }
40386      if (element.hasDateElement()) {
40387        composeDateTimeCore("date", element.getDateElement(), false);
40388        composeDateTimeExtras("date", element.getDateElement(), false);
40389      }
40390      if (element.hasPublisherElement()) {
40391        composeStringCore("publisher", element.getPublisherElement(), false);
40392        composeStringExtras("publisher", element.getPublisherElement(), false);
40393      }
40394      if (element.hasContact()) {
40395        openArray("contact");
40396        for (ContactDetail e : element.getContact()) 
40397          composeContactDetail(null, e);
40398        closeArray();
40399      };
40400      if (element.hasDescriptionElement()) {
40401        composeMarkdownCore("description", element.getDescriptionElement(), false);
40402        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40403      }
40404      if (element.hasUseContext()) {
40405        openArray("useContext");
40406        for (UsageContext e : element.getUseContext()) 
40407          composeUsageContext(null, e);
40408        closeArray();
40409      };
40410      if (element.hasJurisdiction()) {
40411        openArray("jurisdiction");
40412        for (CodeableConcept e : element.getJurisdiction()) 
40413          composeCodeableConcept(null, e);
40414        closeArray();
40415      };
40416      if (element.hasPurposeElement()) {
40417        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40418        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40419      }
40420      if (element.hasCopyrightElement()) {
40421        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
40422        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
40423      }
40424      if (element.hasOrigin()) {
40425        openArray("origin");
40426        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
40427          composeTestScriptTestScriptOriginComponent(null, e);
40428        closeArray();
40429      };
40430      if (element.hasDestination()) {
40431        openArray("destination");
40432        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
40433          composeTestScriptTestScriptDestinationComponent(null, e);
40434        closeArray();
40435      };
40436      if (element.hasMetadata()) {
40437        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
40438      }
40439      if (element.hasFixture()) {
40440        openArray("fixture");
40441        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
40442          composeTestScriptTestScriptFixtureComponent(null, e);
40443        closeArray();
40444      };
40445      if (element.hasProfile()) {
40446        openArray("profile");
40447        for (Reference e : element.getProfile()) 
40448          composeReference(null, e);
40449        closeArray();
40450      };
40451      if (element.hasVariable()) {
40452        openArray("variable");
40453        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
40454          composeTestScriptTestScriptVariableComponent(null, e);
40455        closeArray();
40456      };
40457      if (element.hasRule()) {
40458        openArray("rule");
40459        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
40460          composeTestScriptTestScriptRuleComponent(null, e);
40461        closeArray();
40462      };
40463      if (element.hasRuleset()) {
40464        openArray("ruleset");
40465        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
40466          composeTestScriptTestScriptRulesetComponent(null, e);
40467        closeArray();
40468      };
40469      if (element.hasSetup()) {
40470        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
40471      }
40472      if (element.hasTest()) {
40473        openArray("test");
40474        for (TestScript.TestScriptTestComponent e : element.getTest()) 
40475          composeTestScriptTestScriptTestComponent(null, e);
40476        closeArray();
40477      };
40478      if (element.hasTeardown()) {
40479        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
40480      }
40481  }
40482
40483  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
40484    if (element != null) {
40485      open(name);
40486      composeTestScriptTestScriptOriginComponentInner(element);
40487      close();
40488    }
40489  }
40490
40491  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
40492      composeBackbone(element);
40493      if (element.hasIndexElement()) {
40494        composeIntegerCore("index", element.getIndexElement(), false);
40495        composeIntegerExtras("index", element.getIndexElement(), false);
40496      }
40497      if (element.hasProfile()) {
40498        composeCoding("profile", element.getProfile());
40499      }
40500  }
40501
40502  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
40503    if (element != null) {
40504      open(name);
40505      composeTestScriptTestScriptDestinationComponentInner(element);
40506      close();
40507    }
40508  }
40509
40510  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
40511      composeBackbone(element);
40512      if (element.hasIndexElement()) {
40513        composeIntegerCore("index", element.getIndexElement(), false);
40514        composeIntegerExtras("index", element.getIndexElement(), false);
40515      }
40516      if (element.hasProfile()) {
40517        composeCoding("profile", element.getProfile());
40518      }
40519  }
40520
40521  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
40522    if (element != null) {
40523      open(name);
40524      composeTestScriptTestScriptMetadataComponentInner(element);
40525      close();
40526    }
40527  }
40528
40529  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
40530      composeBackbone(element);
40531      if (element.hasLink()) {
40532        openArray("link");
40533        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
40534          composeTestScriptTestScriptMetadataLinkComponent(null, e);
40535        closeArray();
40536      };
40537      if (element.hasCapability()) {
40538        openArray("capability");
40539        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
40540          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
40541        closeArray();
40542      };
40543  }
40544
40545  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40546    if (element != null) {
40547      open(name);
40548      composeTestScriptTestScriptMetadataLinkComponentInner(element);
40549      close();
40550    }
40551  }
40552
40553  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
40554      composeBackbone(element);
40555      if (element.hasUrlElement()) {
40556        composeUriCore("url", element.getUrlElement(), false);
40557        composeUriExtras("url", element.getUrlElement(), false);
40558      }
40559      if (element.hasDescriptionElement()) {
40560        composeStringCore("description", element.getDescriptionElement(), false);
40561        composeStringExtras("description", element.getDescriptionElement(), false);
40562      }
40563  }
40564
40565  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40566    if (element != null) {
40567      open(name);
40568      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
40569      close();
40570    }
40571  }
40572
40573  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
40574      composeBackbone(element);
40575      if (element.hasRequiredElement()) {
40576        composeBooleanCore("required", element.getRequiredElement(), false);
40577        composeBooleanExtras("required", element.getRequiredElement(), false);
40578      }
40579      if (element.hasValidatedElement()) {
40580        composeBooleanCore("validated", element.getValidatedElement(), false);
40581        composeBooleanExtras("validated", element.getValidatedElement(), false);
40582      }
40583      if (element.hasDescriptionElement()) {
40584        composeStringCore("description", element.getDescriptionElement(), false);
40585        composeStringExtras("description", element.getDescriptionElement(), false);
40586      }
40587      if (element.hasOrigin()) {
40588        openArray("origin");
40589        for (IntegerType e : element.getOrigin()) 
40590          composeIntegerCore(null, e, true);
40591        closeArray();
40592        if (anyHasExtras(element.getOrigin())) {
40593          openArray("_origin");
40594          for (IntegerType e : element.getOrigin()) 
40595            composeIntegerExtras(null, e, true);
40596          closeArray();
40597        }
40598      };
40599      if (element.hasDestinationElement()) {
40600        composeIntegerCore("destination", element.getDestinationElement(), false);
40601        composeIntegerExtras("destination", element.getDestinationElement(), false);
40602      }
40603      if (element.hasLink()) {
40604        openArray("link");
40605        for (UriType e : element.getLink()) 
40606          composeUriCore(null, e, true);
40607        closeArray();
40608        if (anyHasExtras(element.getLink())) {
40609          openArray("_link");
40610          for (UriType e : element.getLink()) 
40611            composeUriExtras(null, e, true);
40612          closeArray();
40613        }
40614      };
40615      if (element.hasCapabilities()) {
40616        composeReference("capabilities", element.getCapabilities());
40617      }
40618  }
40619
40620  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
40621    if (element != null) {
40622      open(name);
40623      composeTestScriptTestScriptFixtureComponentInner(element);
40624      close();
40625    }
40626  }
40627
40628  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
40629      composeBackbone(element);
40630      if (element.hasAutocreateElement()) {
40631        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
40632        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
40633      }
40634      if (element.hasAutodeleteElement()) {
40635        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
40636        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
40637      }
40638      if (element.hasResource()) {
40639        composeReference("resource", element.getResource());
40640      }
40641  }
40642
40643  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
40644    if (element != null) {
40645      open(name);
40646      composeTestScriptTestScriptVariableComponentInner(element);
40647      close();
40648    }
40649  }
40650
40651  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
40652      composeBackbone(element);
40653      if (element.hasNameElement()) {
40654        composeStringCore("name", element.getNameElement(), false);
40655        composeStringExtras("name", element.getNameElement(), false);
40656      }
40657      if (element.hasDefaultValueElement()) {
40658        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
40659        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
40660      }
40661      if (element.hasDescriptionElement()) {
40662        composeStringCore("description", element.getDescriptionElement(), false);
40663        composeStringExtras("description", element.getDescriptionElement(), false);
40664      }
40665      if (element.hasExpressionElement()) {
40666        composeStringCore("expression", element.getExpressionElement(), false);
40667        composeStringExtras("expression", element.getExpressionElement(), false);
40668      }
40669      if (element.hasHeaderFieldElement()) {
40670        composeStringCore("headerField", element.getHeaderFieldElement(), false);
40671        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
40672      }
40673      if (element.hasHintElement()) {
40674        composeStringCore("hint", element.getHintElement(), false);
40675        composeStringExtras("hint", element.getHintElement(), false);
40676      }
40677      if (element.hasPathElement()) {
40678        composeStringCore("path", element.getPathElement(), false);
40679        composeStringExtras("path", element.getPathElement(), false);
40680      }
40681      if (element.hasSourceIdElement()) {
40682        composeIdCore("sourceId", element.getSourceIdElement(), false);
40683        composeIdExtras("sourceId", element.getSourceIdElement(), false);
40684      }
40685  }
40686
40687  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
40688    if (element != null) {
40689      open(name);
40690      composeTestScriptTestScriptRuleComponentInner(element);
40691      close();
40692    }
40693  }
40694
40695  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
40696      composeBackbone(element);
40697      if (element.hasResource()) {
40698        composeReference("resource", element.getResource());
40699      }
40700      if (element.hasParam()) {
40701        openArray("param");
40702        for (TestScript.RuleParamComponent e : element.getParam()) 
40703          composeTestScriptRuleParamComponent(null, e);
40704        closeArray();
40705      };
40706  }
40707
40708  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
40709    if (element != null) {
40710      open(name);
40711      composeTestScriptRuleParamComponentInner(element);
40712      close();
40713    }
40714  }
40715
40716  protected void composeTestScriptRuleParamComponentInner(TestScript.RuleParamComponent element) throws IOException {
40717      composeBackbone(element);
40718      if (element.hasNameElement()) {
40719        composeStringCore("name", element.getNameElement(), false);
40720        composeStringExtras("name", element.getNameElement(), false);
40721      }
40722      if (element.hasValueElement()) {
40723        composeStringCore("value", element.getValueElement(), false);
40724        composeStringExtras("value", element.getValueElement(), false);
40725      }
40726  }
40727
40728  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
40729    if (element != null) {
40730      open(name);
40731      composeTestScriptTestScriptRulesetComponentInner(element);
40732      close();
40733    }
40734  }
40735
40736  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
40737      composeBackbone(element);
40738      if (element.hasResource()) {
40739        composeReference("resource", element.getResource());
40740      }
40741      if (element.hasRule()) {
40742        openArray("rule");
40743        for (TestScript.RulesetRuleComponent e : element.getRule()) 
40744          composeTestScriptRulesetRuleComponent(null, e);
40745        closeArray();
40746      };
40747  }
40748
40749  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
40750    if (element != null) {
40751      open(name);
40752      composeTestScriptRulesetRuleComponentInner(element);
40753      close();
40754    }
40755  }
40756
40757  protected void composeTestScriptRulesetRuleComponentInner(TestScript.RulesetRuleComponent element) throws IOException {
40758      composeBackbone(element);
40759      if (element.hasRuleIdElement()) {
40760        composeIdCore("ruleId", element.getRuleIdElement(), false);
40761        composeIdExtras("ruleId", element.getRuleIdElement(), false);
40762      }
40763      if (element.hasParam()) {
40764        openArray("param");
40765        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
40766          composeTestScriptRulesetRuleParamComponent(null, e);
40767        closeArray();
40768      };
40769  }
40770
40771  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
40772    if (element != null) {
40773      open(name);
40774      composeTestScriptRulesetRuleParamComponentInner(element);
40775      close();
40776    }
40777  }
40778
40779  protected void composeTestScriptRulesetRuleParamComponentInner(TestScript.RulesetRuleParamComponent element) throws IOException {
40780      composeBackbone(element);
40781      if (element.hasNameElement()) {
40782        composeStringCore("name", element.getNameElement(), false);
40783        composeStringExtras("name", element.getNameElement(), false);
40784      }
40785      if (element.hasValueElement()) {
40786        composeStringCore("value", element.getValueElement(), false);
40787        composeStringExtras("value", element.getValueElement(), false);
40788      }
40789  }
40790
40791  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
40792    if (element != null) {
40793      open(name);
40794      composeTestScriptTestScriptSetupComponentInner(element);
40795      close();
40796    }
40797  }
40798
40799  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
40800      composeBackbone(element);
40801      if (element.hasAction()) {
40802        openArray("action");
40803        for (TestScript.SetupActionComponent e : element.getAction()) 
40804          composeTestScriptSetupActionComponent(null, e);
40805        closeArray();
40806      };
40807  }
40808
40809  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
40810    if (element != null) {
40811      open(name);
40812      composeTestScriptSetupActionComponentInner(element);
40813      close();
40814    }
40815  }
40816
40817  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
40818      composeBackbone(element);
40819      if (element.hasOperation()) {
40820        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
40821      }
40822      if (element.hasAssert()) {
40823        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
40824      }
40825  }
40826
40827  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
40828    if (element != null) {
40829      open(name);
40830      composeTestScriptSetupActionOperationComponentInner(element);
40831      close();
40832    }
40833  }
40834
40835  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
40836      composeBackbone(element);
40837      if (element.hasType()) {
40838        composeCoding("type", element.getType());
40839      }
40840      if (element.hasResourceElement()) {
40841        composeCodeCore("resource", element.getResourceElement(), false);
40842        composeCodeExtras("resource", element.getResourceElement(), false);
40843      }
40844      if (element.hasLabelElement()) {
40845        composeStringCore("label", element.getLabelElement(), false);
40846        composeStringExtras("label", element.getLabelElement(), false);
40847      }
40848      if (element.hasDescriptionElement()) {
40849        composeStringCore("description", element.getDescriptionElement(), false);
40850        composeStringExtras("description", element.getDescriptionElement(), false);
40851      }
40852      if (element.hasAcceptElement()) {
40853        composeEnumerationCore("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
40854        composeEnumerationExtras("accept", element.getAcceptElement(), new TestScript.ContentTypeEnumFactory(), false);
40855      }
40856      if (element.hasContentTypeElement()) {
40857        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40858        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40859      }
40860      if (element.hasDestinationElement()) {
40861        composeIntegerCore("destination", element.getDestinationElement(), false);
40862        composeIntegerExtras("destination", element.getDestinationElement(), false);
40863      }
40864      if (element.hasEncodeRequestUrlElement()) {
40865        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
40866        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
40867      }
40868      if (element.hasOriginElement()) {
40869        composeIntegerCore("origin", element.getOriginElement(), false);
40870        composeIntegerExtras("origin", element.getOriginElement(), false);
40871      }
40872      if (element.hasParamsElement()) {
40873        composeStringCore("params", element.getParamsElement(), false);
40874        composeStringExtras("params", element.getParamsElement(), false);
40875      }
40876      if (element.hasRequestHeader()) {
40877        openArray("requestHeader");
40878        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
40879          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
40880        closeArray();
40881      };
40882      if (element.hasRequestIdElement()) {
40883        composeIdCore("requestId", element.getRequestIdElement(), false);
40884        composeIdExtras("requestId", element.getRequestIdElement(), false);
40885      }
40886      if (element.hasResponseIdElement()) {
40887        composeIdCore("responseId", element.getResponseIdElement(), false);
40888        composeIdExtras("responseId", element.getResponseIdElement(), false);
40889      }
40890      if (element.hasSourceIdElement()) {
40891        composeIdCore("sourceId", element.getSourceIdElement(), false);
40892        composeIdExtras("sourceId", element.getSourceIdElement(), false);
40893      }
40894      if (element.hasTargetIdElement()) {
40895        composeIdCore("targetId", element.getTargetIdElement(), false);
40896        composeIdExtras("targetId", element.getTargetIdElement(), false);
40897      }
40898      if (element.hasUrlElement()) {
40899        composeStringCore("url", element.getUrlElement(), false);
40900        composeStringExtras("url", element.getUrlElement(), false);
40901      }
40902  }
40903
40904  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
40905    if (element != null) {
40906      open(name);
40907      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
40908      close();
40909    }
40910  }
40911
40912  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
40913      composeBackbone(element);
40914      if (element.hasFieldElement()) {
40915        composeStringCore("field", element.getFieldElement(), false);
40916        composeStringExtras("field", element.getFieldElement(), false);
40917      }
40918      if (element.hasValueElement()) {
40919        composeStringCore("value", element.getValueElement(), false);
40920        composeStringExtras("value", element.getValueElement(), false);
40921      }
40922  }
40923
40924  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
40925    if (element != null) {
40926      open(name);
40927      composeTestScriptSetupActionAssertComponentInner(element);
40928      close();
40929    }
40930  }
40931
40932  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
40933      composeBackbone(element);
40934      if (element.hasLabelElement()) {
40935        composeStringCore("label", element.getLabelElement(), false);
40936        composeStringExtras("label", element.getLabelElement(), false);
40937      }
40938      if (element.hasDescriptionElement()) {
40939        composeStringCore("description", element.getDescriptionElement(), false);
40940        composeStringExtras("description", element.getDescriptionElement(), false);
40941      }
40942      if (element.hasDirectionElement()) {
40943        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
40944        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
40945      }
40946      if (element.hasCompareToSourceIdElement()) {
40947        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
40948        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
40949      }
40950      if (element.hasCompareToSourceExpressionElement()) {
40951        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
40952        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
40953      }
40954      if (element.hasCompareToSourcePathElement()) {
40955        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
40956        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
40957      }
40958      if (element.hasContentTypeElement()) {
40959        composeEnumerationCore("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40960        composeEnumerationExtras("contentType", element.getContentTypeElement(), new TestScript.ContentTypeEnumFactory(), false);
40961      }
40962      if (element.hasExpressionElement()) {
40963        composeStringCore("expression", element.getExpressionElement(), false);
40964        composeStringExtras("expression", element.getExpressionElement(), false);
40965      }
40966      if (element.hasHeaderFieldElement()) {
40967        composeStringCore("headerField", element.getHeaderFieldElement(), false);
40968        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
40969      }
40970      if (element.hasMinimumIdElement()) {
40971        composeStringCore("minimumId", element.getMinimumIdElement(), false);
40972        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
40973      }
40974      if (element.hasNavigationLinksElement()) {
40975        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
40976        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
40977      }
40978      if (element.hasOperatorElement()) {
40979        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
40980        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
40981      }
40982      if (element.hasPathElement()) {
40983        composeStringCore("path", element.getPathElement(), false);
40984        composeStringExtras("path", element.getPathElement(), false);
40985      }
40986      if (element.hasRequestMethodElement()) {
40987        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
40988        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
40989      }
40990      if (element.hasRequestURLElement()) {
40991        composeStringCore("requestURL", element.getRequestURLElement(), false);
40992        composeStringExtras("requestURL", element.getRequestURLElement(), false);
40993      }
40994      if (element.hasResourceElement()) {
40995        composeCodeCore("resource", element.getResourceElement(), false);
40996        composeCodeExtras("resource", element.getResourceElement(), false);
40997      }
40998      if (element.hasResponseElement()) {
40999        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
41000        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
41001      }
41002      if (element.hasResponseCodeElement()) {
41003        composeStringCore("responseCode", element.getResponseCodeElement(), false);
41004        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
41005      }
41006      if (element.hasRule()) {
41007        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
41008      }
41009      if (element.hasRuleset()) {
41010        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
41011      }
41012      if (element.hasSourceIdElement()) {
41013        composeIdCore("sourceId", element.getSourceIdElement(), false);
41014        composeIdExtras("sourceId", element.getSourceIdElement(), false);
41015      }
41016      if (element.hasValidateProfileIdElement()) {
41017        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
41018        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
41019      }
41020      if (element.hasValueElement()) {
41021        composeStringCore("value", element.getValueElement(), false);
41022        composeStringExtras("value", element.getValueElement(), false);
41023      }
41024      if (element.hasWarningOnlyElement()) {
41025        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
41026        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
41027      }
41028  }
41029
41030  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
41031    if (element != null) {
41032      open(name);
41033      composeTestScriptActionAssertRuleComponentInner(element);
41034      close();
41035    }
41036  }
41037
41038  protected void composeTestScriptActionAssertRuleComponentInner(TestScript.ActionAssertRuleComponent element) throws IOException {
41039      composeBackbone(element);
41040      if (element.hasRuleIdElement()) {
41041        composeIdCore("ruleId", element.getRuleIdElement(), false);
41042        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41043      }
41044      if (element.hasParam()) {
41045        openArray("param");
41046        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
41047          composeTestScriptActionAssertRuleParamComponent(null, e);
41048        closeArray();
41049      };
41050  }
41051
41052  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
41053    if (element != null) {
41054      open(name);
41055      composeTestScriptActionAssertRuleParamComponentInner(element);
41056      close();
41057    }
41058  }
41059
41060  protected void composeTestScriptActionAssertRuleParamComponentInner(TestScript.ActionAssertRuleParamComponent element) throws IOException {
41061      composeBackbone(element);
41062      if (element.hasNameElement()) {
41063        composeStringCore("name", element.getNameElement(), false);
41064        composeStringExtras("name", element.getNameElement(), false);
41065      }
41066      if (element.hasValueElement()) {
41067        composeStringCore("value", element.getValueElement(), false);
41068        composeStringExtras("value", element.getValueElement(), false);
41069      }
41070  }
41071
41072  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
41073    if (element != null) {
41074      open(name);
41075      composeTestScriptActionAssertRulesetComponentInner(element);
41076      close();
41077    }
41078  }
41079
41080  protected void composeTestScriptActionAssertRulesetComponentInner(TestScript.ActionAssertRulesetComponent element) throws IOException {
41081      composeBackbone(element);
41082      if (element.hasRulesetIdElement()) {
41083        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
41084        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
41085      }
41086      if (element.hasRule()) {
41087        openArray("rule");
41088        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
41089          composeTestScriptActionAssertRulesetRuleComponent(null, e);
41090        closeArray();
41091      };
41092  }
41093
41094  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41095    if (element != null) {
41096      open(name);
41097      composeTestScriptActionAssertRulesetRuleComponentInner(element);
41098      close();
41099    }
41100  }
41101
41102  protected void composeTestScriptActionAssertRulesetRuleComponentInner(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
41103      composeBackbone(element);
41104      if (element.hasRuleIdElement()) {
41105        composeIdCore("ruleId", element.getRuleIdElement(), false);
41106        composeIdExtras("ruleId", element.getRuleIdElement(), false);
41107      }
41108      if (element.hasParam()) {
41109        openArray("param");
41110        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
41111          composeTestScriptActionAssertRulesetRuleParamComponent(null, e);
41112        closeArray();
41113      };
41114  }
41115
41116  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41117    if (element != null) {
41118      open(name);
41119      composeTestScriptActionAssertRulesetRuleParamComponentInner(element);
41120      close();
41121    }
41122  }
41123
41124  protected void composeTestScriptActionAssertRulesetRuleParamComponentInner(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
41125      composeBackbone(element);
41126      if (element.hasNameElement()) {
41127        composeStringCore("name", element.getNameElement(), false);
41128        composeStringExtras("name", element.getNameElement(), false);
41129      }
41130      if (element.hasValueElement()) {
41131        composeStringCore("value", element.getValueElement(), false);
41132        composeStringExtras("value", element.getValueElement(), false);
41133      }
41134  }
41135
41136  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
41137    if (element != null) {
41138      open(name);
41139      composeTestScriptTestScriptTestComponentInner(element);
41140      close();
41141    }
41142  }
41143
41144  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
41145      composeBackbone(element);
41146      if (element.hasNameElement()) {
41147        composeStringCore("name", element.getNameElement(), false);
41148        composeStringExtras("name", element.getNameElement(), false);
41149      }
41150      if (element.hasDescriptionElement()) {
41151        composeStringCore("description", element.getDescriptionElement(), false);
41152        composeStringExtras("description", element.getDescriptionElement(), false);
41153      }
41154      if (element.hasAction()) {
41155        openArray("action");
41156        for (TestScript.TestActionComponent e : element.getAction()) 
41157          composeTestScriptTestActionComponent(null, e);
41158        closeArray();
41159      };
41160  }
41161
41162  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
41163    if (element != null) {
41164      open(name);
41165      composeTestScriptTestActionComponentInner(element);
41166      close();
41167    }
41168  }
41169
41170  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
41171      composeBackbone(element);
41172      if (element.hasOperation()) {
41173        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41174      }
41175      if (element.hasAssert()) {
41176        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
41177      }
41178  }
41179
41180  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
41181    if (element != null) {
41182      open(name);
41183      composeTestScriptTestScriptTeardownComponentInner(element);
41184      close();
41185    }
41186  }
41187
41188  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
41189      composeBackbone(element);
41190      if (element.hasAction()) {
41191        openArray("action");
41192        for (TestScript.TeardownActionComponent e : element.getAction()) 
41193          composeTestScriptTeardownActionComponent(null, e);
41194        closeArray();
41195      };
41196  }
41197
41198  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
41199    if (element != null) {
41200      open(name);
41201      composeTestScriptTeardownActionComponentInner(element);
41202      close();
41203    }
41204  }
41205
41206  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
41207      composeBackbone(element);
41208      if (element.hasOperation()) {
41209        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
41210      }
41211  }
41212
41213  protected void composeValueSet(String name, ValueSet element) throws IOException {
41214    if (element != null) {
41215      prop("resourceType", name);
41216      composeValueSetInner(element);
41217    }
41218  }
41219
41220  protected void composeValueSetInner(ValueSet element) throws IOException {
41221      composeDomainResourceElements(element);
41222      if (element.hasUrlElement()) {
41223        composeUriCore("url", element.getUrlElement(), false);
41224        composeUriExtras("url", element.getUrlElement(), false);
41225      }
41226      if (element.hasIdentifier()) {
41227        openArray("identifier");
41228        for (Identifier e : element.getIdentifier()) 
41229          composeIdentifier(null, e);
41230        closeArray();
41231      };
41232      if (element.hasVersionElement()) {
41233        composeStringCore("version", element.getVersionElement(), false);
41234        composeStringExtras("version", element.getVersionElement(), false);
41235      }
41236      if (element.hasNameElement()) {
41237        composeStringCore("name", element.getNameElement(), false);
41238        composeStringExtras("name", element.getNameElement(), false);
41239      }
41240      if (element.hasTitleElement()) {
41241        composeStringCore("title", element.getTitleElement(), false);
41242        composeStringExtras("title", element.getTitleElement(), false);
41243      }
41244      if (element.hasStatusElement()) {
41245        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41246        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41247      }
41248      if (element.hasExperimentalElement()) {
41249        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41250        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41251      }
41252      if (element.hasDateElement()) {
41253        composeDateTimeCore("date", element.getDateElement(), false);
41254        composeDateTimeExtras("date", element.getDateElement(), false);
41255      }
41256      if (element.hasPublisherElement()) {
41257        composeStringCore("publisher", element.getPublisherElement(), false);
41258        composeStringExtras("publisher", element.getPublisherElement(), false);
41259      }
41260      if (element.hasContact()) {
41261        openArray("contact");
41262        for (ContactDetail e : element.getContact()) 
41263          composeContactDetail(null, e);
41264        closeArray();
41265      };
41266      if (element.hasDescriptionElement()) {
41267        composeMarkdownCore("description", element.getDescriptionElement(), false);
41268        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41269      }
41270      if (element.hasUseContext()) {
41271        openArray("useContext");
41272        for (UsageContext e : element.getUseContext()) 
41273          composeUsageContext(null, e);
41274        closeArray();
41275      };
41276      if (element.hasJurisdiction()) {
41277        openArray("jurisdiction");
41278        for (CodeableConcept e : element.getJurisdiction()) 
41279          composeCodeableConcept(null, e);
41280        closeArray();
41281      };
41282      if (element.hasImmutableElement()) {
41283        composeBooleanCore("immutable", element.getImmutableElement(), false);
41284        composeBooleanExtras("immutable", element.getImmutableElement(), false);
41285      }
41286      if (element.hasPurposeElement()) {
41287        composeMarkdownCore("purpose", element.getPurposeElement(), false);
41288        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
41289      }
41290      if (element.hasCopyrightElement()) {
41291        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41292        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41293      }
41294      if (element.hasExtensibleElement()) {
41295        composeBooleanCore("extensible", element.getExtensibleElement(), false);
41296        composeBooleanExtras("extensible", element.getExtensibleElement(), false);
41297      }
41298      if (element.hasCompose()) {
41299        composeValueSetValueSetComposeComponent("compose", element.getCompose());
41300      }
41301      if (element.hasExpansion()) {
41302        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
41303      }
41304  }
41305
41306  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
41307    if (element != null) {
41308      open(name);
41309      composeValueSetValueSetComposeComponentInner(element);
41310      close();
41311    }
41312  }
41313
41314  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
41315      composeBackbone(element);
41316      if (element.hasLockedDateElement()) {
41317        composeDateCore("lockedDate", element.getLockedDateElement(), false);
41318        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
41319      }
41320      if (element.hasInactiveElement()) {
41321        composeBooleanCore("inactive", element.getInactiveElement(), false);
41322        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41323      }
41324      if (element.hasInclude()) {
41325        openArray("include");
41326        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
41327          composeValueSetConceptSetComponent(null, e);
41328        closeArray();
41329      };
41330      if (element.hasExclude()) {
41331        openArray("exclude");
41332        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
41333          composeValueSetConceptSetComponent(null, e);
41334        closeArray();
41335      };
41336  }
41337
41338  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
41339    if (element != null) {
41340      open(name);
41341      composeValueSetConceptSetComponentInner(element);
41342      close();
41343    }
41344  }
41345
41346  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
41347      composeBackbone(element);
41348      if (element.hasSystemElement()) {
41349        composeUriCore("system", element.getSystemElement(), false);
41350        composeUriExtras("system", element.getSystemElement(), false);
41351      }
41352      if (element.hasVersionElement()) {
41353        composeStringCore("version", element.getVersionElement(), false);
41354        composeStringExtras("version", element.getVersionElement(), false);
41355      }
41356      if (element.hasConcept()) {
41357        openArray("concept");
41358        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
41359          composeValueSetConceptReferenceComponent(null, e);
41360        closeArray();
41361      };
41362      if (element.hasFilter()) {
41363        openArray("filter");
41364        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
41365          composeValueSetConceptSetFilterComponent(null, e);
41366        closeArray();
41367      };
41368      if (element.hasValueSet()) {
41369        openArray("valueSet");
41370        for (UriType e : element.getValueSet()) 
41371          composeUriCore(null, e, true);
41372        closeArray();
41373        if (anyHasExtras(element.getValueSet())) {
41374          openArray("_valueSet");
41375          for (UriType e : element.getValueSet()) 
41376            composeUriExtras(null, e, true);
41377          closeArray();
41378        }
41379      };
41380  }
41381
41382  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
41383    if (element != null) {
41384      open(name);
41385      composeValueSetConceptReferenceComponentInner(element);
41386      close();
41387    }
41388  }
41389
41390  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
41391      composeBackbone(element);
41392      if (element.hasCodeElement()) {
41393        composeCodeCore("code", element.getCodeElement(), false);
41394        composeCodeExtras("code", element.getCodeElement(), false);
41395      }
41396      if (element.hasDisplayElement()) {
41397        composeStringCore("display", element.getDisplayElement(), false);
41398        composeStringExtras("display", element.getDisplayElement(), false);
41399      }
41400      if (element.hasDesignation()) {
41401        openArray("designation");
41402        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41403          composeValueSetConceptReferenceDesignationComponent(null, e);
41404        closeArray();
41405      };
41406  }
41407
41408  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41409    if (element != null) {
41410      open(name);
41411      composeValueSetConceptReferenceDesignationComponentInner(element);
41412      close();
41413    }
41414  }
41415
41416  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
41417      composeBackbone(element);
41418      if (element.hasLanguageElement()) {
41419        composeCodeCore("language", element.getLanguageElement(), false);
41420        composeCodeExtras("language", element.getLanguageElement(), false);
41421      }
41422      if (element.hasUse()) {
41423        composeCoding("use", element.getUse());
41424      }
41425      if (element.hasValueElement()) {
41426        composeStringCore("value", element.getValueElement(), false);
41427        composeStringExtras("value", element.getValueElement(), false);
41428      }
41429  }
41430
41431  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
41432    if (element != null) {
41433      open(name);
41434      composeValueSetConceptSetFilterComponentInner(element);
41435      close();
41436    }
41437  }
41438
41439  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
41440      composeBackbone(element);
41441      if (element.hasPropertyElement()) {
41442        composeCodeCore("property", element.getPropertyElement(), false);
41443        composeCodeExtras("property", element.getPropertyElement(), false);
41444      }
41445      if (element.hasOpElement()) {
41446        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41447        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
41448      }
41449      if (element.hasValueElement()) {
41450        composeCodeCore("value", element.getValueElement(), false);
41451        composeCodeExtras("value", element.getValueElement(), false);
41452      }
41453  }
41454
41455  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
41456    if (element != null) {
41457      open(name);
41458      composeValueSetValueSetExpansionComponentInner(element);
41459      close();
41460    }
41461  }
41462
41463  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
41464      composeBackbone(element);
41465      if (element.hasIdentifierElement()) {
41466        composeUriCore("identifier", element.getIdentifierElement(), false);
41467        composeUriExtras("identifier", element.getIdentifierElement(), false);
41468      }
41469      if (element.hasTimestampElement()) {
41470        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
41471        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
41472      }
41473      if (element.hasTotalElement()) {
41474        composeIntegerCore("total", element.getTotalElement(), false);
41475        composeIntegerExtras("total", element.getTotalElement(), false);
41476      }
41477      if (element.hasOffsetElement()) {
41478        composeIntegerCore("offset", element.getOffsetElement(), false);
41479        composeIntegerExtras("offset", element.getOffsetElement(), false);
41480      }
41481      if (element.hasParameter()) {
41482        openArray("parameter");
41483        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
41484          composeValueSetValueSetExpansionParameterComponent(null, e);
41485        closeArray();
41486      };
41487      if (element.hasContains()) {
41488        openArray("contains");
41489        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41490          composeValueSetValueSetExpansionContainsComponent(null, e);
41491        closeArray();
41492      };
41493  }
41494
41495  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41496    if (element != null) {
41497      open(name);
41498      composeValueSetValueSetExpansionParameterComponentInner(element);
41499      close();
41500    }
41501  }
41502
41503  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
41504      composeBackbone(element);
41505      if (element.hasNameElement()) {
41506        composeStringCore("name", element.getNameElement(), false);
41507        composeStringExtras("name", element.getNameElement(), false);
41508      }
41509      if (element.hasValue()) {
41510        composeType("value", element.getValue());
41511      }
41512  }
41513
41514  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41515    if (element != null) {
41516      open(name);
41517      composeValueSetValueSetExpansionContainsComponentInner(element);
41518      close();
41519    }
41520  }
41521
41522  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
41523      composeBackbone(element);
41524      if (element.hasSystemElement()) {
41525        composeUriCore("system", element.getSystemElement(), false);
41526        composeUriExtras("system", element.getSystemElement(), false);
41527      }
41528      if (element.hasAbstractElement()) {
41529        composeBooleanCore("abstract", element.getAbstractElement(), false);
41530        composeBooleanExtras("abstract", element.getAbstractElement(), false);
41531      }
41532      if (element.hasInactiveElement()) {
41533        composeBooleanCore("inactive", element.getInactiveElement(), false);
41534        composeBooleanExtras("inactive", element.getInactiveElement(), false);
41535      }
41536      if (element.hasVersionElement()) {
41537        composeStringCore("version", element.getVersionElement(), false);
41538        composeStringExtras("version", element.getVersionElement(), false);
41539      }
41540      if (element.hasCodeElement()) {
41541        composeCodeCore("code", element.getCodeElement(), false);
41542        composeCodeExtras("code", element.getCodeElement(), false);
41543      }
41544      if (element.hasDisplayElement()) {
41545        composeStringCore("display", element.getDisplayElement(), false);
41546        composeStringExtras("display", element.getDisplayElement(), false);
41547      }
41548      if (element.hasDesignation()) {
41549        openArray("designation");
41550        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
41551          composeValueSetConceptReferenceDesignationComponent(null, e);
41552        closeArray();
41553      };
41554      if (element.hasContains()) {
41555        openArray("contains");
41556        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
41557          composeValueSetValueSetExpansionContainsComponent(null, e);
41558        closeArray();
41559      };
41560  }
41561
41562  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
41563    if (element != null) {
41564      prop("resourceType", name);
41565      composeVisionPrescriptionInner(element);
41566    }
41567  }
41568
41569  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
41570      composeDomainResourceElements(element);
41571      if (element.hasIdentifier()) {
41572        openArray("identifier");
41573        for (Identifier e : element.getIdentifier()) 
41574          composeIdentifier(null, e);
41575        closeArray();
41576      };
41577      if (element.hasStatusElement()) {
41578        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41579        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
41580      }
41581      if (element.hasPatient()) {
41582        composeReference("patient", element.getPatient());
41583      }
41584      if (element.hasEncounter()) {
41585        composeReference("encounter", element.getEncounter());
41586      }
41587      if (element.hasDateWrittenElement()) {
41588        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
41589        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
41590      }
41591      if (element.hasPrescriber()) {
41592        composeReference("prescriber", element.getPrescriber());
41593      }
41594      if (element.hasReason()) {
41595        composeType("reason", element.getReason());
41596      }
41597      if (element.hasDispense()) {
41598        openArray("dispense");
41599        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
41600          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
41601        closeArray();
41602      };
41603  }
41604
41605  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41606    if (element != null) {
41607      open(name);
41608      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
41609      close();
41610    }
41611  }
41612
41613  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
41614      composeBackbone(element);
41615      if (element.hasProduct()) {
41616        composeCodeableConcept("product", element.getProduct());
41617      }
41618      if (element.hasEyeElement()) {
41619        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41620        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
41621      }
41622      if (element.hasSphereElement()) {
41623        composeDecimalCore("sphere", element.getSphereElement(), false);
41624        composeDecimalExtras("sphere", element.getSphereElement(), false);
41625      }
41626      if (element.hasCylinderElement()) {
41627        composeDecimalCore("cylinder", element.getCylinderElement(), false);
41628        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
41629      }
41630      if (element.hasAxisElement()) {
41631        composeIntegerCore("axis", element.getAxisElement(), false);
41632        composeIntegerExtras("axis", element.getAxisElement(), false);
41633      }
41634      if (element.hasPrismElement()) {
41635        composeDecimalCore("prism", element.getPrismElement(), false);
41636        composeDecimalExtras("prism", element.getPrismElement(), false);
41637      }
41638      if (element.hasBaseElement()) {
41639        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41640        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
41641      }
41642      if (element.hasAddElement()) {
41643        composeDecimalCore("add", element.getAddElement(), false);
41644        composeDecimalExtras("add", element.getAddElement(), false);
41645      }
41646      if (element.hasPowerElement()) {
41647        composeDecimalCore("power", element.getPowerElement(), false);
41648        composeDecimalExtras("power", element.getPowerElement(), false);
41649      }
41650      if (element.hasBackCurveElement()) {
41651        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
41652        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
41653      }
41654      if (element.hasDiameterElement()) {
41655        composeDecimalCore("diameter", element.getDiameterElement(), false);
41656        composeDecimalExtras("diameter", element.getDiameterElement(), false);
41657      }
41658      if (element.hasDuration()) {
41659        composeSimpleQuantity("duration", element.getDuration());
41660      }
41661      if (element.hasColorElement()) {
41662        composeStringCore("color", element.getColorElement(), false);
41663        composeStringExtras("color", element.getColorElement(), false);
41664      }
41665      if (element.hasBrandElement()) {
41666        composeStringCore("brand", element.getBrandElement(), false);
41667        composeStringExtras("brand", element.getBrandElement(), false);
41668      }
41669      if (element.hasNote()) {
41670        openArray("note");
41671        for (Annotation e : element.getNote()) 
41672          composeAnnotation(null, e);
41673        closeArray();
41674      };
41675  }
41676
41677  @Override
41678  protected void composeResource(Resource resource) throws IOException {
41679    if (resource instanceof Parameters)
41680      composeParameters("Parameters", (Parameters)resource);
41681    else if (resource instanceof Account)
41682      composeAccount("Account", (Account)resource);
41683    else if (resource instanceof ActivityDefinition)
41684      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
41685    else if (resource instanceof AdverseEvent)
41686      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
41687    else if (resource instanceof AllergyIntolerance)
41688      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
41689    else if (resource instanceof Appointment)
41690      composeAppointment("Appointment", (Appointment)resource);
41691    else if (resource instanceof AppointmentResponse)
41692      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
41693    else if (resource instanceof AuditEvent)
41694      composeAuditEvent("AuditEvent", (AuditEvent)resource);
41695    else if (resource instanceof Basic)
41696      composeBasic("Basic", (Basic)resource);
41697    else if (resource instanceof Binary)
41698      composeBinary("Binary", (Binary)resource);
41699    else if (resource instanceof BodySite)
41700      composeBodySite("BodySite", (BodySite)resource);
41701    else if (resource instanceof Bundle)
41702      composeBundle("Bundle", (Bundle)resource);
41703    else if (resource instanceof CapabilityStatement)
41704      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
41705    else if (resource instanceof CarePlan)
41706      composeCarePlan("CarePlan", (CarePlan)resource);
41707    else if (resource instanceof CareTeam)
41708      composeCareTeam("CareTeam", (CareTeam)resource);
41709    else if (resource instanceof ChargeItem)
41710      composeChargeItem("ChargeItem", (ChargeItem)resource);
41711    else if (resource instanceof Claim)
41712      composeClaim("Claim", (Claim)resource);
41713    else if (resource instanceof ClaimResponse)
41714      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
41715    else if (resource instanceof ClinicalImpression)
41716      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
41717    else if (resource instanceof CodeSystem)
41718      composeCodeSystem("CodeSystem", (CodeSystem)resource);
41719    else if (resource instanceof Communication)
41720      composeCommunication("Communication", (Communication)resource);
41721    else if (resource instanceof CommunicationRequest)
41722      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
41723    else if (resource instanceof CompartmentDefinition)
41724      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
41725    else if (resource instanceof Composition)
41726      composeComposition("Composition", (Composition)resource);
41727    else if (resource instanceof ConceptMap)
41728      composeConceptMap("ConceptMap", (ConceptMap)resource);
41729    else if (resource instanceof Condition)
41730      composeCondition("Condition", (Condition)resource);
41731    else if (resource instanceof Consent)
41732      composeConsent("Consent", (Consent)resource);
41733    else if (resource instanceof Contract)
41734      composeContract("Contract", (Contract)resource);
41735    else if (resource instanceof Coverage)
41736      composeCoverage("Coverage", (Coverage)resource);
41737    else if (resource instanceof DataElement)
41738      composeDataElement("DataElement", (DataElement)resource);
41739    else if (resource instanceof DetectedIssue)
41740      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
41741    else if (resource instanceof Device)
41742      composeDevice("Device", (Device)resource);
41743    else if (resource instanceof DeviceComponent)
41744      composeDeviceComponent("DeviceComponent", (DeviceComponent)resource);
41745    else if (resource instanceof DeviceMetric)
41746      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
41747    else if (resource instanceof DeviceRequest)
41748      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
41749    else if (resource instanceof DeviceUseStatement)
41750      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
41751    else if (resource instanceof DiagnosticReport)
41752      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
41753    else if (resource instanceof DocumentManifest)
41754      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
41755    else if (resource instanceof DocumentReference)
41756      composeDocumentReference("DocumentReference", (DocumentReference)resource);
41757    else if (resource instanceof EligibilityRequest)
41758      composeEligibilityRequest("EligibilityRequest", (EligibilityRequest)resource);
41759    else if (resource instanceof EligibilityResponse)
41760      composeEligibilityResponse("EligibilityResponse", (EligibilityResponse)resource);
41761    else if (resource instanceof Encounter)
41762      composeEncounter("Encounter", (Encounter)resource);
41763    else if (resource instanceof Endpoint)
41764      composeEndpoint("Endpoint", (Endpoint)resource);
41765    else if (resource instanceof EnrollmentRequest)
41766      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
41767    else if (resource instanceof EnrollmentResponse)
41768      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
41769    else if (resource instanceof EpisodeOfCare)
41770      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
41771    else if (resource instanceof ExpansionProfile)
41772      composeExpansionProfile("ExpansionProfile", (ExpansionProfile)resource);
41773    else if (resource instanceof ExplanationOfBenefit)
41774      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
41775    else if (resource instanceof FamilyMemberHistory)
41776      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
41777    else if (resource instanceof Flag)
41778      composeFlag("Flag", (Flag)resource);
41779    else if (resource instanceof Goal)
41780      composeGoal("Goal", (Goal)resource);
41781    else if (resource instanceof GraphDefinition)
41782      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
41783    else if (resource instanceof Group)
41784      composeGroup("Group", (Group)resource);
41785    else if (resource instanceof GuidanceResponse)
41786      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
41787    else if (resource instanceof HealthcareService)
41788      composeHealthcareService("HealthcareService", (HealthcareService)resource);
41789    else if (resource instanceof ImagingManifest)
41790      composeImagingManifest("ImagingManifest", (ImagingManifest)resource);
41791    else if (resource instanceof ImagingStudy)
41792      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
41793    else if (resource instanceof Immunization)
41794      composeImmunization("Immunization", (Immunization)resource);
41795    else if (resource instanceof ImmunizationRecommendation)
41796      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
41797    else if (resource instanceof ImplementationGuide)
41798      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
41799    else if (resource instanceof Library)
41800      composeLibrary("Library", (Library)resource);
41801    else if (resource instanceof Linkage)
41802      composeLinkage("Linkage", (Linkage)resource);
41803    else if (resource instanceof ListResource)
41804      composeListResource("List", (ListResource)resource);
41805    else if (resource instanceof Location)
41806      composeLocation("Location", (Location)resource);
41807    else if (resource instanceof Measure)
41808      composeMeasure("Measure", (Measure)resource);
41809    else if (resource instanceof MeasureReport)
41810      composeMeasureReport("MeasureReport", (MeasureReport)resource);
41811    else if (resource instanceof Media)
41812      composeMedia("Media", (Media)resource);
41813    else if (resource instanceof Medication)
41814      composeMedication("Medication", (Medication)resource);
41815    else if (resource instanceof MedicationAdministration)
41816      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
41817    else if (resource instanceof MedicationDispense)
41818      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
41819    else if (resource instanceof MedicationRequest)
41820      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
41821    else if (resource instanceof MedicationStatement)
41822      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
41823    else if (resource instanceof MessageDefinition)
41824      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
41825    else if (resource instanceof MessageHeader)
41826      composeMessageHeader("MessageHeader", (MessageHeader)resource);
41827    else if (resource instanceof NamingSystem)
41828      composeNamingSystem("NamingSystem", (NamingSystem)resource);
41829    else if (resource instanceof NutritionOrder)
41830      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
41831    else if (resource instanceof Observation)
41832      composeObservation("Observation", (Observation)resource);
41833    else if (resource instanceof OperationDefinition)
41834      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
41835    else if (resource instanceof OperationOutcome)
41836      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
41837    else if (resource instanceof Organization)
41838      composeOrganization("Organization", (Organization)resource);
41839    else if (resource instanceof Patient)
41840      composePatient("Patient", (Patient)resource);
41841    else if (resource instanceof PaymentNotice)
41842      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
41843    else if (resource instanceof PaymentReconciliation)
41844      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
41845    else if (resource instanceof Person)
41846      composePerson("Person", (Person)resource);
41847    else if (resource instanceof PlanDefinition)
41848      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
41849    else if (resource instanceof Practitioner)
41850      composePractitioner("Practitioner", (Practitioner)resource);
41851    else if (resource instanceof PractitionerRole)
41852      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
41853    else if (resource instanceof Procedure)
41854      composeProcedure("Procedure", (Procedure)resource);
41855    else if (resource instanceof ProcedureRequest)
41856      composeProcedureRequest("ProcedureRequest", (ProcedureRequest)resource);
41857    else if (resource instanceof ProcessRequest)
41858      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
41859    else if (resource instanceof ProcessResponse)
41860      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
41861    else if (resource instanceof Provenance)
41862      composeProvenance("Provenance", (Provenance)resource);
41863    else if (resource instanceof Questionnaire)
41864      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
41865    else if (resource instanceof QuestionnaireResponse)
41866      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
41867    else if (resource instanceof ReferralRequest)
41868      composeReferralRequest("ReferralRequest", (ReferralRequest)resource);
41869    else if (resource instanceof RelatedPerson)
41870      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
41871    else if (resource instanceof RequestGroup)
41872      composeRequestGroup("RequestGroup", (RequestGroup)resource);
41873    else if (resource instanceof ResearchStudy)
41874      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
41875    else if (resource instanceof ResearchSubject)
41876      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
41877    else if (resource instanceof RiskAssessment)
41878      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
41879    else if (resource instanceof Schedule)
41880      composeSchedule("Schedule", (Schedule)resource);
41881    else if (resource instanceof SearchParameter)
41882      composeSearchParameter("SearchParameter", (SearchParameter)resource);
41883    else if (resource instanceof Sequence)
41884      composeSequence("Sequence", (Sequence)resource);
41885    else if (resource instanceof ServiceDefinition)
41886      composeServiceDefinition("ServiceDefinition", (ServiceDefinition)resource);
41887    else if (resource instanceof Slot)
41888      composeSlot("Slot", (Slot)resource);
41889    else if (resource instanceof Specimen)
41890      composeSpecimen("Specimen", (Specimen)resource);
41891    else if (resource instanceof StructureDefinition)
41892      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
41893    else if (resource instanceof StructureMap)
41894      composeStructureMap("StructureMap", (StructureMap)resource);
41895    else if (resource instanceof Subscription)
41896      composeSubscription("Subscription", (Subscription)resource);
41897    else if (resource instanceof Substance)
41898      composeSubstance("Substance", (Substance)resource);
41899    else if (resource instanceof SupplyDelivery)
41900      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
41901    else if (resource instanceof SupplyRequest)
41902      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
41903    else if (resource instanceof Task)
41904      composeTask("Task", (Task)resource);
41905    else if (resource instanceof TestReport)
41906      composeTestReport("TestReport", (TestReport)resource);
41907    else if (resource instanceof TestScript)
41908      composeTestScript("TestScript", (TestScript)resource);
41909    else if (resource instanceof ValueSet)
41910      composeValueSet("ValueSet", (ValueSet)resource);
41911    else if (resource instanceof VisionPrescription)
41912      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
41913    else if (resource instanceof Binary)
41914      composeBinary("Binary", (Binary)resource);
41915    else
41916      throw new Error("Unhandled resource type "+resource.getClass().getName());
41917  }
41918
41919  protected void composeNamedReference(String name, Resource resource) throws IOException {
41920    if (resource instanceof Parameters)
41921      composeParameters(name, (Parameters)resource);
41922    else if (resource instanceof Account)
41923      composeAccount(name, (Account)resource);
41924    else if (resource instanceof ActivityDefinition)
41925      composeActivityDefinition(name, (ActivityDefinition)resource);
41926    else if (resource instanceof AdverseEvent)
41927      composeAdverseEvent(name, (AdverseEvent)resource);
41928    else if (resource instanceof AllergyIntolerance)
41929      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
41930    else if (resource instanceof Appointment)
41931      composeAppointment(name, (Appointment)resource);
41932    else if (resource instanceof AppointmentResponse)
41933      composeAppointmentResponse(name, (AppointmentResponse)resource);
41934    else if (resource instanceof AuditEvent)
41935      composeAuditEvent(name, (AuditEvent)resource);
41936    else if (resource instanceof Basic)
41937      composeBasic(name, (Basic)resource);
41938    else if (resource instanceof Binary)
41939      composeBinary(name, (Binary)resource);
41940    else if (resource instanceof BodySite)
41941      composeBodySite(name, (BodySite)resource);
41942    else if (resource instanceof Bundle)
41943      composeBundle(name, (Bundle)resource);
41944    else if (resource instanceof CapabilityStatement)
41945      composeCapabilityStatement(name, (CapabilityStatement)resource);
41946    else if (resource instanceof CarePlan)
41947      composeCarePlan(name, (CarePlan)resource);
41948    else if (resource instanceof CareTeam)
41949      composeCareTeam(name, (CareTeam)resource);
41950    else if (resource instanceof ChargeItem)
41951      composeChargeItem(name, (ChargeItem)resource);
41952    else if (resource instanceof Claim)
41953      composeClaim(name, (Claim)resource);
41954    else if (resource instanceof ClaimResponse)
41955      composeClaimResponse(name, (ClaimResponse)resource);
41956    else if (resource instanceof ClinicalImpression)
41957      composeClinicalImpression(name, (ClinicalImpression)resource);
41958    else if (resource instanceof CodeSystem)
41959      composeCodeSystem(name, (CodeSystem)resource);
41960    else if (resource instanceof Communication)
41961      composeCommunication(name, (Communication)resource);
41962    else if (resource instanceof CommunicationRequest)
41963      composeCommunicationRequest(name, (CommunicationRequest)resource);
41964    else if (resource instanceof CompartmentDefinition)
41965      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
41966    else if (resource instanceof Composition)
41967      composeComposition(name, (Composition)resource);
41968    else if (resource instanceof ConceptMap)
41969      composeConceptMap(name, (ConceptMap)resource);
41970    else if (resource instanceof Condition)
41971      composeCondition(name, (Condition)resource);
41972    else if (resource instanceof Consent)
41973      composeConsent(name, (Consent)resource);
41974    else if (resource instanceof Contract)
41975      composeContract(name, (Contract)resource);
41976    else if (resource instanceof Coverage)
41977      composeCoverage(name, (Coverage)resource);
41978    else if (resource instanceof DataElement)
41979      composeDataElement(name, (DataElement)resource);
41980    else if (resource instanceof DetectedIssue)
41981      composeDetectedIssue(name, (DetectedIssue)resource);
41982    else if (resource instanceof Device)
41983      composeDevice(name, (Device)resource);
41984    else if (resource instanceof DeviceComponent)
41985      composeDeviceComponent(name, (DeviceComponent)resource);
41986    else if (resource instanceof DeviceMetric)
41987      composeDeviceMetric(name, (DeviceMetric)resource);
41988    else if (resource instanceof DeviceRequest)
41989      composeDeviceRequest(name, (DeviceRequest)resource);
41990    else if (resource instanceof DeviceUseStatement)
41991      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
41992    else if (resource instanceof DiagnosticReport)
41993      composeDiagnosticReport(name, (DiagnosticReport)resource);
41994    else if (resource instanceof DocumentManifest)
41995      composeDocumentManifest(name, (DocumentManifest)resource);
41996    else if (resource instanceof DocumentReference)
41997      composeDocumentReference(name, (DocumentReference)resource);
41998    else if (resource instanceof EligibilityRequest)
41999      composeEligibilityRequest(name, (EligibilityRequest)resource);
42000    else if (resource instanceof EligibilityResponse)
42001      composeEligibilityResponse(name, (EligibilityResponse)resource);
42002    else if (resource instanceof Encounter)
42003      composeEncounter(name, (Encounter)resource);
42004    else if (resource instanceof Endpoint)
42005      composeEndpoint(name, (Endpoint)resource);
42006    else if (resource instanceof EnrollmentRequest)
42007      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
42008    else if (resource instanceof EnrollmentResponse)
42009      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
42010    else if (resource instanceof EpisodeOfCare)
42011      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
42012    else if (resource instanceof ExpansionProfile)
42013      composeExpansionProfile(name, (ExpansionProfile)resource);
42014    else if (resource instanceof ExplanationOfBenefit)
42015      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
42016    else if (resource instanceof FamilyMemberHistory)
42017      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
42018    else if (resource instanceof Flag)
42019      composeFlag(name, (Flag)resource);
42020    else if (resource instanceof Goal)
42021      composeGoal(name, (Goal)resource);
42022    else if (resource instanceof GraphDefinition)
42023      composeGraphDefinition(name, (GraphDefinition)resource);
42024    else if (resource instanceof Group)
42025      composeGroup(name, (Group)resource);
42026    else if (resource instanceof GuidanceResponse)
42027      composeGuidanceResponse(name, (GuidanceResponse)resource);
42028    else if (resource instanceof HealthcareService)
42029      composeHealthcareService(name, (HealthcareService)resource);
42030    else if (resource instanceof ImagingManifest)
42031      composeImagingManifest(name, (ImagingManifest)resource);
42032    else if (resource instanceof ImagingStudy)
42033      composeImagingStudy(name, (ImagingStudy)resource);
42034    else if (resource instanceof Immunization)
42035      composeImmunization(name, (Immunization)resource);
42036    else if (resource instanceof ImmunizationRecommendation)
42037      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
42038    else if (resource instanceof ImplementationGuide)
42039      composeImplementationGuide(name, (ImplementationGuide)resource);
42040    else if (resource instanceof Library)
42041      composeLibrary(name, (Library)resource);
42042    else if (resource instanceof Linkage)
42043      composeLinkage(name, (Linkage)resource);
42044    else if (resource instanceof ListResource)
42045      composeListResource(name, (ListResource)resource);
42046    else if (resource instanceof Location)
42047      composeLocation(name, (Location)resource);
42048    else if (resource instanceof Measure)
42049      composeMeasure(name, (Measure)resource);
42050    else if (resource instanceof MeasureReport)
42051      composeMeasureReport(name, (MeasureReport)resource);
42052    else if (resource instanceof Media)
42053      composeMedia(name, (Media)resource);
42054    else if (resource instanceof Medication)
42055      composeMedication(name, (Medication)resource);
42056    else if (resource instanceof MedicationAdministration)
42057      composeMedicationAdministration(name, (MedicationAdministration)resource);
42058    else if (resource instanceof MedicationDispense)
42059      composeMedicationDispense(name, (MedicationDispense)resource);
42060    else if (resource instanceof MedicationRequest)
42061      composeMedicationRequest(name, (MedicationRequest)resource);
42062    else if (resource instanceof MedicationStatement)
42063      composeMedicationStatement(name, (MedicationStatement)resource);
42064    else if (resource instanceof MessageDefinition)
42065      composeMessageDefinition(name, (MessageDefinition)resource);
42066    else if (resource instanceof MessageHeader)
42067      composeMessageHeader(name, (MessageHeader)resource);
42068    else if (resource instanceof NamingSystem)
42069      composeNamingSystem(name, (NamingSystem)resource);
42070    else if (resource instanceof NutritionOrder)
42071      composeNutritionOrder(name, (NutritionOrder)resource);
42072    else if (resource instanceof Observation)
42073      composeObservation(name, (Observation)resource);
42074    else if (resource instanceof OperationDefinition)
42075      composeOperationDefinition(name, (OperationDefinition)resource);
42076    else if (resource instanceof OperationOutcome)
42077      composeOperationOutcome(name, (OperationOutcome)resource);
42078    else if (resource instanceof Organization)
42079      composeOrganization(name, (Organization)resource);
42080    else if (resource instanceof Patient)
42081      composePatient(name, (Patient)resource);
42082    else if (resource instanceof PaymentNotice)
42083      composePaymentNotice(name, (PaymentNotice)resource);
42084    else if (resource instanceof PaymentReconciliation)
42085      composePaymentReconciliation(name, (PaymentReconciliation)resource);
42086    else if (resource instanceof Person)
42087      composePerson(name, (Person)resource);
42088    else if (resource instanceof PlanDefinition)
42089      composePlanDefinition(name, (PlanDefinition)resource);
42090    else if (resource instanceof Practitioner)
42091      composePractitioner(name, (Practitioner)resource);
42092    else if (resource instanceof PractitionerRole)
42093      composePractitionerRole(name, (PractitionerRole)resource);
42094    else if (resource instanceof Procedure)
42095      composeProcedure(name, (Procedure)resource);
42096    else if (resource instanceof ProcedureRequest)
42097      composeProcedureRequest(name, (ProcedureRequest)resource);
42098    else if (resource instanceof ProcessRequest)
42099      composeProcessRequest(name, (ProcessRequest)resource);
42100    else if (resource instanceof ProcessResponse)
42101      composeProcessResponse(name, (ProcessResponse)resource);
42102    else if (resource instanceof Provenance)
42103      composeProvenance(name, (Provenance)resource);
42104    else if (resource instanceof Questionnaire)
42105      composeQuestionnaire(name, (Questionnaire)resource);
42106    else if (resource instanceof QuestionnaireResponse)
42107      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
42108    else if (resource instanceof ReferralRequest)
42109      composeReferralRequest(name, (ReferralRequest)resource);
42110    else if (resource instanceof RelatedPerson)
42111      composeRelatedPerson(name, (RelatedPerson)resource);
42112    else if (resource instanceof RequestGroup)
42113      composeRequestGroup(name, (RequestGroup)resource);
42114    else if (resource instanceof ResearchStudy)
42115      composeResearchStudy(name, (ResearchStudy)resource);
42116    else if (resource instanceof ResearchSubject)
42117      composeResearchSubject(name, (ResearchSubject)resource);
42118    else if (resource instanceof RiskAssessment)
42119      composeRiskAssessment(name, (RiskAssessment)resource);
42120    else if (resource instanceof Schedule)
42121      composeSchedule(name, (Schedule)resource);
42122    else if (resource instanceof SearchParameter)
42123      composeSearchParameter(name, (SearchParameter)resource);
42124    else if (resource instanceof Sequence)
42125      composeSequence(name, (Sequence)resource);
42126    else if (resource instanceof ServiceDefinition)
42127      composeServiceDefinition(name, (ServiceDefinition)resource);
42128    else if (resource instanceof Slot)
42129      composeSlot(name, (Slot)resource);
42130    else if (resource instanceof Specimen)
42131      composeSpecimen(name, (Specimen)resource);
42132    else if (resource instanceof StructureDefinition)
42133      composeStructureDefinition(name, (StructureDefinition)resource);
42134    else if (resource instanceof StructureMap)
42135      composeStructureMap(name, (StructureMap)resource);
42136    else if (resource instanceof Subscription)
42137      composeSubscription(name, (Subscription)resource);
42138    else if (resource instanceof Substance)
42139      composeSubstance(name, (Substance)resource);
42140    else if (resource instanceof SupplyDelivery)
42141      composeSupplyDelivery(name, (SupplyDelivery)resource);
42142    else if (resource instanceof SupplyRequest)
42143      composeSupplyRequest(name, (SupplyRequest)resource);
42144    else if (resource instanceof Task)
42145      composeTask(name, (Task)resource);
42146    else if (resource instanceof TestReport)
42147      composeTestReport(name, (TestReport)resource);
42148    else if (resource instanceof TestScript)
42149      composeTestScript(name, (TestScript)resource);
42150    else if (resource instanceof ValueSet)
42151      composeValueSet(name, (ValueSet)resource);
42152    else if (resource instanceof VisionPrescription)
42153      composeVisionPrescription(name, (VisionPrescription)resource);
42154    else if (resource instanceof Binary)
42155      composeBinary(name, (Binary)resource);
42156    else
42157      throw new Error("Unhandled resource type "+resource.getClass().getName());
42158  }
42159
42160  protected void composeType(String prefix, Type type) throws IOException {
42161    if (type == null)
42162      ;
42163    else if (type instanceof SimpleQuantity)
42164       composeSimpleQuantity(prefix+"SimpleQuantity", (SimpleQuantity) type);
42165    else if (type instanceof Duration)
42166       composeDuration(prefix+"Duration", (Duration) type);
42167    else if (type instanceof Count)
42168       composeCount(prefix+"Count", (Count) type);
42169    else if (type instanceof Money)
42170       composeMoney(prefix+"Money", (Money) type);
42171    else if (type instanceof Distance)
42172       composeDistance(prefix+"Distance", (Distance) type);
42173    else if (type instanceof Age)
42174       composeAge(prefix+"Age", (Age) type);
42175    else if (type instanceof Reference)
42176       composeReference(prefix+"Reference", (Reference) type);
42177    else if (type instanceof Quantity)
42178       composeQuantity(prefix+"Quantity", (Quantity) type);
42179    else if (type instanceof Period)
42180       composePeriod(prefix+"Period", (Period) type);
42181    else if (type instanceof Attachment)
42182       composeAttachment(prefix+"Attachment", (Attachment) type);
42183    else if (type instanceof Range)
42184       composeRange(prefix+"Range", (Range) type);
42185    else if (type instanceof Annotation)
42186       composeAnnotation(prefix+"Annotation", (Annotation) type);
42187    else if (type instanceof Identifier)
42188       composeIdentifier(prefix+"Identifier", (Identifier) type);
42189    else if (type instanceof Coding)
42190       composeCoding(prefix+"Coding", (Coding) type);
42191    else if (type instanceof Signature)
42192       composeSignature(prefix+"Signature", (Signature) type);
42193    else if (type instanceof SampledData)
42194       composeSampledData(prefix+"SampledData", (SampledData) type);
42195    else if (type instanceof Ratio)
42196       composeRatio(prefix+"Ratio", (Ratio) type);
42197    else if (type instanceof CodeableConcept)
42198       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
42199    else if (type instanceof Meta)
42200       composeMeta(prefix+"Meta", (Meta) type);
42201    else if (type instanceof Address)
42202       composeAddress(prefix+"Address", (Address) type);
42203    else if (type instanceof TriggerDefinition)
42204       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
42205    else if (type instanceof Contributor)
42206       composeContributor(prefix+"Contributor", (Contributor) type);
42207    else if (type instanceof DataRequirement)
42208       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
42209    else if (type instanceof Dosage)
42210       composeDosage(prefix+"Dosage", (Dosage) type);
42211    else if (type instanceof RelatedArtifact)
42212       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
42213    else if (type instanceof ContactDetail)
42214       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
42215    else if (type instanceof HumanName)
42216       composeHumanName(prefix+"HumanName", (HumanName) type);
42217    else if (type instanceof ContactPoint)
42218       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
42219    else if (type instanceof UsageContext)
42220       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
42221    else if (type instanceof Timing)
42222       composeTiming(prefix+"Timing", (Timing) type);
42223    else if (type instanceof ElementDefinition)
42224       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
42225    else if (type instanceof ParameterDefinition)
42226       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
42227    else if (type instanceof CodeType) {
42228      composeCodeCore(prefix+"Code", (CodeType) type, false);
42229      composeCodeExtras(prefix+"Code", (CodeType) type, false);
42230    }
42231    else if (type instanceof OidType) {
42232      composeOidCore(prefix+"Oid", (OidType) type, false);
42233      composeOidExtras(prefix+"Oid", (OidType) type, false);
42234    }
42235    else if (type instanceof UuidType) {
42236      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
42237      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
42238    }
42239    else if (type instanceof UnsignedIntType) {
42240      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42241      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
42242    }
42243    else if (type instanceof MarkdownType) {
42244      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
42245      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
42246    }
42247    else if (type instanceof IdType) {
42248      composeIdCore(prefix+"Id", (IdType) type, false);
42249      composeIdExtras(prefix+"Id", (IdType) type, false);
42250    }
42251    else if (type instanceof PositiveIntType) {
42252      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
42253      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
42254    }
42255    else if (type instanceof DateType) {
42256      composeDateCore(prefix+"Date", (DateType) type, false);
42257      composeDateExtras(prefix+"Date", (DateType) type, false);
42258    }
42259    else if (type instanceof DateTimeType) {
42260      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
42261      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
42262    }
42263    else if (type instanceof StringType) {
42264      composeStringCore(prefix+"String", (StringType) type, false);
42265      composeStringExtras(prefix+"String", (StringType) type, false);
42266    }
42267    else if (type instanceof IntegerType) {
42268      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
42269      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
42270    }
42271    else if (type instanceof UriType) {
42272      composeUriCore(prefix+"Uri", (UriType) type, false);
42273      composeUriExtras(prefix+"Uri", (UriType) type, false);
42274    }
42275    else if (type instanceof InstantType) {
42276      composeInstantCore(prefix+"Instant", (InstantType) type, false);
42277      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
42278    }
42279    else if (type instanceof BooleanType) {
42280      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
42281      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
42282    }
42283    else if (type instanceof Base64BinaryType) {
42284      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
42285      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
42286    }
42287    else if (type instanceof TimeType) {
42288      composeTimeCore(prefix+"Time", (TimeType) type, false);
42289      composeTimeExtras(prefix+"Time", (TimeType) type, false);
42290    }
42291    else if (type instanceof DecimalType) {
42292      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
42293      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
42294    }
42295    else
42296      throw new Error("Unhandled type");
42297  }
42298
42299  protected void composeTypeInner(Type type) throws IOException {
42300    if (type == null)
42301      ;
42302    else if (type instanceof Duration)
42303       composeDurationInner((Duration) type);
42304    else if (type instanceof Count)
42305       composeCountInner((Count) type);
42306    else if (type instanceof Money)
42307       composeMoneyInner((Money) type);
42308    else if (type instanceof Distance)
42309       composeDistanceInner((Distance) type);
42310    else if (type instanceof Age)
42311       composeAgeInner((Age) type);
42312    else if (type instanceof Reference)
42313       composeReferenceInner((Reference) type);
42314    else if (type instanceof Quantity)
42315       composeQuantityInner((Quantity) type);
42316    else if (type instanceof Period)
42317       composePeriodInner((Period) type);
42318    else if (type instanceof Attachment)
42319       composeAttachmentInner((Attachment) type);
42320    else if (type instanceof Range)
42321       composeRangeInner((Range) type);
42322    else if (type instanceof Annotation)
42323       composeAnnotationInner((Annotation) type);
42324    else if (type instanceof Identifier)
42325       composeIdentifierInner((Identifier) type);
42326    else if (type instanceof Coding)
42327       composeCodingInner((Coding) type);
42328    else if (type instanceof Signature)
42329       composeSignatureInner((Signature) type);
42330    else if (type instanceof SampledData)
42331       composeSampledDataInner((SampledData) type);
42332    else if (type instanceof Ratio)
42333       composeRatioInner((Ratio) type);
42334    else if (type instanceof CodeableConcept)
42335       composeCodeableConceptInner((CodeableConcept) type);
42336    else if (type instanceof SimpleQuantity)
42337       composeSimpleQuantityInner((SimpleQuantity) type);
42338    else if (type instanceof Meta)
42339       composeMetaInner((Meta) type);
42340    else if (type instanceof Address)
42341       composeAddressInner((Address) type);
42342    else if (type instanceof TriggerDefinition)
42343       composeTriggerDefinitionInner((TriggerDefinition) type);
42344    else if (type instanceof Contributor)
42345       composeContributorInner((Contributor) type);
42346    else if (type instanceof DataRequirement)
42347       composeDataRequirementInner((DataRequirement) type);
42348    else if (type instanceof Dosage)
42349       composeDosageInner((Dosage) type);
42350    else if (type instanceof RelatedArtifact)
42351       composeRelatedArtifactInner((RelatedArtifact) type);
42352    else if (type instanceof ContactDetail)
42353       composeContactDetailInner((ContactDetail) type);
42354    else if (type instanceof HumanName)
42355       composeHumanNameInner((HumanName) type);
42356    else if (type instanceof ContactPoint)
42357       composeContactPointInner((ContactPoint) type);
42358    else if (type instanceof UsageContext)
42359       composeUsageContextInner((UsageContext) type);
42360    else if (type instanceof Timing)
42361       composeTimingInner((Timing) type);
42362    else if (type instanceof ElementDefinition)
42363       composeElementDefinitionInner((ElementDefinition) type);
42364    else if (type instanceof ParameterDefinition)
42365       composeParameterDefinitionInner((ParameterDefinition) type);
42366    else
42367      throw new Error("Unhandled type");
42368  }
42369
42370}
42371